Question
Subroutine SPHERE calculates the three components of gravitational attraction at a single point due to a uniform sphere, Inputparameters: Observation point is (xp,yp,zp), and center
Subroutine SPHERE calculates the three components of gravitational attraction at a single point due to a uniform sphere,
Inputparameters: Observation point is (xp,yp,zp), and center of sphere is at
(xq,yq,zq). Radius of sphere is a and density is rho. Density in units of kg/(m**3). All distance parameters in units of km.
Output parameters: Gravitational components (gx,gy,gz) in units of mGal.
real km2m data gamma/6.67e-l1/,si2mg/l.e5/,pi/3.14159265/,km2m/l.e3/ ierror=0 rx=xp-xq
ry=yp-yq rz=zp-zq r=sqrt(rx**2+ry**2+rz**2) if(r.eq.O.)pause 'SPHERE: Bad argument detected.' r3=r**3 tmass=4.*pi*rho*(a**3)/3. gx=-gamma*tmass*rx/r3 gy=-gamma*tmass*ry/r3 gz=-gamma*tmass*rz/r3 gx=gx*si2mg*km2m gy=gy*si2mg*km2m gz=gz*si2mg*km2m return end
Subroutine B.I. Subroutine to calculate the three components of gravitational attraction due to a sphere of homogeneous density.
i need the answer of this question. (not only gfortran code but also matlab code)
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