Calendar Awards Members List FAQ
Notices

Reply
$ LinkBack Thread Tools
 
  #1   [ ]
Old 03-10-2007, 02:22 PM
Goron
Send a message via AIM to LinkTetra
Join Date: Mar 2007
Location: A van down by the river.
View Posts: 277
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.
Reply With Quote
  #2   [ ]
Old 03-12-2007, 09:04 PM
Zora Warrior
Join Date: Aug 2005
Location: in my evil lair
View Posts: 638
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~
Reply With Quote
Sponsored Links
  #3   [ ]
Old 03-12-2007, 09:34 PM
♥ ♥
Send a message via AIM to Nucco Send a message via MSN to Nucco
Join Date: Mar 2005
Location: Between here and there...
View Posts: 1,371
Re: JavaScript help...

This code looks similar to calculator code...

interesting.

Does Java run on linear based commands or different section type deals?
__________________
Reply With Quote
  #4   [ ]
Old 03-12-2007, 10:13 PM
Goron
Send a message via AIM to LinkTetra
Join Date: Mar 2007
Location: A van down by the river.
View Posts: 277
Question

Quote:
Originally Posted by dmitric300 View Post
base = base + (NumbertoPower(num1, step) / FactorialSimple(step))*sign;

num1 = num1 % Math.PI; instead of the first crap

you mean JAVA right? not javascript?
The Taylor series for Sine is is...



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.
Reply With Quote
Sponsored Links
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -5. The time now is 11:11 PM.

Contact Us - Zelda Universe - Archive - Privacy Statement - Top