Question: Exercise taken from Paul L DeVries - A first course in computational physics ( 1 9 8 4 ) . Please create a . f
Exercise taken from Paul L DeVries A first course in computational physics Please create a f program for this exercise.
EXERCISE
Use the modified Euler method with a time step of to solve the "mass on a spring" problem, and present your results in a plot similar to Figure How well is the energy conserved?
It might seem that a numerical method that preserves constants of the motion is inherently "better" than one that does not. Certainly, the improved and modified Euler methods are to be preferred over the simple Euler method. But this preference is derived from improvements made in the algorithm, as verified by the computation of constants of the motion, not because the constants were guaranteed to be preserved.
It is possible to construct an algorithm that preserves constants of the motion. For example, consider the massonaspring problem. We might use the simple Euler expression to determine position,
and determine the velocity by requiring that
This will give us the magnitude of the velocity, and we could obtain its sign by requiring it to be the same as that obtained from the expression
RungeKutta Methods
This algorithm is absolutely guaranteed to conserve energy, within the computer's ability to add and subtract numbers. But how good is it otherwise?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
