Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Script Files Area and Volume of an Oblate Spheroid An oblate spheroid such as the earth is obtained by revolving an ellipse about its minor
Script Files
Area and Volume of an Oblate Spheroid
An oblate spheroid such as the earth is obtained by revolving an ellipse about its minor
axis. In everyday terms, it is the shape of a slightly compressed beach ball. The earths
equatorial radius is km and its polar radius is km
The volume of an oblate spheroid is given by the formula
V
pi r
e rp
and its surface area is given by the formula
A pi r
e r
p
singamma ln
cosgamma
singamma
where re represents the equatorial radius; rp represents the polar radius; and
gamma arccos
rp
re
Write the R script file oblate.r that prompts the user for two inputs: re and rp and
prints the volume and the surface area of the oblate spheroid determined by re and rp
This will take two of Rs asnumericreadline statements, one for re and one for
rp and you will need to use several of Rs builtin functions: sin cos log and acos.
These represent the sine cosine, natural logarithm log base e and arccosine functions,
respectively.
The inputs for all the trigonometric functions in R are in radians. So for instance, the
R command
sinpi
means that you are taking the sine of pi radians or degrees! The cos log and
acos are similar. In the formula, ln means the natural logarithm or log base e In
R use the command log So the R command
log
means ln
Error Checking
Note that re should be greater than or equal to rp If the user inputs values of re and rp
such that re rp print an error message, and stop execution of the script file. Also, note
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started