HP Forums
(50g) Moment of Inertia - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (50g) Moment of Inertia (/thread-1700.html)



(50g) Moment of Inertia - Eddie W. Shore - 06-24-2014 02:48 AM

Source:

Browne, Michael E. Ph. D "Schaum's Outlines: Physics for Engineering and Science" 2nd. Ed McGraw Hill: New York. 2010.

HP 50g: INERTIA

6/23/2014

Code:

<< 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