Ask Your Question

Revision history [back]

Define a differential form recursively

I have the following code:

n=3;
x = list(var('x_%d' % i) for i in (1..2*n));
U = CoordinatePatch(x);
F = DifferentialForms(U);
w = DifferentialForm(F,2);
  for j in range(2*n-1):
     for k in range(2*n-1):
        w[j,k]=j+k;
w;

It's supposed to define a differential form whose (j,k)th member is j+k, but this code just returns the 0 differential form. I've tried many variations using for, while, etc., but none seem to work. I suspect it's because a differential form is stored as a dictionary, but since I'm a beginner in Sage, I have no idea what to do. Any help is appreciated.