Hello,
In the following code I define a differentiable map between two manifolds, then restrict it to a subset and then compute the matrix of its differential at a point in the subset (see also the attached jpynb file).
I have noticed that when I execute this code several times by inserting the cursor and pressing Shift+Enter I do not always get the same result. Namely, the first two rows of the matrix are sometimes swapped (try it for about 10 times).
reset()
M = Manifold(2, 'M', latex_name=r'\mathcal{M}', start_index=1)
M_cartesian.<u,v> = M.chart()
U = M.open_subset('U', coord_def={M_cartesian: (v!=0, u>0)})
U_cartesian = M_cartesian.restrict(U)
U_polar.<r,th> = U.chart(r'r:(0,+oo) th:(-pi,pi):\theta')
polar_to_cartesian = U_polar.transition_map(U_cartesian, [r*sin(th), r*cos(th)])
polar_to_cartesian.set_inverse(sqrt(u*u+v*v), atan2(v,u))
N = Manifold(3, 'N', latex_name=r'\mathcal{N}', start_index=1)
N_cartesian.<x,y,z> = N.chart()
Phi = M.diff_map(N, [u,v,u^2+v^2], name='Phi', latex_name=r'\Phi')
Phi_U=Phi.restrict(U)
p=M.point((2,1), name='p')
Phi_U.differential(p).matrix()
I would like to know: Where does this inconsistency come from?
In order to answer this question the following observations might be useful:
1. If I compute the differential of the unrestricted map (i.e. Phi.differential(p).matrix()) the problem does not appear.
2. If I insert the line "Phi_U.differential_functions()" before "Phi_U.differential(p).matrix()" the problem does not appear.
3. If in Jupyter notebook I click "Kernel" then "Restart & Run All" the problem does not appear.
Although methods 2 and 3 provide a workaround, it would certainly be great to have this inconsistency cleared. I would appreciate any help.
Best,
Andreas