1 | initial version |
The error says it all: in Python, the indentation is very important. In your case, the return s
should start at the same text column than for l in range(g.nrows()):
In general, it is advised to indent with 4 spaces, so, your code should look like:
sage: def christoffel(i,j,k,vars,g):
....: s = 0
....: ginv = g^(-1)
....: for l in range(g.nrows()):
....: s = s + (1/2)*ginv[k,l]*(g[j,l].diff(vars[i])+g[i,l].diff(vars[j])-g[i,j].diff(vars[l]))
....: return s
2 | No.2 Revision |
The error says it all: all (IndentationError
) : in Python, the indentation is very important. In your case, the return s
should start at the same text column than for l in range(g.nrows()):
In general, it is advised to indent with 4 spaces, so, your code should look like:
sage: def christoffel(i,j,k,vars,g):
....: s = 0
....: ginv = g^(-1)
....: for l in range(g.nrows()):
....: s = s + (1/2)*ginv[k,l]*(g[j,l].diff(vars[i])+g[i,l].diff(vars[j])-g[i,j].diff(vars[l]))
....: return s