Question: 3. A vector can be represented by a 1 by 3 matrix in either rectangular coordinates (x, y, z) or spherical coordinates (r, 0,

3. A vector can be represented by a 1 by 3 matrix in either rectangular coordinates (x, y, z) or spherical coordinates (r, 0, 0). The conversions among those two sets of coordinates are given by the following equations: x = r cos o cos 0, y = r cos op sin 0, z = r sin op to convert from spherical to rectangular r = x + y+z2,0 = tan 1 = tanto convert from rectangular to spherical Write a function that accepts two arguments: a 1 by 3 matrix and a number (where a 1 represents converting rectangular to spherical or a 2 that represents converting spherical to rectangular coordinates -note: display an error for any other number other than 1 or 2) then performs the conversion which is the output variable. The values of 0 and op are in degrees and atan) returns radians for the tangent inverse (tan'). This program will require if statements. (16 pts)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
