Normalizing data..........any suggestions?
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller
Normalizing data..........any suggestions?
Hello all, I'm brand new to livecode and have programmed in #c among others but I'm having a difficult time trying to figure this equation out with regards to livecode.
The code was written in Zeno and is as follows:
IP:=normalize((JD2451550.1)/29.530588853)
I have scoured the Zeno programming reference but it seems to left out the definition for "normalize"
in researching the term, I've found statistical reference and waveform reference with regards to known mins and maxs but nothing seems to refer to the useage in this equation.
My question is: is there a comparable way to "normalize" an equation like this in livecode?
Thank you in advance for any ideas you might have that can shed some light on this for me.
The code was written in Zeno and is as follows:
IP:=normalize((JD2451550.1)/29.530588853)
I have scoured the Zeno programming reference but it seems to left out the definition for "normalize"
in researching the term, I've found statistical reference and waveform reference with regards to known mins and maxs but nothing seems to refer to the useage in this equation.
My question is: is there a comparable way to "normalize" an equation like this in livecode?
Thank you in advance for any ideas you might have that can shed some light on this for me.

 VIP Livecode Opensource Backer
 Posts: 6464
 Joined: Wed May 06, 2009 2:28 pm
 Location: New York, NY
Re: Normalizing data..........any suggestions?
Hi.
LC has a full complement of mathematical functions. It is simply a matter of writing a handler to do what you need. There seem to be several forms of normalization, for data, in statistics , in database manipulation, whatever.
If you will describe more completely what you need, we will find a method.
Craig Newman
LC has a full complement of mathematical functions. It is simply a matter of writing a handler to do what you need. There seem to be several forms of normalization, for data, in statistics , in database manipulation, whatever.
If you will describe more completely what you need, we will find a method.
Craig Newman
Re: Normalizing data..........any suggestions?
Thank you Craig for your response. I'm writing a moon phase calculation which determines the ecliptic latitude/longitude of the moon on any day.
here is the snippet of code which concerns the function 'normalize' where IP,AG,NP, and RP are integers
% calculate moon's age in days
IP := normalize( ( JD  2451550.1 ) / 29.530588853 )
AG := IP*29.53
% calculate moon's ecliptic latitude
NP := 2*PI*normalize( ( JD  2451565.2 ) / 27.212220817 )
LA := 5.1*sin( NP )
% calculate moon's ecliptic longitude
RP := normalize( ( JD  2451555.8 ) / 27.321582241 )
LO := 360*RP + 6.3*sin( DP ) + 1.3*sin( 2*IP  DP ) + 0.7*sin( 2*IP )
Since this isn't a series of number per se it would seem the normal process of applying normalization wouldn't be appropriate
here is the snippet of code which concerns the function 'normalize' where IP,AG,NP, and RP are integers
% calculate moon's age in days
IP := normalize( ( JD  2451550.1 ) / 29.530588853 )
AG := IP*29.53
% calculate moon's ecliptic latitude
NP := 2*PI*normalize( ( JD  2451565.2 ) / 27.212220817 )
LA := 5.1*sin( NP )
% calculate moon's ecliptic longitude
RP := normalize( ( JD  2451555.8 ) / 27.321582241 )
LO := 360*RP + 6.3*sin( DP ) + 1.3*sin( 2*IP  DP ) + 0.7*sin( 2*IP )
Since this isn't a series of number per se it would seem the normal process of applying normalization wouldn't be appropriate
Re: Normalizing data..........any suggestions?
Rage,
What does "JD" stand for? Also, do you have an example of the calculation in Zeno with the output (what IP contains after the "normalize")? That would give some more clues.
Thanks,
Walt
What does "JD" stand for? Also, do you have an example of the calculation in Zeno with the output (what IP contains after the "normalize")? That would give some more clues.
Thanks,
Walt
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
Re: Normalizing data..........any suggestions?
Normalize is a procedure defined at the bottom of the code you are using  lunarphasecalc.zen:
Code: Select all
% normalize values to range 0...1
function normalize( v : real ) : real
v := v  floor( v )
if v < 0 then
v := v + 1
end if
return v
end function
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
Re: Normalizing data..........any suggestions?
Thank you so much Walt, the answer was obvious but by concentrating so much on the problem I didn't see the answer that was right in the code........