@Guoguo0605
2016-04-26T22:31:33.000000Z
字数 7699
阅读 2939
ComputationalPhysics_HW
岳绍圣2013301020033
CONTENT:
In this homework several problems involving the pendulum are considered, several methods of solving ODE including
Euler method, Euler-Cromer method, Second-order Runge-Kutta method, Centered Difference Method are discussed. Also, a general problem in form is discussed, and draw the conclusion. Both analytical and numerical solution are listed, and we finally draw the conclusion that Euler-Cromer method is the most suitable way to investigate oscillation problems and while the oscillation period is related to the amplitude.
Key Words: Simple pendulum; Anharmonic Pendulum; Euler Method; Euler-Cromer Method; Runge-Kutta Method; Centered Difference Method.
Many of problems encountered in physics involves ordinary differential eqautions for which some initial values are specified. For example, the motion of a projectile is described by second-order differential equations that involve the position as a function of time. There are many numerical methods to solve these ordinary equation, such as Euler method, Euler-Cromer method, Second-order Runge-Kutta method, Centered Difference Method and so on. All of these method are approximations of "the mean value theorem": there is a value in the interval such that the exact solution can be gotten while stopping at the first order in
All of these method are finding a proper way to approximate the slope .
Euler method uses the slope at as an approximation of the slope at , which as compensation wil cause asymmetric effect. Part of the problem with Euler method is the one-side approximation of the slope appearing in the mean value theorem. This problem can be reduced by using a more symmetric evaluation of and , namely, evaluating at while evaluating at . And this slight change yields the Euler-Cromer method. Runge-Kutta choose a more elaborate way to balance the asymmetry, for more details please see this book.
For simple harmonic motion, that is, linear, undamped, no driving.
It's easy to verify that it has the general solution:
Below is a comparison among Euler method, Euler-Cromer method and Analytical solution of angle vs time, energy vs time.
点击图片查看源代码
点击图片查看源代码
As shown above, the asymmetry of Euler method will case energy increasing, which is contradictory with energy conservation theorem. The more symmetric method Euler-Cromer method solved this contradictory more perfectly.
For simple pendulum, the period is independent of amplitude.
Since the general form for equation of motion of the anharmonic oscillator is given by:
Although with the fact that most of ODEs have no analytical solution, we should expect explicit analytical solution form for such not so complex ODE above. And as a matter of fact, it do have analytical solution.
The result[1] given by Lev Landau is:
Where is the total energy of the system, in such case:
Employ Mathematica [2]:
Condition | Period |
---|---|
Local truncation errors[3] is the error caused by one iteration. Global truncation error[4] is the error at a fixed time t, after however many steps the methods needs to take to reach that time from the initial time. The global truncation error is the cumulative effect of the local truncation errors committed in each step.
Method | Global Truncation Error | Computational Cost |
---|---|---|
Euler | 1 | |
Euler-Cromer | 1 | |
Second-order Runge-Kutta | 2 | |
Fourth-order Runge-Kutta | 4 | |
Verlet | 1 | |
Leapfrog | 2 |
: for general problems, the Euler-Cromer method can only promise , however for oscillation problems, this algorithm actually conservers energy over each complete oscillation at least .
: This method requires knowledge of and is thus not self starting.
substitue for to obtain
by definition,
where for the above eq'n
Next, apply Runge-Kutta formulas to each of the two first order equations as follows:
where
Here we use Euler-Cromer & Runge-Kutta 4 methods to sole this second order ordinary differential equation.
Up to now, we have analysed the harmonic and anharmonic oscillator analytically and numericaly, and we can draw the conslusion that the period of harmonic oscillator, that is , is independent of amplitude, as a contrast, the period of anharmonic oscillator , that is , is dependent fo amplitude, and tin detail, the period is inversely propotional to the amplitude.