Answered step by step
Verified Expert Solution
Link Copied!

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 6378.137 km, and its polar radius is 6356.752 km.
The volume of an oblate spheroid is given by the formula
V =4
3\pi r2
e rp,
and its surface area is given by the formula
A =2\pi r2
e + r2
p
sin(\gamma ) ln
cos(\gamma )
1 sin(\gamma )
!
,(1)
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 as.numeric(readline()) statements, one for re and one for
rp, and you will need to use several of Rs built-in 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
> sin(pi/2)
means that you are taking the sine of \pi /2 radians (or 90 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(1000)
means ln(1000).
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Icdt 88 2nd International Conference On Database Theory Bruges Belgium August 31 September 2 1988 Proceedings Lncs 326

Authors: Marc Gyssens ,Jan Paredaens ,Dirk Van Gucht

1st Edition

3540501711, 978-3540501718

More Books

Students also viewed these Databases questions