BACKGROUND / MOTIVATION:
Complex numbers can be an important tool in an electrical engineer's toolbox because they can help us describe / work with sinusoidal signals.
Sinusoidal signals can be found all over the place in day-to-day life (in music, light, communication systems, power systems, etc.):
When working with complex numbers, sometimes it's easier to work with the "rectangular/Cartesian form" (z = x + j*y) and sometimes it's easier to work with the "polar form" (r ∠ θ).
An analogy:
PROBLEM DESCRIPTION
Write a function which converts between the rectangular form and the polar form.
You can view a comparison of the two forms here: https://www.khanacademy.org/science/electrical-engineering/ee-circuit-analysis-topic/ee-ac-analysis/v/ee-complex-numbers
The variable "form" will be used to determine whether the function converts from rectangular to polar or from polar to rectangular.
The function takes the following inputs:
The function will output the variable "output" in the form of a column vector [output1;output2] where:
The test suite will round the components of your output vector to 4 decimal places.
FEEDBACK
Please feel free to leave feedback on this problem in the comments! :)
14841 Solvers
1208 Solvers
Calculate compression ratio of engine
57 Solvers
87 Solvers
220 Solvers
Problem Tags