Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!comp.vuw.ac.nz!cc-server4.massey.ac.nz!massey.ac.nz!TMoore From: TMoore@massey.ac.nz (T. Moore) Newsgroups: comp.lang.pascal Subject: Re: Trigonometric function Message-ID: <1123@massey.ac.nz> Date: 1 Nov 90 22:55:02 GMT References: <1650@marlin.NOSC.MIL> Organization: Massey University, Palmerston North, New Zealand Lines: 29 X-Reader: NETNEWS/PC Version 2.2 I would like to use the "arccos" function---but it is not standard pascal. Is there a simple way to do this using standard pascal functions such as arctan,sin, or cos? If cos(theta) = x then tan(theta) = sqrt(1-x*x)/x by simple trigonometry. Therefore arccos(x) = arctan(sqrt(1-x*x)/x) if x > 0 (arccos(0) = pi/2) I assume you want the principal value which is between 0 and pi. (If x < 0 then the principal value of arctan is between -pi/2 and 0 so you must add pi - I think: check with the manual). If x is too close to zero you can find arctan(x/sqrt(1-x*x)) and add pi/2. -- Terry Moore Department of Mathematics and Statisics, Massey University, Palmerston North, New Zealand Kroneker: "God made the natural numbers, the rest is the work of man." Zermelo: "But I can construct the natural from the empty set alone." Bystander: "Who said 'You can't get something for nothing.'?"