Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Derivation of a sagemanifold vector (possible bug)

I'm using sage v7.1 with sagemanifold v0.9 to calculate Lie derivatives.

The problem

I define my manifold, with a chart and the vectors which define the symmetry,

M = Manifold(4, 'M', latex_name=r"\mathcal{M}")
X.<t,r,th,ph> = M.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
Lx = M.vector_field('Lx')
Lx[:] = [ 0, 0, -cos(ph), cot(th)*sin(ph) ]
Ly = M.vector_field('Ly')
Ly[:] = [ 0, 0,  sin(ph), cot(th)*cos(ph) ]
Lz = M.vector_field('Lz')
Lz[:] = [ 0, 0, 0, 1]
Lt = M.vector_field('Lt')
Lt[:] = [ 1, 0, 0, 0]

However, if I call the derivative of a component of the vector like

diff( Lx[3], th )

I get a TypeError, because

type( Lx[3] )
<class 'sage.manifolds.coord_func_symb.CoordFunctionSymb'>

and it seems that the function diff only acts on SR expressions.

My bypass

Although I was able to bypass the situation, it would be nice if a solution were provided out of the box, but in case anyone else needs a solution:

I defined my vectors in a Sage way

xi0 = [ 1, 0, 0, 0]
xi1 = [ 0, 0, -cos(ph), cot(th)*sin(ph) ]
xi2 = [ 0, 0,  sin(ph), cot(th)*cos(ph) ]
xi3 = [ 0, 0, 0, 1]

and then assigned them to the SageManifolds vector_field

Lx = M.vector_field('Lx')
Lx[:] = xi1
Ly = M.vector_field('Ly')
Ly[:] = xi2
Lz = M.vector_field('Lz')
Lz[:] = xi3
Lt = M.vector_field('Lt')
Lt[:] = xi0

So, when I need the derivative of a component of the vector, I calculate

diff(xi1[3], th)

Cheers.

Derivation of a sagemanifold vector (possible bug)

I'm using sage v7.1 with sagemanifold v0.9 to calculate Lie derivatives.

The problem

I define my manifold, with a chart and the vectors which define the symmetry,

M = Manifold(4, 'M', latex_name=r"\mathcal{M}")
X.<t,r,th,ph> = M.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
Lx = M.vector_field('Lx')
Lx[:] = [ 0, 0, -cos(ph), cot(th)*sin(ph) ]
Ly = M.vector_field('Ly')
Ly[:] = [ 0, 0,  sin(ph), cot(th)*cos(ph) ]
Lz = M.vector_field('Lz')
Lz[:] = [ 0, 0, 0, 1]
Lt = M.vector_field('Lt')
Lt[:] = [ 1, 0, 0, 0]

However, if I call the derivative of a component of the vector like

diff( Lx[3], th )

I get a TypeError, because

type( Lx[3] )
<class 'sage.manifolds.coord_func_symb.CoordFunctionSymb'>

and it seems that the function diff only acts on SR expressions.

My bypass

Although I was able to bypass the situation, it would be nice if a solution were was provided out of the box, but in case anyone else needs a solution:

I defined my vectors in a Sage way

xi0 = [ 1, 0, 0, 0]
xi1 = [ 0, 0, -cos(ph), cot(th)*sin(ph) ]
xi2 = [ 0, 0,  sin(ph), cot(th)*cos(ph) ]
xi3 = [ 0, 0, 0, 1]

and then assigned them to the SageManifolds vector_field

Lx = M.vector_field('Lx')
Lx[:] = xi1
Ly = M.vector_field('Ly')
Ly[:] = xi2
Lz = M.vector_field('Lz')
Lz[:] = xi3
Lt = M.vector_field('Lt')
Lt[:] = xi0

So, when I need the derivative of a component of the vector, I calculate

diff(xi1[3], th)

Cheers.

click to hide/show revision 3
retagged

Derivation of a sagemanifold vector (possible bug)

I'm using sage v7.1 with sagemanifold v0.9 to calculate Lie derivatives.

The problem

I define my manifold, with a chart and the vectors which define the symmetry,

M = Manifold(4, 'M', latex_name=r"\mathcal{M}")
X.<t,r,th,ph> = M.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
Lx = M.vector_field('Lx')
Lx[:] = [ 0, 0, -cos(ph), cot(th)*sin(ph) ]
Ly = M.vector_field('Ly')
Ly[:] = [ 0, 0,  sin(ph), cot(th)*cos(ph) ]
Lz = M.vector_field('Lz')
Lz[:] = [ 0, 0, 0, 1]
Lt = M.vector_field('Lt')
Lt[:] = [ 1, 0, 0, 0]

However, if I call the derivative of a component of the vector like

diff( Lx[3], th )

I get a TypeError, because

type( Lx[3] )
<class 'sage.manifolds.coord_func_symb.CoordFunctionSymb'>

and it seems that the function diff only acts on SR expressions.

My bypass

Although I was able to bypass the situation, it would be nice if a solution was provided out of the box, but in case anyone else needs a solution:

I defined my vectors in a Sage way

xi0 = [ 1, 0, 0, 0]
xi1 = [ 0, 0, -cos(ph), cot(th)*sin(ph) ]
xi2 = [ 0, 0,  sin(ph), cot(th)*cos(ph) ]
xi3 = [ 0, 0, 0, 1]

and then assigned them to the SageManifolds vector_field

Lx = M.vector_field('Lx')
Lx[:] = xi1
Ly = M.vector_field('Ly')
Ly[:] = xi2
Lz = M.vector_field('Lz')
Lz[:] = xi3
Lt = M.vector_field('Lt')
Lt[:] = xi0

So, when I need the derivative of a component of the vector, I calculate

diff(xi1[3], th)

Cheers.