# Why do I need the inverse transition_map?

I have the following code that works fine:

reset()
R3 = Manifold(3, 'R3', start_index=1, latex_name=r'\mathbb{R}^3')
Cartesian3d.<x,y,z> = R3.chart()
lg = R3.metric('lg')
lg[:] = identity_matrix(R3.dim())
F = R3.vector_field()
F[:] = [x*z, y*z, x^2+y^2]
omega = F.down(lg).hodge_dual(lg)
omega.set_name('omega', r'\omega')
domega = omega.exterior_derivative()
domega.set_name('domega', r'\mathrm{d}\omega')

# Change of coordinates
Spherical.<rho,phi,theta> = R3.chart(r'rho:(0,+oo):\rho phi:(0,pi):\varphi theta:(0,2*pi):\theta')
g = Spherical.transition_map(Cartesian3d, [rho*sin(phi)*cos(theta), rho*sin(phi)*sin(theta), rho*cos(phi)])
g.set_inverse(sqrt(x^2+y^2+z^2), atan2(sqrt(x^2+y^2), z), atan2(y, x))

domega.display()

domega.display(Spherical.frame(), Spherical)


Except that all breaks loose if I comment out the definition of the inverse transition_map in the above code and run all the code again. In this case the last command issues a KeyError with an incomprehensible message:

KeyError: (Chart (R3, (x, y, z)), Chart (R3, (rho, phi, theta)))


Why do I need to define the inverse transition_map? Where is this inverse transition_map used?

I have an equivalent code in Maxima that calculates the same, but I don't need to defined the inverse map.

Daniel

edit retag close merge delete