Difference between revisions of "Trigonometry Functions"

969 bytes added ,  07:16, 7 May 2006
adding arccos and arc tan
imported>JOG
m
imported>Dysesothymteric
(adding arccos and arc tan)
Line 194: Line 194:


More terms will increase accuracy. The larger the angle, the more terms are needed to get acceptable accuracy. As a rough guide use 3 terms for every 10° to get an accuracy of at least 1 decimal digit.
More terms will increase accuracy. The larger the angle, the more terms are needed to get acceptable accuracy. As a rough guide use 3 terms for every 10° to get an accuracy of at least 1 decimal digit.
== Arccosine ==
'''Arccos z = (PI / 2) - arcsin(z).'''
See above for method of obtaining arcsin. This may be useful when using the Law of Cosines to find the measure of an unknown angle, given three known sides.
== Arctangent ==
'''Arctan z = z - (z^3/3) + (z^5/5) - (z^7/7) +...'''
This is very similar to the Taylor Expansion method of generating Arcsine, but without the extra multipliers, and with alternating signs.
scriptname Arctan
;modified from arcsine script supplied by DragoonWraith
float z
float z3
float z5
float z7
float arctanz
Begin {appropriate blocktype}
;z can be set depending on implementation
;here it is set to the number of places discovered by the player
;(a completely bizarre thing to find the arcsine of)
  set z to GetPCMiscStat 7
  set z3 to ( z * z * z )
  set z5 to ( z3 * z * z )
  set z7 to ( z5 * z * z )
  set arcsinz to ( z - (z3/3) + (z5/5) - (z7/7) )
End
Again, more terms equals more accuracy.


= See Also =
= See Also =