1 | initial version |
Hi,
The composition transit_H_to_X = transit_Y_to_X * transit_H_to_Y
works well for me (Sage 10.2): it yields a result that does not depend on sin(th)
:
t = t
x = r*cos(ph_/(r*sin(th)))*sin(th_/r)
y = r*sin(th_/r)*sin(ph_/(r*sin(th)))
z = r*cos(th_/r)
I think the error in your initial code comes from the spurious sin(th)
introduced when setting the inverse:
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) # <-- there should be no sin(th) here, nor r
)
The correct definition of the inverse is the one used in your answer:
transit_H_to_X.set_inverse(
t,
sqrt(x^2+y^2+z^2),
sqrt(x^2+y^2+z^2)*arccos(z/sqrt(x^2+y^2+z^2)),
sqrt(x^2+y^2+z^2)*sin(arccos(z/sqrt(x^2+y^2+z^2)))*atan2(y,x)
)
Best wishes,
Eric.