简体   繁体   中英

How can the arctan2 function be calculated for time?

So, I am trying to calculate the solution of the transcendental equation of the form:

a*cos(t)+b*sin(t)= c*cos(t)+d*sin(t)

for t which can be re-caste as:

tan(t)=(a-b)/(d-c)

Now, one can simply use the arctan2 of Numpy but the result is between [-pi/2,pi/2] whereas t is time and cannot be negative.

Which function of Numpy do I use to find only the positive solutions for the above two equations?

A better way to put this is: What type of arctan function do I use so that I get the value in between [0,pi]

You have two options. Which one you select depends on the physical meaning of the inputs and solution.

  1. Discard negative inputs (if either a < b or d <= c , but not both): there is no possible answer.

  2. Wrap negative angles to the positive side by adding pi .

Since you don't care about quadrants, you can use np.arctan instead of np.arctan2 . Pre-computing the ratio will make it easier to check on option #1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM