Ask Your Question

my_screen_name's profile - activity

2019-08-30 15:19:00 +0200 commented answer Changing chart multiple times in sagemanifolds

@eric_g: Thanks for the further update, and I'm glad to learn this will be fixed in the next release.

2019-08-29 23:39:32 +0200 commented answer Changing chart multiple times in sagemanifolds

eric_g: Thanks for the answer. I assume it is correct, but it seems a surprising situation. Since $\psi_3\circ\psi_1^{-1} = (\psi_3\circ\psi_2^{-1})\circ(\psi_2\circ\psi_1^{-1})$, I don't see why the inverse maps should need to be defined. In particular, in the example I'm thinking of (converting standard Schwarzschild coordinates to Regge-Wheeler tortoise coordinates, then Eddington-Finkelstein null coordinates, and then Kruskal), it is impossible to invert the first coordinate transform. Does this mean that, while I can directly define a transition map from the first coordinate system to the third, I can't define it by going from the first to the second and then the second to the third? This seems like an unnecessary restriction.

rburing: I would also like clearer error message.

2019-08-29 19:28:21 +0200 asked a question Changing chart multiple times in sagemanifolds

In sagemanifolds, I would like to change from an initial chart to a second and then, from the second to the third. My attempts fail. Is this my fault or a sagemanifolds problem? (Apologies if I already asked this.)

Here is a minimal (not) working example. I run the following file:

theManifold = Manifold(1, 'M', r'\mathcal{M}')
theOpenSet = theManifold.open_subset('U')

theFirstChart.<x> = theOpenSet.chart(r'x')

g = theManifold.riemannian_metric('g')
g[0,0] =  1


theSecondChart.<y> = theOpenSet.chart(r'y')
ChangeFirst_to_Second = theFirstChart.transition_map(theSecondChart,[x])


theThirdChart.<z> = theOpenSet.chart(r'z')
ChangeSecond_to_Third = theSecondChart.transition_map(theThirdChart,[y])


The output is


and then a few screens of error messages, of which the most clear is "no common chart for the multiplication".

2019-07-29 10:47:32 +0200 received badge  Enlightened (source)
2019-07-29 10:47:32 +0200 received badge  Good Answer (source)
2019-06-03 14:06:23 +0200 asked a question Trouble with spherical coordinates in sagemanifolds

I'm probably doing something obviously wrong, but I'd appreciate help with the following.

I load the following file

theManifold = Manifold(3, 'M', r'\mathcal{M}')
theOpenSet = theManifold.open_subset('theOpenSet')
CartesianChart.<x,y,z> = theOpenSet.chart(r'x y z')
g = theManifold.lorentzian_metric('g')
g[0,0] = 1
g[1,1] = 1
g[2,2] = 1
sphericalChart.<r,th,ph> = theOpenSet.chart(r'r th:(0,pi):\theta ph:(0,2*pi):\phi')

spherical_to_Cartesian = sphericalChart.transition_map(CartesianChart,[r*sin(th)*sin(ph),r*sin(th)*cos(ph),r*cos(th)])
Cartesian_to_spherical = spherical_to_Cartesian.inverse()

Sage then gives the error message "ValueError: no solution found; use set_inverse() to set the inverse manually".

If I replace the final two lines with

 Cartesian_to_spherical = CartesianChart.transition_map(sphericalChart[sqrt(x^2+y^2+z^2),arctan(z/sqrt(x^2+y^2)),arctan(y/x)])
 spherical_to_Cartesian = Cartesian_to_spherical.inverse()

then Sage gives the following unable to make sense of Maxima expression '[if((-pi/2<parg(_sage_var_xxxx0))and(-pi 2<parg(-_sage_var_xxxx0="" sqrt((4<em="">e^(2I_SAGE_VAR_xxxx1))/(e^(4I*_SA ... [dozens of lines of similar] ... tan(_SAGE_VAR_xxxx1)^2+1)],union())]' in Sage.

I am aware that Sagemanifolds has native commands for using spherical coordinates. I'm attempting to work on a more complicated manifold, and this is is a minimal working example to demonstrate my problems.

2019-06-03 13:44:40 +0200 commented answer Bel decomposition

I think what you want is

e0 = M.one_form()
e0[0] = sqrt(1-2*m/r)

This gives a unit timelike one-form. Of course, relativity being relativity, there are infinitely many other choices of unit timelike vector. This becomes a more serious issue when working in Kerr.

2019-05-22 11:42:30 +0200 received badge  Scholar (source)
2019-05-22 11:40:04 +0200 commented answer set_default_chart seems to fail

When I set the defaults based for theOpenSet, I get (1/2) y dx⊗dx. If I use


then I do get (1/8) y dy ⊗ dy, as desired. I don't see the logic, but thanks for getting this to work.

2019-05-22 11:37:02 +0200 received badge  Supporter (source)
2019-05-22 00:01:32 +0200 received badge  Nice Answer (source)
2019-05-22 00:00:24 +0200 received badge  Student (source)
2019-05-21 23:47:04 +0200 received badge  Teacher (source)
2019-05-21 20:56:03 +0200 answered a question Bel decomposition

The Bel decomposition does not appear in the sagemanifolds reference document, so I assume it is a default command. Nonetheless, it is fairly easy to implement. Assuming that one already has a metric g and a 1-form e0 (perhaps from the 0th element of the coordinate coframe)

theVolumeForm = g.volume_form()
theStarForTwoForms = theVolumeForm.up(g,0).up(g,1)

theRiemann = g.riemann()
theRiemannAllDown = theRiemann.down(g,0)
theStarRiemann = theStarForTwoForms['^{ef}_{ab}']*theRiemannAllDown['_{efcd}']
theStarRiemannStar = theStarForTwoForms['^{ef}_{cd}']*theStarRiemann['_{abef}']

theElectrograviticTensor = (theRiemannAllDown['_{abcd}']*(e0.up(g))['^d'])['_{abc}']*(e0.up(g))['^b']
theMagnetograviticTensor = (theStarRiemann['_{abcd}']*(e0.up(g))['^d'])['_{abc}']*(e0.up(g))['^b']
theTopograviticTensor = (theStarRiemannStar['_{abcd}']*(e0.up(g))['^d'])['_{abc}']*(e0.up(g))['^b']

I have probably mangled some signs in the choice of order of raising and contracting indices on the volume form.

(Some tricks to be aware of: When using up and down, since sagemanifolds stores all contravariant indices first, for a fully contravariant tensor, raising index 1 and then lowering index 1 gives an error since the raised index is automatically moved to index 0. The * operation on tensor only works on a pair of tensors. The latex notation for indices (e.g. ['^{ab}']) can be used to take products and contract tensors, but the latex indexing is lost once the * operation is complete. Thus for a product of three indices, one needs to open a parenthesis, apply the indices to get the correct contraction and product for the first two tensors, close the parenthesis, apply a new set of indices, and then multiply by the third tensor.)

2019-05-21 13:34:53 +0200 commented question tangent space vector mapping

Regarding (2), I couldn't reproduce this. In particular, when I create a manifold (and define some coordinates on it) and then run

p = theManifold.point(name='p')

TpM = theManifold.tangent_space(p)

v = TpM.an_element()


I get the error message

ValueError: no basis could be found for computing the components in the None

2019-05-21 13:16:05 +0200 asked a question set_default_chart seems to fail

I load the following file

theManifold = Manifold(1,'M',r'\mathcal{M}')
theManifold = Manifold(1,'M',r'\mathcal{M}')

theOpenSet = theManifold.open_subset('U')

firstChart.<x> = theOpenSet.chart(r'x')

g[0,0] = x

show("g with first chart")

secondChart.<y> = theOpenSet.chart('y')

first_to_second = firstChart.transition_map(secondChart,[2*x])
second_to_first = first_to_second.inverse()

show("g with secondChart.frame() and secondChart as arguments to display")


show("g with secondChart.frame() and secondChart as defaults")

The output is

𝚐 𝚠𝚒𝚝𝚑 𝚏𝚒𝚛𝚜𝚝 𝚌𝚑𝚊𝚛𝚝
g=x dx⊗dx
𝚐 𝚠𝚒𝚝𝚑 𝚜𝚎𝚌𝚘𝚗𝚍𝙲𝚑𝚊𝚛𝚝.𝚏𝚛𝚊𝚖𝚎() 𝚊𝚗𝚍 𝚜𝚎𝚌𝚘𝚗𝚍𝙲𝚑𝚊𝚛𝚝 𝚊𝚜 𝚊𝚛𝚐𝚞𝚖𝚎𝚗𝚝𝚜 𝚝𝚘 𝚍𝚒𝚜𝚙𝚕𝚊𝚢
g=1/8 y dy⊗dy
𝚐 𝚠𝚒𝚝𝚑 𝚜𝚎𝚌𝚘𝚗𝚍𝙲𝚑𝚊𝚛𝚝.𝚏𝚛𝚊𝚖𝚎() 𝚊𝚗𝚍 𝚜𝚎𝚌𝚘𝚗𝚍𝙲𝚑𝚊𝚛𝚝 𝚊𝚜 𝚍𝚎𝚏𝚊𝚞𝚕𝚝𝚜
g=1/4 x dy⊗dy

In particular, when the secondChart and secondChart.frame() have been set as defaults, the metric g is expanded with respect to the second frame, but the components are still expressed in the first coordinates.

Is there a way to set defaults so that g appears as 1/8 y dy ⊗dy?

2019-03-25 23:51:51 +0200 commented answer simplify_trig and sorting, for example in fractions

I upgraded to sagemath 8.6 (the latest version with binaries available for my system), and this now works. Thanks for pointing out to use newer versions.

2019-03-24 12:58:15 +0200 asked a question simplify_trig and sorting, for example in fractions

The output of




Even worse, the result of




when it should be 1. Is there anyway to get sagemath to simplify trigonometric expressions more intelligently?