google2
google2

Reputation: 325

Python solving goniometric equation

I use Python. I have formulas like sin(a)=v1 and cos(a)=v2. In math, I would do arcsin(v1) and arccos(v2) to find sollution of this equation. Is there some nice way how to solve this kind of equations in Python? Something like solve(v1,v2) -> angle?

Thanks for your time.

Upvotes: 0

Views: 261

Answers (1)

sciroccorics
sciroccorics

Reputation: 2427

atan2(y,x) should answer your question. Here is the doctring:

>>> help(math.atan2)
Help on built-in function atan2 in module math:

atan2(...)
    atan2(y, x)

    Return the arc tangent (measured in radians) of y/x.
    Unlike atan(y/x), the signs of both x and y are considered.

Upvotes: 2

Related Questions