Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

inverse secant function

Status
Not open for further replies.

kchewy80

Technical User
May 1, 2003
1
US
I am trying to use the inverse secant formula given in the help menu but I keep getting the wrong answer. Here is what I am using:

angle(i) = Atn(a / Sqr(a * a - 1)) + _
Sgn((a) - 1 * (2 * Atn(1))
angle(i) = angle(i) * 180 / PI

When a is 1.414 the angle is calculated to be 172 degrees, when it should be 45 degrees.

Any ideas on why this is would be very helpful.

Thanks
 
Try this:
[blue]
Code:
Option Explicit
Const RADIANS_TO_DEGREES = 57.2957795130823

Function ArcSecant(A)
  ArcSecant = (Sgn(A) * Atn(Sqr(1 / (A ^ 2 - 1)))) * RADIANS_TO_DEGREES
End Function
[/color]

Or if you prefer, here is the equivalent in a spreadsheet function:
[blue]
Code:
  =(SIGN(A1)*ATAN(SQRT(1/(A1^2-1))))*180/PI()
[/color]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top