Wave motion - Your turn#
A square membrane bounded by \(x=0\), \(x=1\), \(y=0\), \(y=1\) is fixed at the boundaries and governed by the differential equation \(c^2 \left( \dfrac{\partial^2 u}{\partial x^2} + \dfrac{\partial^2 u}{\partial y^2} \right) = \dfrac{\partial^2 u}{\partial t^2}\), \(c = 1\).
At \(t = 0\), the membrane is displaced and released from its equilibrium position such that \(u(x,y,0) = \sin(2 \pi x) \sin(2 \pi y)\), and \(\dfrac{\partial u}{\partial t} \bigg|_{x,y,t=0} = 0\).
Make a movie of the displacement of the membrane as a function of time, \(u(x,y,t) = \cos \left( 2 \sqrt{2} \pi t \right) \sin \left(2 \pi x \right) \sin \left( 2 \pi y \right)\), for \(3\) seconds.
Note
Instead of surf.set_zdata()
, which doesn’t even exist for 3D artist objects, you should use the following syntax inside your update()
function to simply redraw the whole plot:
ax.clear()
surf = plot_surface(X, Y, u)
Attention
This exercise might take longer than the demo to execute the code! But the actual animation should be rapid and finish quickly.
Also, making animations is not one of the learning goals of the course, so don’t worry about understanding all the intricacies—we just want to expose you to something cool!
# TODO: Write your solution below
Exporting your work#
When you’re ready, the easiest way to export the notebook is to File > Print
it and save it as a PDF.
Remove any excessively long, unrelated outputs first by clicking the arrow → next to the output box and then Show/hide output
.
Obviously don’t obscure any necessary output or graphs!