Sunday, November 29, 2015
HP Prime: Approximate Length of Daylight
Friday, January 16, 2015
fx-5800p: Large Factorials, Length of Daylight, & Moments/Skewness
fx-5800p: Large Factorials, Length of Daylight, & Moments/Skewness
Large Factorials
This allows the user to calculate n! for any positive n, even n > 69.
Program BIGFACT
"N"?→N
Σ(log(K),K,1,N) → S
"N = "
10^(Frac(S)) ◢
"* 10^( )"
Int(S)
Examples:
36! ≈ 3.719933268 * 10^ 41
134! ≈ 1.992942746 * 10^ 228
Length of Daylight
D = days after March 21. A 365 day year is assumed.
Program DAYLIGHT
"DAYS AFTER"
"MARCH 21"? → D
Deg
23.45 * sin(D*.9856) → T
"LATITUDE"
"D ● M ● S ●"? → L // for ● press [ ° ' " ]
cos⁻¹ (-tan(L) * tan(T) ) → A
2 * A / 15 → H
"HOURS="
H
Example:
D = 302 (January 17)
L = 40° N (+40°)
Result: H = 9.525548719 hours
D = 302 (January 17)
L = 40° S (-40°)
Result H = 14.47445128
Moments/Skewness
Source: HP 33 Math Pak, 1979
Formulas:
1st Moment: A = Σx ÷ n
2nd Moment: B = Σ(x^2) ÷ n - A^2
3rd Moment: C = (Σ(x^3) - 3 * A * Σ(x^2)) ÷ n + 2 * A^3
Coefficient of Skewness: D = C / B^1.5
Program MOMENTS
0 → N // Initialization
0 → U
0 → V
0 → W
Lbl 0 // Main Loop
N + 1 → N
U + X → U
V + X^2 → V
W + X^(3) → W
"NO. OF PTS."
N ◢
"ANOTHER PT.?" // are you done?
"0=NO 1=YES"
? → Y
Y ≠ 0 ⇒ Goto 0
U ÷ N → A // analysis
V ÷ N - A^2 → B
(W - 3*A*V) ÷ N + 2 * A^(3) → C
C ÷ B^(1.5) → D
"1ST MOMENT"
A ◢
"2ND MOMENT"
B ◢
"3RD MOMENT"
C ◢
"SKEWNESS"
D
Example:
Data: 1.5, 2.8, 2.9, 3.6, 4.7
Results:
1st Moment = 3.1
2nd Moment = 1.1
3rd Moment = 0.018
4th Moment = 0.0156021151
See you all next time - have a great weekend! Go have some fun!
This blog is property of Edward Shore. 2015
Sunday, May 19, 2013
HP 35S: Approximate Length of Sunlight During a Day
HP 35S: Length of Sunlight During a Day
Source: Total Daily Amount of Solar Radiation - HP 67/97 Energy Conservation Pac, December 1978, Author: Hewlett Packard
(This is a slight variation instead of a direct port)
Input
You are prompted for D and L where:
D = the number of days from March 21, a 365 day year is assumed
L = latitude (North as positive, South as negative), entered as D.MMSS (degrees-minutes-seconds) format
Output
Approximate number of hours of sunlight, in hours, minutes, seconds
Examples
Los Angeles, April 17: latitude of 34°03' N, 27 days after March 21
D = 27, L = 34.03, answer is approximately 12.573501 (12 hours, 57 minutes, 35.01 seconds)
Rome, September 1: latitude 41°51' N, 164 days after March 21
D = 164, L = 41.52, answer is approximately 12.532269 (12 hours, 53 minutes, 22.69 seconds)
Sydney, June 21: latitude 33°51'31" S, 92 days after March 21
D = 92, L = -33.5131, answer is approximately 9.443922 (9 hours, 44 minutes, 39.22 seconds)
Formulas
This version uses the estimate of sun declination:
D = 23.45 sin(d * 0.9856°)
Since 360/365.25 ≈ 0.985626283368
θ = acos(-tan L × tan D)
L = 24 * θ in radians ÷ π
Program
S001 LBL S
S002 DEG
S003 INPUT D
S004 0.9856
S005 ×
S006 SIN
S007 23.45
S008 ×
S009 INPUT L
S010 HMS→
S011 TAN
S012 x<>y
S013 TAN
S014 ×
S015 +/-
S016 ACOS
S017 ->RAD
S018 24
S019 ×
S020 π
S021 ÷
S022 ->HMS
S023 RTN
This blog is property of Edward Shore. 2013
Python – Earth’s Radius and Gravity in US Units
Python – Earth’s Radius and Gravity in US Units Introduction The following script, gravus2.py, estimates the Earth’s gravity i...