Home /
Expert Answers /
Computer Science /
in-python-the-driven-and-damped-oscillator-has-the-solution-for-the-under-damped-case-x-t-xd-pa710
(Solved): In Python
The driven and damped oscillator has the solution (for the under-damped case): x(t)=xd ...
In Python
The driven and damped oscillator has the solution (for the under-damped case): x(t)=xd?(t)+xf?(t)xd?(t) is the damped solution calculated above, and the additional term xf?(t)=Af?cos(?f?t+?f?) is due to a sinusoidal driving force of amplitude f0? and angular frequency ?f?, i.e. f(t)=f0?cos(?f?t). The parameters Af? and ?f? are given by Af??f??=(?02???f2?)2+?2?f2??f0??=tan?1(?02???f2????f??)?
Create two functions with suitable parameters - one to calculate Af? given f0?,?f?,?0?, and ? - and another to calculate ?f? given ?f?,?0?, and ?. You will need to use the function np.arctan2 for tan?1(x). Hint: check the order of arguments of np.arctan2 in the documentation very carefully. - Test your two functions: work out some values on paper that should be returned and make sure your function returns them.