APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Issue with atan2 in Tracker post and replies

Return to the Issue with atan2 in Tracker thread
Login to post to this thread

Flipped parameters for atan2
Louis S
1 Posts

Hi! When I look at the available mathematical functions in tracker (which uses the OSP parser), the documentation describes atan2(x, y). However, atan2 is conventionally called by atan2(y, x). This line in OSP (https://github.com/OpenSourcePhysics/osp/blob/master/src/org/opensourcephysics/ejs/control/value/ParserSuryono.java#L1093) seems to indicate that it should be atan2(y, x) in the documentation. Thoughts?


Replies to Flipped parameters for atan2

Re: Flipped parameters for atan2 -
Jens Biele
6 Posts

Hi,
this is an eternal issue...
atan2 is a function of 2 arguments, c*sin(alpha) and c*cos(alpha), where c is an arbitrary constant, and it returns alpha in the correct quadrant.

The pragmatic solution is to try it out!



Re: Flipped parameters for atan2 -
Douglas Brown Avatar
Douglas Brown
450 Posts

Louis, you are absolutely right. Thanks for finding that error!  Doug


> Re: Flipped parameters for atan2
>
> Hi! When I look at the available mathematical functions
> in tracker (which uses the OSP parser), the documentation
> describes atan2(x, y). However, atan2 is conventionally
> called by atan2(y, x). This line in OSP (https://github.com/OpenSourcePhysics/osp/blob/master/src/org/opensourcephysics/ejs/control/value/ParserSuryono.java#L1093)
> seems to indicate that it should be atan2(y, x) in
> the documentation. Thoughts?



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book