Source:
Browne, Michael E. Ph. D "Schaum's Outlines: Physics for Engineering and Science" 2nd. Ed McGraw Hill: New York. 2010.
HP Prime: INERTIA
This program demonstrates the use of CHOOSE and CASE
EXPORT INERTIA( )
BEGIN
// EWS 20140624
LOCAL c,a,b,m,r;
CHOOSE(c, "Moment of Inertia",
{"Square", "Rectangle", "Cylinder", "Sphere", "Hoop"});
CASE
IF c==1 THEN INPUT({m,a});
RETURN m*a^2/6; END;
IF c==2 THEN INPUT({m,a,b});
RETURN m*(a^2+b^2)/12; END;
IF c==3 THEN INPUT({m,r});
RETURN m*r^2/2; END;
IF c==4 THEN INPUT({m,r});
RETURN 2*m*r^2/5; END;
IF c==5 THEN INPUT({m,r});
RETURN m*r^2; END;
DEFAULT KILL; END;
END;
HP 50g: INERTIA
6/23/2014
<< 1 1 1 1 1
→ c a b m r
<< "Moment of Inertia"
{ { "Square" 1 }
{ "Rectangle" 2 }
{ "Cylinder" 3 }
{ "Sphere" 4 }
{ "Hoop" 5 } }
1 CHOOSE
IF 0 == THEN KILL END
'c' STO
CASE c 1 == THEN
"m" PROMPT "a" PROMPT
SQ * 6 / END
c 2 == THEN
"m" PROMPT "a" PROMPT SQ
"b" PROMPT SQ + * 12 / END
c 3 == THEN
"m" PROMPT "r" PROMPT SQ *
2 / END
c 4 == THEN
"m" PROMPT "r" PROMPT SQ * 2 *
5 / END
c 5 == THEN
"m" PROMPT "r" PROMPT SQ *
END
END >> >>
Notes:
* I just stored a value in the variables c, a, b, m, and r, and used the right arrow ( → ) to make the variables local.
* The IF 0 == THEN KILL END sequence handles the case the user chooses CANCEL over its options.
* The consecutive PROMPT commands saved space instead of using INFORM.
* INERTIA demonstrates the CASE structure
Eddie
This blog is property of Edward Shore. 2014
A blog is that is all about mathematics and calculators, two of my passions in life.
Monday, June 23, 2014
HP Prime and HP 50g: Moments of Inertia
Subscribe to:
Post Comments (Atom)
How to Rotate Graphs
How to Rotate Graphs Introduction The key is to use parametric equations in our rotation. Using the rotation angle θ, the rotatio...

Casio fx991EX Classwiz Review Casio FX991EX The next incarnation of the fx991 line of Casio calculators is the fx991 EX. ...

TI36X Pro Review This is a review of the TI36X Pro Calculator by Texas Instruments. History Originally, this was the TI30X Pro that w...

One of the missing features of the TI82/83/84 family is the ability to convert between bases. Here are two programs in TIBasic to help...
Hello,
ReplyDeleteI wrote a Compressible Aerodynamics Calculator for my HP Prime (based on the Prof. William J Devenport online version http://www.dept.aoe.vt.edu/~devenpor/aoe3114/calc.html) and is working just fine.
Is it too difficult to port the program to the 50g? (my boss have one.... and liked the program)
No, it shouldn't. But it will may take time and patience. Good luck!
DeleteThe information on your site is good & useful.read more @ moment of inertia calculator online
ReplyDeletemoderncalculator.com
Visit Us
Moderncalculator
It is a great post for every blog and for me. Obviously I want to say that this is very important post for learn. Thanks.
ReplyDelete123 hp setup
Thanks for the informative blog...
ReplyDelete123.hp.com/ojprox476dw