Computational physics 5.4: How small a step?
Smaller steps give smaller errors but take longer. See Euler's error halve with dt, watch round-off add a step too many, and learn the test that works with no exact answer: halve dt until the answerโฆ
153 posts match
Smaller steps give smaller errors but take longer. See Euler's error halve with dt, watch round-off add a step too many, and learn the test that works with no exact answer: halve dt until the answerโฆ
Air pushes back harder the faster you fall. Take the drag force kยทvยฒ and the acceleration it gives from physics lesson 4.9, and simulate a skydiver who stops speeding up at terminal speed: a fall noโฆ
Run a simulation until something happens: the ball reaches the ground. Find how long a fall takes and how fast it lands, check it against physics without air, then add air resistance. So far theโฆ
Mixed questions from unit 5: plot, the time step, Euler's method and its error, choosing dt, air resistance and terminal speed, and a fall until it lands. New numbers on every attempt. 80 % toโฆ
With no air and no friction, kinetic plus potential energy stays the same. Work it out in a simulation, and it becomes a check that needs no exact answer. Euler's falling ball fails it: it gainsโฆ
Simulate a mass on a spring with Euler's method, using a = โ(k/m)x from physics unit 9. Its swings grow when they shouldn't, and its energy, ยฝmvยฒ + ยฝkxยฒ, climbs step after step. A mass on a springโฆ
Change the speed first, then move with the new speed. One swap turns Euler's growing spring into one whose energy only wobbles a little and stays. Its wobble shrinks with dt; for a fall it is noโฆ
Velocity Verlet moves with the speed and the acceleration, then changes the speed by the average of the accelerations at the start and the end of the step. It is exact for a falling ball, and aโฆ
Run Euler, EulerโCromer and Verlet side by side and plot their energies. Then use the energy check to find a bug, and halve dt to tell a bug from a method's error. A program that runs and draws aโฆ
RK4 tries the acceleration four times in each step and moves on with a weighted average. Use it as a given function: write the acceleration, call rk4_step, and see its error fall sixteen times whenโฆ
Mixed questions from unit 6: energy as a check, a spring with Euler's method, EulerโCromer, Verlet, telling a bug from a method's error, and RK4 as a tool. New numbers on every attempt. 80 % toโฆ
A ball kicked at an angle moves across and up at the same time. Step both directions in one loop, launch at any angle, run until it lands, and check the range against physics lesson 3.5. Physicsโฆ
Air pushes against a ball's velocity, whichever way it is going. Split the drag kvยฒ into an across part and an up part, put them in the loop, and see a tennis ball's path lose its symmetry. Physicsโฆ
With air there is no formula to check against, so check the program where there is one: turn the air off. Then put one flight in a function, try every angle, and find the one that goes furthestโฆ
The same loop as a kicked ball, with the pull of the Sun in place of gravity's steady 9.81. Choose units that keep the numbers friendly, split the pull into x and y parts, and send the Earth roundโฆ
A planet's energy, kinetic plus potential, must stay the same all the way round. Work it out in the loop, watch plain Euler's planet gain energy and spiral away, and see EulerโCromer keep it, on aโฆ
Time simulated planets: run half an orbit with the landing loop of lesson 7.1, double it, and find the year of Mars. Then simulate five orbits and check that Tยฒ against rยณ is the straight lineโฆ
Mixed questions from unit 7: x and y together, launches and landings, drag in two dimensions, the best angle, orbits in AU and years, energy, and Kepler's third law. New numbers on every attempt. 80โฆ
The first oscillator: a mass on a spring, pulled back by F = โkx. Step it with EulerโCromer, as in unit 6, draw it against the exact A cos(ฯt), and check that its energy stays put. Springsโฆ
Find an oscillator's period from the simulation itself: run until the mass stops at the far end, which takes half a period. Check it against T = 2ฯโ(m/k), and see that a bigger pull doesn't changeโฆ
Step a pendulum's angle the way you stepped a spring's position, with its angular acceleration โ(g/L) sin ฮธ, in radians. Measure its period with the stopwatch of lesson 8.2 and check it againstโฆ
Let the pendulum swing high and measure how its period grows with the angle: a few percent at 60ยฐ, almost four times 2ฯโ(L/g) near the top. A table and a graph that no formula from physics unit 9โฆ
Add a damping force against the motion, โbv, and watch the swings die away. Measure the amplitude near the end of a run, find that it shrinks by the same fraction in equal times, and see heavyโฆ
Push a damped spring again and again, Fโ cos(2ฯft), and measure how big its swings get once they settle. Do it for many driving frequencies and plot the resonance curve: a peak at the naturalโฆ