Semi-implicit Euler method: Difference between revisions

Content deleted Content added
Added example
clarify and format
Line 3:
Given a pair of [[differential equation]]s of the form
 
:<math> {dx \over dt} = v(x,t) </math>
 
:<math> {dv \over dt} = a(x,v,t), </math>
 
where ''a'' is a given function, and initial conditions
 
:<math> (x_0,v_0), \quad</math>
Line 17:
:<math> x_{n+1} = x_n + v_{n+1} \Delta t \quad</math>
 
where <math> \Delta t </math> is the timestep and <math>a_n = a(x_n,v_n,t_n)</math> is the acceleration at the current timestep.
 
Note the difference from the Euler method: <math>x_{n+1}</math> depends on <math>v_{n+1}</math> rather than <math>v_n</math>.
Line 23:
== Example ==
 
The motion of a [[spring (device)|spring]] satisfying [[Hooke's law]] is given by
For a spring undergoing [[simple harmonic motion]] we have the following
 
:<math>F ={dx -kx\over dt} = mav(t) \quad</math>
 
:<math> {dv \Rightarrowover adt} = -{k \over m}x. \quad</math>
 
The Euler-Cromer algorithm for this equation is
Thus we have solutions
 
:<math>v_{n+1} = v_n - {k \over m}x_n\Delta t \quad</math>
 
:<math>x_{n+1} = x_n + v_{n+1} \Delta t. \quad</math>
 
== See also ===
Line 40:
== References ==
 
* {{cite book |last= Giordano
|first= Nicholas J.
|coauthors= Hisao Nakanishi
|title= Computational Physics
|edition= 2nd edition
|publisher= Benjamin Cummings
|year= 2005
|month= July
|language= English
|isbn= 0-1314-6990-8 }}
* {{cite web
 
| firstlast = MacDonald
{{cite web
| lastfirst = James
| first = MacDonald
| authorlink = http://www.physics.udel.edu/~jim
| title = The Euler-Cromer method
| publisher = [[University of Delaware]]