# 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

show(g.display())

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

show(g.display(theSecondChart.frame()))

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

show(g.display(theThirdChart.frame()))


The output is

g=dx⊗dx
g=dy⊗dy


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

edit retag close merge delete

Sort by » oldest newest most voted

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

ChangeFirst_to_Second.inverse()


just after the definition of ChangeFirst_to_Second and

ChangeSecond_to_Third.inverse()


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.

more

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

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: 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: Thanks for the further update, and I'm glad to learn this will be fixed in the next release.

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