Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I seem to get something reasonable here, not the zero form.

??????????????????????????????????????????????????????????????????????
? Sage Version 5.12, Release Date: 2013-10-07                        ?
? Type "notebook()" for the browser-based notebook interface.        ?
? Type "help()" for help.                                            ?
??????????????????????????????????????????????????????????????????????
sage: n=3;
sage: x = list(var('x_%d' % i) for i in (1..2*n));
sage: U = CoordinatePatch(x);
sage: F = DifferentialForms(U);
sage: w = DifferentialForm(F,2);
sage:   for j in range(2*n-1):
....:          for k in range(2*n-1):
....:                 w[j,k]=j+k;
....:         
sage: w
-1*dx_1/\dx_2 + -3*dx_2/\dx_3 + 0*dx_1/\dx_1 + 0*dx_4/\dx_4 + 0*dx_3/\dx_3 + 0*dx_5/\dx_5 + -5*dx_2/\dx_5 + -2*dx_1/\dx_3 + -4*dx_2/\dx_4 + -5*dx_3/\dx_4 + -4*dx_1/\dx_5 + -6*dx_3/\dx_5 + -3*dx_1/\dx_4 + -7*dx_4/\dx_5 + 0*dx_2/\dx_2

I will point out that perhaps you are using 1-based counting, but Python starts counting at 0. Is this what you are looking for?

sage: for j in range(2*n-1):
....:     for k in range(2*n-1):
....:         w[j,k] = j+1+k+1
....:         
sage: w
-3*dx_1/\dx_2 + -5*dx_2/\dx_3 + 0*dx_1/\dx_1 + 0*dx_4/\dx_4 + 0*dx_3/\dx_3 + 0*dx_5/\dx_5 + -7*dx_2/\dx_5 + -4*dx_1/\dx_3 + -6*dx_2/\dx_4 + -7*dx_3/\dx_4 + -6*dx_1/\dx_5 + -8*dx_3/\dx_5 + -5*dx_1/\dx_4 + -9*dx_4/\dx_5 + 0*dx_2/\dx_2

I don't know whether the negatives are what you want or not, nor why the necessarily zero differentials are even included, but I've never used this functionality before, so you will have to peruse the documentation for technical points like this.