Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in c code We wish to write a program that calculates the conversions between Cartesian and Spherical Coordinates. Spherical to Cartesian Cartesian to Spherical =
in c code
We wish to write a program that calculates the conversions between Cartesian and Spherical Coordinates. Spherical to Cartesian Cartesian to Spherical = p cos() sin(6) y=psin() sin(6) 2 = p cos(6) p= Vr+ y2 + 22 0 = tan 6 = tan (VP+6) Your code must use the following two functions: prototypes are void sphere.2.cart (double rho, double theta.deg, double phi.deg, double *x, double *y, double *2); void cart.2.sphere (double x, double y, double z, double #rho, double theta.deg, double *phi_deg); Your code must ignore nonsensical inputs; for example; those shown in the sample execution. Sample Code Execution: Red text indicates information entered by the user What coordinate system is the input? (1-Cartesian, 2-Spherical): 5 What coordinate system is the input? (1-Cartesian, 2-Spherical): -2 What coordinate system is the input? (1-Cartesian, 2-Spherical): 1 Enter the Cartesian coordinate values for x, y and z: 0 -3 4 Cartesian Values: x = 0.000000, y = -3.000000, z - 4.000000 Spherical Values: rho - 5.000000, theta (deg) - -90.000000, phi (deg) - 36.869898 Would you like to keep going (y)? P Would you like to keep going (y)? Q Would you like to keep going (y)? Y What coordinate system is the input? (1-Cartesian, 2-Spherical): 2 Enter the Spherical coordinate values for rho, theta (deg.) and phi (deg.): 10.2 -45 60.1 Cartesian Values: -6.252483, y = -6.252483, 2 - 5.084575 Spherical Values: rho - 10.200000, theta (deg) - -45.000000, phi (deg) - 60.100000 Would you like to keep going (y)? N GoodbyeStep 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