Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does "atan2(value1, value2)" mean???

Status
Not open for further replies.

SteffDK

New member
Sep 9, 2005
3
I'm trying to apply a function, in MS Excel, posted on the internet from mathcad.

Somewhere it says that "value=atan2(value1, value2)"

I don't get it...
It can't mean atan(atan(value1, value))

What's with the "(value1, value2)"??? How do I calculate that???

Any help is highly appreciated :eek:)
 
Replies continue below

Recommended for you

Standard atan function take argument of x/y
atan2 takes arguments x and y.



TTFN



 
Mathcad atan2(x,y) Returns the angle (in radians) from the x-axis to a line containing the origin (0,0) and the point (x,y). The value returned is always between -p and p, [red]including[/red] p.

Excel: ATAN2(x_num,y_num) Returns the arctangent, or inverse tangent, of the specified x- and y-coordinates. The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a point with coordinates (x_num, y_num). The angle is given in radians between -pi and pi, [red]excluding [/red]-pi.

Syntax: [blue] ATAN2(x_num,y_num)

X_num is the x-coordinate of the point.

Y_num is the y-coordinate of the point.[/blue]
Remarks:
o A positive result represents a counterclockwise angle from the x-axis; a negative result represents a clockwise angle.
o ATAN2(a,b) equals ATAN(b/a), except that a can equal 0 in ATAN2.
o If both x_num and y_num are 0, ATAN2 returns the #DIV/0! error value. To express the arctangent in degrees, multiply the result by 180/PI( ) or use the DEGREES function.
 
I think the emphasis is slightly wrong in the above, judging by the results in other languages.

Typically a=atan(x) returns a in just two quadrants (typically -pi/2 to pi/2). atan2(x,y) typically examines the sign of each argument and returns a in any of 4 quadrants.

Try atan2(-1,1) atan2(1,-1) atan2(1,1) and atan2 (-1,-1) to see what is going on.



Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Thanks everyone :)

Now I only need to know what csc() means ...

Regarding atan2, I found this function that will work in visual basic:

Public Function Atan2(ByVal y As Double, ByVal x As Double) _
As Double
Dim theta As Double

If (Abs(x) < 0.0000001) Then
If (Abs(y) < 0.0000001) Then
theta = 0#
ElseIf (y > 0#) Then
theta = 1.5707963267949
Else
theta = -1.5707963267949
End If
Else
theta = Atn(y / x)

If (x < 0) Then
If (y >= 0#) Then
theta = 3.14159265358979 + theta
Else
theta = theta - 3.14159265358979
End If
End If
End If

Atan2 = theta
End Function
 
SteffDK

It is recommended before you ask any question to invest searching yourself for answer. The value of this is that you may became self-sufficient and exercise a basic skill for searching.

One way to accomplish that is using the software help menu or hit the key [F1].Other way is using the software manual or searching the internet.

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor