Post Reply 
Moments of Inertia
06-24-2014, 02:46 AM
Post: #1
Moments of Inertia
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

Code:

EXPORT INERTIA( )
BEGIN
// EWS 2014-06-24
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;
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)