The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





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 


Messages In This Thread
Moments of Inertia - Eddie W. Shore - 06-24-2014 02:46 AM



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