Math Weenies
Be careful of expressions that involve division.
If the denonimator of the expression can ever evaluate to zero then you're
in big trouble.
Bill's expression x/(1+sqrt(1-x*x)) is a case in point.
Both x=1 and x=-1 will lead you into a black hole
An industrial-strength implementation of Asin() based on the MapBasic
intrinsic function Atn() would look something like this:
'--------------------
' return Inverse Sin of x
' domain of x is -1 .. 1
' range of Asin(x) is -Pi/2 .. Pi/2
Function Asin(byVal x as float) as float
Define Pi 3.14159265359
if x < = -1 then
Asin = -Pi/2
elseif x < 1 then
Asin = Atn( x / sqr(1 - x * x))
else 'x >= 1
Asin = Pi/2
end if
End Function
'--------------------
David M Haycraft
Information Analysis Associates Pty Ltd
ABN 47 085 516 105
1 Cumming Place, Wanniassa, 2903
Aust Capital Territory, Australia
Phone/Fax: 61 + 2 + 6231 8104
Mobile: 0412 001 134
Email: [EMAIL PROTECTED]
Web : www.acslink.aone.net.au/actaa/iaa.htm
A MapInfo Technology Partner
----- Original Message -----
From: "Bill Thoen" <[EMAIL PROTECTED]>
To: "Simmonds, Ashley (PTB)" <[EMAIL PROTECTED]>
Cc: "'Mapinfo List (E-mail)'" <[EMAIL PROTECTED]>
Sent: Saturday, 03 August 2002 00:08
Subject: Re: MI-L Calculate Compass Heading
> "Simmonds, Ashley (PTB)" wrote:
> > so does anyone know how to do the arcsine calculation in Access/VB?
it's
> > probably really easy, but i'm no trig guru, i really struggled to get
this
> > far.
>
> It's really easy. Do you have atan2()? If so, use
> asin(x)=atan2(x,sqrt(1-x^2))}
> asin returns a value in the range -pi/2 <= asin <= pi/2
>
> If all you have is atan() then use:
> asin(x)=2*atan(x/(1+sqrt(1-x*x)))
>
> Read the details at http://williams.best.vwh.net/avform.htm#Math
>
>
> --
> - Bill Thoen
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 2372