Saturday, June 27, 2015

HP Prime: Orbital Speed and Velocity around the Sun (and update to Firmware 8151)

Firmware Update: 8151

The firmware of the HP Prime has been updated, Firmware Version 8151 (6/17/2015).  The link is here:


Planetary Orbit and Speed

The program ORBSD calculates approximately:

The distance of a planet (and dwarf planet Pluto) is from the sun and the speed of the planet, given at any given the number of Earth days (and partial Earth days) from the perihelion.  A planet is at its perihelion is when the planet is closest to the Sun in its elliptical orbit.  Earth is at its perihelion approximately January 3 to January 5 annually. 

Equations

Angle used:

θ = 360° * d/N
d = number of days from perihelion
N = number of days in a planet’s “year”, or number of days it takes for a planet to make one orbit around the Sun

Distance from Sun (in meters):

r = (a*(1 - ϵ)/(1 + ϵ cos θ ))
a = length of semi-major axis of a planet’s orbit
ϵ = the eccentricity of an orbit (ellipse)

Orbital Speed (in meters/second):

v = √( G * (M_Sun + M_planet) * (2/r – 1/a))
G = Gravitational Constant = 6.63784 * 10^-11 m^3/(s^2 *kg)
M_Sun = Mass of the Sun ≈ 1.9884 * 10^30 kg
M_planet = Mass of the planet

HP Prime ORBSD

EXPORT ORBSD()
BEGIN
// Orbital distance and
// speed around the Sun
// EWS 2015-06-25


// Initialization
LOCAL lm,pm,la,pa,le,pe;
LOCAL ld,pd;
LOCAL p,sp,θ,d,v,r;

// Planets
sp:={"Mercury","Venus","Earth",
"Mars","Jupiter","Saturn",
"Uranus","Neptune",
"Pluto (Dwarf)"};

// Mass (kg)
lm:={3.29438ᴇ23,4.85749ᴇ24,
5.9722ᴇ24,6.40397ᴇ23,1.89469ᴇ27,
5.67312ᴇ26,8.66437ᴇ25,1.02224ᴇ26,
1.31ᴇ22};

// Semi-Major Axis (m)
la:={57909829824,108209876544,
149594962176,227921734656,
778412012083,1.42673ᴇ12,
2.87097ᴇ12,4.49825ᴇ12,
5.90637ᴇ12};

// Eccentricity (ε)
le:={.206,.007,.017,.093,.048,
.056,.046,.009,.249};

// Days in a year
ld:={87.96899,224.701,365.256,
686.98,4332.58899,10759.22,
30685.4,60189,90465};

// Input
INPUT({{p,sp},d},"Data",
{"Planet:","# Days:"},
{"Planet","# Days after
Perihelion"});

pm:=lm[p];
pa:=la[p];
pe:=le[p];
pd:=ld[p];
θ:=360*d/pd;
HAngle:=1; // degree

// distance
r:=(pa*(1-pe^2))/(1+pe*COS(θ));

// orbit distance
v:=√((1.9884ᴇ30+pm)*6.63784ᴇ−11*
(2/r-1/pa));

// output
PRINT();
PRINT("Distance from the Sun:");
PRINT(STRING(r)+" m");
PRINT("Orbital Speed:");
PRINT(STRING(v)+" m/s");

RETURN {r,v};

END;

Examples

Earth at Perihelion (d = 0):
Distance ≈ 147,051,847,819 m
Orbital Speed ≈ 30,212.81231 m/s

Mars at Aphelion (at about 344 days):
Distance ≈ 249,118,178,096 m
Orbital Speed ≈ 21,921.31299 m/s

Jupiter at Perihelion (0 days):
Distance ≈ 741,048,235,503 m
Orbital Speed ≈ 13,668.77154 m/s


Planetary Data (see sources below)


Mass (kg)
Semi-Major Axis (m)
Eccentricity
Year (days)
Mercury
3.29438*10^23
57,909,829,824
.206
87.96899
Venus
4.85749*10^24
108,209,876,544
.007
224.701
Earth
5.9722*10^24
149,594,962,176
.017
365.256
Mars
6.40397*10^23
227,921,734,656
.093
686.98
Jupiter
1.89469*10^27
778,412,012,083
.048
4,332.58899
Saturn
5.67312*10^26
1.42673*10^12
.056
10,759.22
Uranus
8.66437*10^25
2.87097*10^12
.046
30,685.4
Neptune
1.02224*10^26
4.49825*10^12
.009
60,189
Pluto (dwarf planet)
1.31*10^22

5.90637*10^12
.249
90,465

** approximate values

Sources

Calvert, James B.  “Elllipse”   http://mysite.du.edu/~jcalvert/math/ellipse.htm  2002.  Retrieved June 20, 2015.

Glover, Thomas J.  “Pocket Ref” Sequoia Publishing, Inc.  Littleton, CO. 2012

“Orbital Speed”  Wikipedia  https://en.wikipedia.org/wiki/Orbital_speed  Retrieved June 20, 2015

U.S. Navy “Astronomical Constants – The Astronomical Almanac Online” http://asa.usno.navy.mil/static/files/2015/Astronomical_Constants_2015.pdf   2015. 



This blog is property of Edward Shore.  2015.



Wednesday, June 24, 2015

HP Prime and HP 50g: Quaternions

Introduction to Quaternions

Quaternions, invented by William Rowan Hamilton, have the form:

Q = a + bi + cj + dk

Quaternions are four-dimensional complex numbers, used in applications of relativity, three dimensional rotations, and crystallographic texture analysis.  This blog entry will cover some of the basic calculations used with quaternions.    

Let’s start with the i, j, and k coefficients first.  Some of the basic properties are:

i^2 = j^2 = k^2 = -1   (just like ordinary complex numbers)

Then: (the order of which the i, j, and k are multiplied is important)
i*j = k
j*k = i
k*I = j

Going in reverse:
i*k = -j
k*j = -i
j*i = -k

Furthermore, the multiplication of two quaternions are not communicative, which means for any two quaternions P and Q, P*Q ≠ Q*P. 

If your calculator can handle complex-numbered matrices, such as the HP Prime and HP 50g (I am thinking the TI-89 also qualifies), we can use that form to work with quaternions fairly easily.  For the quaternion Q = a + bi + cj + dk, the 2 x 2 matrix form is:

[[ a + b*i, c + d*i]
[ -c + d*i,  a – b*i]]

If the matrices can only handle real numbers, don’t despair, we can still use a 4 x 4 matrix representation, like this:

[[ a, b, c, d ], [-b, a, -d, c], [-c, d, a, -b], [-d, -c, b, a ]]

For this blog entry, we will concentrate on the 2 x 2 matrix format of quaternions.  The program QTM converts a quaternion to its matrix form.  I made the name short so it would be easier to type should this be used as a subroutine in future programs. 

HP Prime:

QTM(A,B,C,D)
BEGIN
RETURN [[A+B*i, C+D*i],
[-C+D*i, A-B*i]];
END;

HP 50g:
Input:  A, B, C, D on stacks 4 through 1, respectively

QTM:
<< -> A B C D
<< A B R->C  C D R->C
C NEG D R->C A B R->C CONJ
{2, 2} ->ARRY >> >>

Note that QTM only accepts numeric arguments.

Basic Calculations and Examples

For the following examples let P and Q represent the quaternions:

P = 5 + 2i + 3j + 4k
Q = 3 +6i – 2j + 8k

Using QTM to transform P and Q into matrix form yields:

P = [[ 5 + 2i, 3 + 4i ],[ -3 + 4i, 5 – 2i ]]
Q = [[ 3 + 6i, -2 + 8i],[ 2 + 8i, 3 – 6i ]]

Hamilton Multiplication:  Just multiply the two matrices.  Remember order is important since in general, P*Q ≠ Q*P

Q*P = [[ -23 + 4i, -9 + 74i ],[ 9 + 74i, -23 -4i ]]   (This represents -23 + 4i – 9j + 74k)
P*Q = [[ -23 + 68i, 7 + 30i ],[ -7 + 30i, -23 – 68i ]]  (This represents -23 + 68i + 7j + 30k)

Quaternion Norm:  norm(Q) = √(a^2 + b^2 + c^2 + d^2) = √(det(Q in matrix form))
Caution: don’t use ABS(Q)

norm(P) = √54 ≈ 7.3847
norm(Q) = √113 ≈ 10.63015

Unit Quaternion:  U_Q = Q / norm(Q) 

U_P ≈ [[ 0.68041 + 0.27217i, 0.40825 + 0.54433i ], [ -0.40825 + 0.54433i, 0.68041 – 0.27217i ]]
U_Q ≈ [[ 0.28222 + 0.56443i, -0.18814 + 0.75258i ], [ 0.18814 + 0.75258i, 0.28222 – 0.56443i ]]

Reciprocal of a Quaternion:  U^-1 = conj(Q)/norm(Q)^2.   Yes, we can use the inverse (1/x) function here.

P^-1 ≈ [[ 0.09259 – 0.03704i, -0.0556 – 0.07407i ], [ 0.0556 – 0.07407i, 0.09259 + 0.03704i ]]
Q^-1 ≈ [[ 0.02655 – 0.05310i, 0.01770 – 0.07080i ], [ -0.01770 – 0.07080i, 0.02655 + 0.05310i ]]

Conjugate using the Reciprocal and Norm:  conj(Q) = Q^-1 * norm(Q)^2

conj(P) = P^-1 * norm(P)^2 = [[ 5 – 2i, -3 – 4i ], [ 3 – 4i, 5 + 2i ]]
conj(Q) = Q^-1 * norm(Q)^2 = [[ 3 – 6i, 2 – 8i ],[ -2 – 8i, 3 + 6i ]]

That is some of the basic calculations used with quaternions. 

Sources:

Calvert, Dr. James B.  “Quaternions”  web.archive.org/web/20200214052743/http://mysite.du.edu/~jcalvert/math/quatern.htm Retrieved June 20, 2015  (updated January 23, 2024)

Weisstein, Eric W.  “Quaternion” From Mathworld – A Wolfram Web Resource http://mathworld.wolfram.com/Quaternion.html   Retrieved June 22, 2015

“Quaternion”  Wikipedia https://en.wikipedia.org/wiki/Quaternion   Retrieved June 20, 2015


Talk to you all next time!  

Eddie


Update:  (1/23/2024).    A typo has been corrected.  Also, the link to Quanternions has been moved to web.archive.org.  Thank you and gratitude to Carl Holmberg.  


This blog is property of Edward Shore.   2015.

Sunday, June 21, 2015

Roman Arch – Area and Volume Derivation

It’s good to be back. 


This is your basic Roman Arch, with the top part having an elliptical shape, which sits on two pillars.



Dimensions:
S = length of the track
H = height of the pillars
D = depth of the arch, usually small
W = gap between the pillars
R = gap between the bottom of the curve to the point where the arch curves

Surface Area:

A = Total Surface Area
AT = Area of the Elliptical ring (top)
A0 = Outer Elliptical Area
AI = Inner Elliptical Area
AP = Pillars Area (2 pillars)


Area of the Elliptical Ring (top)
AT = AO – AI
AT = π*(S + W/2)*(S + R) – π * W/2 * R
AT = π*((S + W/2)*(S + R) – W/2 * R)
AT = π*(S^2 + R*S + S*W/2)

Area of the Pillars (there are two of them):
AP = 2*H*S

Total Surface Area:
A = AT + AP
A = π*(S^2 + R*S + S*W/2) + 2*H*S
Volume of the Roman Arch:
V = D * A
V = D * (π*(S^2 + R*S + S*W/2) + 2*H*S)

Eddie


This blog is property of Edward Shore.

Saturday, June 20, 2015

Getting Back on the Saddle Again

Hi everyone!

Everyone in the family is doing well - work is still hectic but settling back down.  Today I am at Coffee Klatch in San Dimas, CA, looking over potential future blog topics such as:  

* Equations for precession 
* Qunternions
* Electronics
* Ellipses

Soon, I'll be posting programs and mathematical blogs again (I can't wait!)  

Again, thanks to everyone - much appreciated as always,

Eddie

P.S. Thank you for the love.  Love you all back!


Thursday, June 11, 2015

Break

Hi Readers,

First of all I want to tell you how much I appreciate you readers and followers.  My blog would not be the success without you.

I am going to take a break - I don't know how long it is going to be.  Work is pretty hectic right now and life is crazy.

I hope this break to be very short to be honest.  


Hope to be back very soon, with a vengeance, 

Eddie

Sunday, June 7, 2015

HP Prime: Column Stability Factor of a Wood Column

HP Prime:  Column Stability Factor of a Wood Column

Happy June!

The program CPWOOD calculates the slenderness and the column stability factor of a Douglas-Fir wood column. 

Equations:

Slenderness (unit-less):  

s = L / d
where:
L = effective length of the wood column, in inches (effective length assumed)
d = effective depth of the wood column, in inches  (effective depth assumed)

Column Stability Factor (unit-less):

cp = (1 + r)/(2 * c) -  √( (1 + r)^2/(2 * c)^2 – r/c )
where:
r = Fce / Fc
Fce = buckling stress of the wood
Fce = (kce * E)/(s^2)
kce = 0.3  (assumed)
E = elasticity modulus in psi (pounds per square inch)
Fc = allowable design value for compression parallel to the wood’s grain (in pounds per square inch)
c = factor.  (0.8 for sawn lumber, 0.85 for round poles, 0.9 for glued laminated timber)


You can select from several types of woods or enter your own Fc* and E.    

Wood
Fc (psi)
E (in millions of psi)
Douglas Fir Larch (Standard)
1150
1.6
Douglas Fir Larch (Grade 1)
1000
1.6
Douglas Fir Larch (Grade 2)
700
1.3
Douglas Fir South (Standard)
1050
1.2
Hem Fir (Standard)
975
1.3
Mountain Hemlock (Standard)
925
1.1
Sitka Spruce (Standard)
875
1.3
Western Cedar (Standard)
925
1.6
Western Woods (Standard)
800
1.1

  
Column Load Capacity:
cap = cp * Fc * w * d   (in pounds)

Program CPWOOD:

EXPORT CPWOOD()
BEGIN
// EWS 2015-06-07
LOCAL n1a,n1b,s1,c1,w;
LOCAL l,d,r,fce,cap,sl,mlc;
LOCAL na,nb,n2,s2,c2,c;

// WWPA Timber - 2008
// 1st is placeholder
// Fc (psi)
n1a:={0,1150,1000,700,1050,
975,925,875,925,800};

// E (psi)
n1b:={0,1.6ᴇ6,1.6ᴇ6,1.3ᴇ6,1.2ᴇ6,
1.3ᴇ6,1.1ᴇ6,1.3ᴇ6,1ᴇ6,1.1ᴇ6};

s1:={"Enter Your Own",
"Douglas Fir Larch (Std)",
"Douglas Fir Larch (#1)",
"Douglas Fir Larch (#2)",
"Douglas Fir South (Std)",
"Hem Fir (Std)",
"Moutain Hemlock (Std)",
"Sitka Spruce (Std)",
"Western Cedar (Std)",
"Western Woods (Std)"
};

// column type
n2:={0.8,0.85,0.9};
s2:={"sawn lumber",
"round poles",
"glued laminated timber"};

// Input
INPUT({l,d,w,{c1,s1}},
"Wood Column - Sawn Lumber",
{"Length (in):","Depth (in):",
"Width (in)","Wood:"},
{"effective (in)",
"effective (in)",
"Douglas Fir"});

// Selection
IF c1>1 THEN
na:=n1a[c1];
nb:=n1b[c1];
ELSE
INPUT({na,nb},
"Lumber Characteristics",
{"Fc* (psi):","E (million psi):"},
{"compression parallel to grain",
"elasticity modulus (in millions)"});
nb:=nb*ALOG(6);
END;

INPUT({{c2,s2}},
"Select Column Type");
c:=n2[c2];

// Calculations
// slenderness
sl:=l/d;
// Fce
fce:=(0.3*nb)/(l/d)^2;
// ratio
r:=fce/na;
// column load capacity
cap:=(1+r)/(2*c)-√((1+r)^2/
(2*c)^2-r/c);
// Maximum Load Capacity
mlc:=na*cap*w*d;

// Output
PRINT();
PRINT("Results:");
PRINT("---------");
PRINT("Slenderness = ");
PRINT(sl);
PRINT("Column Load Capacity =");
PRINT(cap);
PRINT("Column Load Capacity =");
PRINT(mlc+" lb");

RETURN {sl,cap,mlc};

END;

Example:

Data: 
Length:  72 in, Depth: 10.5 in, Width: 10.5 in, Wood:  Douglas Fir Larch (Standard), sawn lumber

Output:
Slenderness = 6.85714285714
Column Stability Factor = 0.97589228026
Column Load Capacity = 123,730.942484 lb

Sources:

Ambrose, James “Simplified Engineering for Architects and Builders” John Wiley & Sons.  9th Edition.  New York, 2000

Western Wood Products Association “Western Lumber Product Use Manual” 2008.  www.wwpa.org.  Table 5: Posts & Timbers Design Values, page 11.   URL used: http://www.engr.sjsu.edu/dmerrick/164/WWPA_PUM.pdf, retrieved June 7, 2015


Eddie


This blog is property of Edward Shore.  2015