# Error regarding declaring tensor field in Sage

This is my code regarding declaration of tensor field for 3 dimensional differentiable manifold M = Manifold(3, 'M') U = M.open_subset('U')
V = M.open_subset('V') M.declare_union(U,V); c_xyz.<x,y,z> = U.chart() c_uvw.<u,v,w> = V.chart() eU = c_xyz.frame() eV = c_uvw.frame() t= M.tensor_field(1,1, name='t') t[eU,:]== [1,1] It is showing error as I cannot properly declare t.Any help is appreciated

edit retag close merge delete

To display inline code, like z = x*y, use backticks.

To display blocks of code or error messages, skip a line above and below, and do one of the following (all give the same result):

• indent all code lines with 4 spaces
• select all code lines and click the "code" button (the icon with '101 010')
• select all code lines and hit ctrl-K

For instance, typing

If we define f by

def f(x, y):
return (x, y)

then f(2, 3) returns (2, 3) but f(2) gives:

TypeError: f() takes exactly 2 arguments (1 given)


produces:

If we define f by

def f(x, y):
return (x, y)


then f(2, 3) returns (2, 3) but f(2) gives:

TypeError: f() takes exactly 2 arguments (1 given)


( 2018-05-03 12:50:55 +0100 )edit

Sort by » oldest newest most voted

I've been using SageMath for a short time but I think I can help you.

I don't understand your last command: t[eU,:]== [1,1]. You are comparing the tensor with [1,1]. I guess this is not what you intended. In essence you are defining a structure akin to a 3 by 3 matrix, so in order to define the tensor I would use something like:

t[0,0], t[1,1], t[2,2] = 1, 2, 3


In order to see the tensor you can use

t[eU,:]


or

t.display(eU)

more