Ask Your Question

Several charts at top create trouble with submanifolds

asked 2021-06-03 09:45:18 +0200

LPsFR gravatar image

updated 2021-06-04 10:38:51 +0200

tmonteil gravatar image

My issue seems pretty trivial, however, I cannot find a way.

I create a manifold, with 2 frames/charts, and create transition_map between them. Create a metric. I create then a submanifold, create diff_map to the first manifold, and make an embedding. Then I try to get the induced_metric.

It works only if the diff_map is referenced to the first created frame/chart at top level.

In my example:

  • top manifold with cartesian and cylindrical charts
  • sub manifold is a cylinder. I cannot base it on the cylindrical top chart.

My purpose would be to have a top manifold series of charts at top and natural embeddings of lower dimension manifolds.

Any idea?

My code:

E = Manifold(3, 'E', structure='Riemannian')
cartesian.<x,y,z> = E.chart()
cartesian_frame = cartesian.frame()

cylindrical.<r,ph,z> = E.chart(r'r:(0,+oo) ph:(0,2*pi):\phi z')
cylindrical_frame = cylindrical.frame()  
cyl2cart = cylindrical.transition_map(cartesian , [r*cos(ph), r*sin(ph), z])
cart2cyl = cyl2cart.set_inverse(sqrt(x^2 + y^2), atan2(y, x), z)

ecc = E.coord_changes()
for cc in ecc:

g = E.metric()
g[cartesian_frame, 0, 0], g[cartesian_frame, 1, 1], g[cartesian_frame, 2, 2] = 1, 1, 1

C2 = Manifold(2, 'C2', ambient=E, structure='Riemannian')
Cyl2.<ph,z> = C2.chart(r'ph:\phi z')
Cyl2_frame = Cyl2.frame()

if True:  # True shows issue
    Cyl2tocylindrical = C2.diff_map(E, {(Cyl2, cylindrical): [1, ph, z]})
    cylindricaltoCyl2 = E.diff_map(C2, {(cylindrical, Cyl2): [ph, z]})

    Cyl2tocartesian = C2.diff_map(E, {(Cyl2, cartesian): [cos(ph), sin(ph), z]})
    cartesiantoCyl2 = E.diff_map(C2, {(cartesian, Cyl2): [arctan2(y, x), z]})

C2g = C2.induced_metric()  # never an error message here
display(C2g.display())  # exhibits the issue
edit retag flag offensive close merge delete


Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2021-06-03 10:03:36 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2021-06-04 09:49:29 +0200

eric_g gravatar image

Thanks for reporting this bug! It is now tracked at .

An immediate fix is to force the evaluation of the map Cyl2tocylindrical in the chart cartesian by a call to display() just before the computation of the induced metric:



C2g = C2.induced_metric()

displays the expected result.

edit flag offensive delete link more

answered 2021-06-04 15:19:05 +0200

LPsFR gravatar image

Hello Eric,

Thank you for your answer It now works fine!

I noticed that the SageManifold source code is available in the delivery (I thought initialy this was reserved to the Sage source code version). So I dived (painfully as not a Python programmer) into *.py files and finally into the, and isolated the _pullback_chart method as being either the bug place, or a place where I can insert a patch. Apparently in the routine the line containing "return resu" is indented 1 step too much, so the loop "for frame2 in tensor._components:" is executed only once. If you are lucky because the top charts are in the favourable order this is the good one; if not the routine returns an empty dictionnary . So I reduced the indent and got a satisfactory result at the end of _pullback_chart routine.

I cannot say it is a full fix, it may be a regression is some other ways. Just hoping it may help.

Kind regards, Laurent

edit flag offensive delete link more


Yes, you are right: the issue that you have reported was triggered by a bad indentation of return resu. This and another issue are fixed in #31904.

eric_g gravatar imageeric_g ( 2021-06-07 17:39:35 +0200 )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


Asked: 2021-06-03 09:45:18 +0200

Seen: 68 times

Last updated: Jun 04