Difference between revisions of "Trigonometry Functions"
Jump to navigation
Jump to search
→Sine, Cosine, and Tangent
imported>DragoonWraith |
imported>DragoonWraith |
||
Line 36: | Line 36: | ||
'''''tan(x) = x^1/1! + x^3/3! + x^5/5! + x^7/7! + ...''''' | '''''tan(x) = x^1/1! + x^3/3! + x^5/5! + x^7/7! + ...''''' | ||
== Galsiah Version == | |||
This [[:Category:Stage Functions|function]] requires the following variables to be declared in your [[Global Script]]: | |||
float ang (the measure of the angle) | |||
float n (used internally) | |||
float t2 (used internally) | |||
float sin (sine of the angle) | |||
float cos (cosine of the angle) | |||
float tan (tangent of the angle) | |||
You may rename these if you wish, but that means changing the code to match. All of them must be floats. | |||
<pre>;script originally by Galsiah | |||
if Wiki.ang < 0 | |||
set Wiki.ang to (Wiki.ang + 360) | |||
elseif Wiki.ang >= 360 | |||
set Wiki.ang to (Wiki.ang - 360) | |||
endif | |||
set Wiki.ang to (Wiki.ang/Wiki.rad) | |||
set Wiki.n to 1 | |||
if (Wiki.ang > 4.7123) | |||
Set Wiki.ang to (Wiki.ang - 6.2832) | |||
elseif ( Wiki.ang > 1.5708 ) | |||
Set Wiki.ang to (Wiki.ang - 3.1416) | |||
Set Wiki.n to -1 | |||
endif | |||
set Wiki.t2 to (Wiki.ang * Wiki.ang) | |||
set Wiki.sin to (Wiki.ang*(1 - (Wiki.t2*(0.16605 - (0.00761*Wiki.t2))))) | |||
set Wiki.sin to (Wiki.sin*Wiki.n) | |||
set Wiki.cos to (1 - (Wiki.t2*(0.4967 - (0.3705*Wiki.t2)))) | |||
set Wiki.cos to (Wiki.cos*Wiki.n) | |||
set Wiki.tan to (Wiki.sin/Wiki.cos)</pre> | |||
== Taylor Series Variant 1 == | == Taylor Series Variant 1 == |