|
#1
[
]
|
|||
|
|||
|
JavaScript help...
I have been learning the language JavaScript for a while. I recently decided to try and make my own method to return Sine of a double as a double. I am trying to use a taylor series centered at 0, but 0.0 keeps getting returned. Could anyone help me?
Note : NumbertoPower() and FactorialSimple() are other funcions of my own creation that do what thier signiture implies. public static double SinetoDegree5(double num1) { while(num1 > Math.PI / 2) num1 = num1 - Math.PI; while(num1 < -1 * Math.PI / 2) num1 = num1 + Math.PI; int step = 1; int sign = 1; double base = 0; while(step <= 9) { base = base + (NumbertoPower(base, step) / FactorialSimple(step)); if(sign == 1) sign = -1; else sign = 1; step = step + 2; } return base; }
__________________
Working on beating WW in 6:42 (all at once!). Current best time is 6:49. |

|
#2
[
]
|
|||
|
|||
|
Re: JavaScript help...
base = base + (NumbertoPower(num1, step) / FactorialSimple(step))*sign;
num1 = num1 % Math.PI; instead of the first crap you mean JAVA right? not javascript?
__________________
i have FULLY completed and i mean fully completed Oot, Alttp, Oos, Ooa, La, Loz (1st quest), Mc, WW, MM, Aol ![]() and i almost forgot FSA although it really isn't a Zelda game pending: Loz (2nd quest) Inuyasha to Kagome: "take it [clothing] off" Favourite anime: Naruto, Bleach, InuYasha, FMA, Love Hina, Eureka 7, Ai yori Aoshi +/- ~enishi~ |

| Sponsored Links |
|
#4
[
]
|
|||
|
|||
|
Quote:
![]() I am trying to implement the first 3 terms in the seres... ![]() Am I missing something / could you elaborate
__________________
Working on beating WW in 6:42 (all at once!). Current best time is 6:49. |

| Sponsored Links |
![]() |
| Thread Tools | |
|
|