I never even noticed that there were *'s missing from

M = a(1 - e^2) / (1 - e^2 sin(phi)^2)^(3/2)

R = a cos(phi) / (1 - e^2 sin(phi)^2)^(1/2)