Course 6.2Lesson 1 of 3
A travelling wave is
Try the code and the simulations beside the lesson.
In the Waves chapter you wrote a travelling wave as an equation. Here you draw it with numpy and watch it move.
A wave on a rope has a displacement at every position and every time :
The letters stand for these quantities:
numpy can work out a sine for a whole array of positions at once. np.linspace(0, 4, 9) gives nine positions from 0 m to 4 m, half a metre apart. The displacement of the whole rope is then one line:
It prints [0. 0.35 0.5 0.35 0. ]. Each number is the displacement of one point of the rope, in m. The rope rises to 0.50 m at 1.0 m, a quarter of a wavelength from the left end.
To make the wave move, subtract inside the sine. A crest is the place where . Solving for gives
The crest position grows steadily with time, at the rate . That rate is the wave speed, .
The minus sign makes the wave travel towards positive . A plus sign, , makes it travel the other way.
np.argmax(y) gives the index of the largest number in y, and x[np.argmax(y)] is the position of that crest. If the array holds several equal crests, argmax gives the first one. A slice such as y[:200] keeps only the first part of the positions, so only one crest is left in it.
The program draws a wave at three times, finds the first crest each time, and works out the speed from how far the crest moved.
np.sin(x - f * t) is not a wave of frequency f. The sine needs k = 2 * np.pi / lam and w = 2 * np.pi * f.np.sin expects radians. np.sin(30) is not 0.5.k * x - w * t travels towards positive , and k * x + w * t towards negative .w / k, not w * k.argmax finds one crest. Without a slice it returns only the first of several equal crests.A * np.sin(k * x - w * t).x[np.argmax(y)] is where the first crest is.Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
x[np.argmax(y)] give?np.sin(30) gives . Why is it not 0.5?Every lesson is open to read. Enrolling also lets you:
Log in to join the discussion.
Loading…
This lesson is free to read. Enroll free to keep your place and take the tests.