24 Feb
2010
24 Feb
'10
7:48 p.m.
Warren Weckesser <warren.weckesser <at> enthought.com> writes:
Scott,
As you suspected, the problem is your use of arctan, and an appropriate use of arctan2 can correct it. If I change this:
t*scipy.sin(theta + scipy.arctan((a**2.0/b**2.0)*(1.0/scipy.tan(theta))))
to this:
t*scipy.sin(theta + scipy.arctan2( a**2.0*scipy.cos(theta), b**2.0*scipy.sin(theta)) )
then the results agree.
Warren
Ah, excellent. Thank you very much for your help Warren! When I tried using arctan2, I didn't think about breaking up tangent into its sine and cosine components and instead kept it as tangent or cotangent in the numerator or denominator, as appropriate. Thanks, Scott