Hi TIA.

the folowing code will do the calculation for you. please put the
Copyright
in your script.

Ralf.

-- Examples for Chapter 8 - "Math (and Gambling)" of  "Lingo in a
Nutshell"
-- Copyright 1998-1999 Bruce A. Epstein

-- Zeus Productions
-- http://www.zeusprod.com/nutshell
-- mailto:[EMAIL PROTECTED]
-- Version 1.0: August 30, 1999 - Initial Release with asin, acos, sinh,
cosh, tanh

-- Example 8-12a:  Calculating the Arcsine and Arccosine

-- The inverse sine and cosine, known as the arcsine and arccosine
-- can be derived as follows. Note the special handling of the end
conditions:
-- Note: In Director 6.0, "pi" didn't always work, and you can use
"pi()" instead to
-- obtain the value of pi. Or preferably upgrade to Director 6.0.2 or
later

-- The result from asin() and acos() are in radians.
-- This utility converts radians to degrees.

on radiansToDegrees rads
  return rads*180/pi
end

-- And here is how to use it:

-- put radiansToDegrees(asin(.5))
-- 30.0000

on asin x
  -- Returns values between -pi/2 and pi/2
  -- Input "x"  must be between -1 and 1
  if abs(x) > 1 then
    return void
  else if x = 1 then
    return pi/2
  else if x = -1 then
    return -pi/2
  else
    return atan(float(x)/sqrt(1-x*x))
  end if
end asin

on acos x
  -- Returns values between 0 and pi
  -- Input "x" must be between -1 and 1
  if abs(x) > 1 then
    return void
  else
    return pi/2-asin(x)
  end if
end acos

---•

--Example 8-12a:  Calculating the Hyperbolic Trig Functions
-- The hyperbolic trig functions can be derived as:

on sinh x
  return 0.5 *(exp(x) - exp(-x))
end sinh

on cosh x
  return 0.5 *(exp(x) + exp(-x))
end cosh

on tanh x
  return sinh(x)/cosh(x)
end tanh



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to