Ask Your Question

Changing chart multiple times in sagemanifolds

asked 2019-08-29 12:28:21 -0600

my_screen_name gravatar image

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".

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2019-08-29 14:37:08 -0600

eric_g gravatar image

updated 2019-08-30 04:29:55 -0600

The issue arises because you have not fully defined the transition maps on the manifold: the inverse maps are missing. You have to generate them by invoking


just after the definition of ChangeFirst_to_Second and


just after the definition of ChangeSecond_to_Third. Then everything is OK.

The reason why the inverse transition maps are not automatically evaluated is that in certain cases Sage is not capable to compute them (the method inverse() returns then an error); the user has then to provide them by hand, via the method set_inverse().

EDIT: actually, in the present case, the inverse transition maps should not be required to compute the expression of $g$ in the third frame. This will be fixed in the next release of SageMath, thanks to the Trac ticket #28072, which has been merged in SageMath 8.9.beta2.

edit flag offensive delete link more


Can we catch the KeyError and raise a more meaningful error message instead?

rburing gravatar imagerburing ( 2019-08-29 15:39:25 -0600 )edit

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.

my_screen_name gravatar imagemy_screen_name ( 2019-08-29 16:39:32 -0600 )edit

@my_screen_name: you are right: in the current stable version of Sage (8.8), there are unnecessary restrictions in the handling of coordinate changes. This is fixed by the Trac ticket #28072, which has been merged in Sage 8.9.beta2. In particular, with run with Sage 8.9.beta8, your original code gives no error and displays $g = \mathrm{d}z\otimes\mathrm{d}z$ in the last line. I have edited my answer accordingly.

eric_g gravatar imageeric_g ( 2019-08-30 04:24:58 -0600 )edit

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

my_screen_name gravatar imagemy_screen_name ( 2019-08-30 08:19:00 -0600 )edit

SageMath 8.9 is out now. You can check that your example works nicely with it.

eric_g gravatar imageeric_g ( 2019-10-05 15:45:12 -0600 )edit

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


Asked: 2019-08-29 12:28:21 -0600

Seen: 75 times

Last updated: Aug 30 '19