# Several charts at top create trouble with submanifolds

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:
display(ecc[cc].display())

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

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
E.set_default_frame(cylindrical_frame)
E.set_default_chart(cylindrical)
Cyl2tocylindrical = C2.diff_map(E, {(Cyl2, cylindrical): [1, ph, z]})
cylindricaltoCyl2 = E.diff_map(C2, {(cylindrical, Cyl2): [ph, z]})
C2.set_embedding(Cyl2tocylindrical)

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

C2g = C2.induced_metric()  # never an error message here
display(C2g.display())  # exhibits the issue

edit retag close merge delete

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

Sort by ยป oldest newest most voted

Thanks for reporting this bug! It is now tracked at https://trac.sagemath.org/ticket/31904 .

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:

Cyl2tocylindrical.display()


Then

C2g = C2.induced_metric()
C2g.display()


displays the expected result.

EDIT (7 July 2021): the fix proposed in the ticket #31904 has been merged in SageMath 9.4.beta4. So, the next stable release of SageMath (9.4) will be free from this bug. Thanks again for the report.

more

Hello Eric,

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 diff_map.py, 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

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.

( 2021-06-07 17:39:35 +0200 )edit