View Full Version : Extracting some code from Java Script


^3aFrEt^
I`m trying to get some equations from a Java code source of this page

http://www.susdesign.com/sunangle/

I want the Equation of Time "eot"

this what i could get out

[Code]
function E=EOT(UT,D,M,Y)
T = ((UT/24) + D + floor(30.6*M+0.5) + 365.25*floor(Y-1976) - 8707.5) / 36525 ;
G= 357.528 + 35999.05*T ;
%normalizing G
G=G-floor(G/360)*360;
C=( 1.915 * sin(G*pi/180)) + (0.020 * sin(2*G*pi/180)) ;
L= 280.46 + 36000.770*T + C ;
%normalizing L
L=L-floor(L/360)*360;
alpha= L - 2.466*sin(2*L*pi/180) + 0.053*sin(4*L*pi/180) ;
E= (L - C - alpha) / 15 * 60 ;
[code]

but his code vray depending on the time zone and i could find where did he substitute the time zone in the equations

and I do get diffrent result than his

his result vray from - 3.76 to - 3.96

mine always -4.097


any help ?:)

^3aFrEt^
btw this is LEGAL !

I have mailed the author of the applet and asked him about it and he pointed me to view the source of the page

I asked him if he has the original book and he said yes but he doesn`t have time now to copy the pages I need from it :)

sattia
Find attached an OpencOffice Calc spreadsheet that does the same equations. I read the source code and then compiled this spreadsheet.
Note that the dark green columns are the inputs while the light ones are the outputs.
I hope you find it usefull. I am a little bit interrested in such formulae.
Do not forget to rename the file to remove the txt extension.
Regards

^3aFrEt^
thank u very much

i never relized that spreadsheets could be used like this :)