Ask Your Question
1

Error regarding declaring tensor field in Sage

asked 2018-05-02 09:02:11 -0500

Shouvik gravatar image

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 flag offensive close merge delete

Comments

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)

Please edit your question to do that.

slelievre gravatar imageslelievre ( 2018-05-03 05:50:55 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-05-02 12:41:02 -0500

danielvolinski gravatar image

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)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-05-02 09:02:11 -0500

Seen: 37 times

Last updated: May 02