Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Plotting transition-of-transition fails with "cannot evaluate symbolic expression"

Hi Manifolds experts, and many thanks in advance for any help.

I am trying to do a simple exercise (as I thought) to understand how SageMath Manifolds "composes" transitions between maps. Actually, I was very impressed this can be done.

To do this myself, I define the usual cartesian coordinates X and spherical coordinates Y. In addition, define spherical orthonormal coordinates H.

Here is my code to set it all up:

from sage.all import *
from IPython.display import display, Math, Latex

%display latex

M = Manifold(4, 'M', latex_name=r'\mathcal{M}', structure='Lorentzian')
X.<t,x,y,z> = M.chart()

U = M.open_subset('U', coord_def={X: (y!=0, x<0)})
X_U = X.restrict(U)
display(Latex(f'$X_U = {latex(X_U)}$'))
Y.<t,r,th,ph> = U.chart(r't:(-oo,+oo) r:(0,+oo) th:(0,+pi):\theta ph:(0,2*pi):\phi')

transit_Y_to_X = Y.transition_map(X, [
    t, r*sin(th)*cos(ph), r*sin(th)*sin(ph), r*cos(th)
])

transit_Y_to_X.set_inverse(
    t, sqrt(x^2+y^2+z^2), arccos(z/sqrt(x^2+y^2+z^2)), atan2(y,x)
)

H.<t,r,th_,ph_> = U.chart(r't:(-oo,+oo) r:(0,+oo) th_:(0,+oo):\hat{θ} ph_:(0,+oo):\hat{φ}')
transit_H_to_Y = H.transition_map(Y, [
    t, r, th_/r, ph_/(r*sin(th))
])
display(transit_H_to_Y)
display(transit_H_to_Y.display())
transit_H_to_Y.inverse().display()

Then, I introduce the composed transition (the point of my exercise):

transit_H_to_X = transit_Y_to_X * transit_H_to_Y
display(transit_H_to_X)
display(transit_H_to_X.display())

transit_H_to_X.set_inverse(
    t,
    sqrt(x^2+y^2+z^2),
    r*arccos(z/sqrt(x^2+y^2+z^2)),
    r*sin(th)*atan2(y,x)
)
transit_X_to_H = transit_H_to_X.inverse()
display(transit_X_to_H)
display(transit_X_to_H.display())

and try to plot H against X:

H.plot(chart=X,
    ambient_coords=(x,y,z), fixed_coords={t:0},
    ranges={r:(1,1.1), th_:(1.1,1.2)}, number_values=3,
)

This fails with errors TypeError: cannot evaluate symbolic expression numerically. Any ideas on how I can make this work, please? What am I doing wrong?

I am using SageMath 9.5 on Ubuntu 22.04.

Thanks

GPN