CSERD


  • userhome
  • catalog
  • resources
  • help

Euler's Method Algorithm


Shodor > CSERD > Resources > Algorithms > Euler's Method Algorithm

  


Euler's Method

Euler's method is the simplest method that can be used to compute the change in a quantity over time from the rate of change of that quantity. Euler's Method can be described simply as

    New = Old + Change

In order to predict the change, we assume that however things are changing now, they will continue to change that way for a small amount of time.

For example, suppose you know the rate of change of the velocity (i.e. acceleration) of an object, and you want to compute the motion (i.e. position) of the object.

Acceleration (a) is the rate of change of velocity (v) with time:

  • a = d v/dt

  • This is solved in 2 dimensions by considering separately the components of the acceleration and velocity.

  • ax = d vx/dt
  • ay = d vy/dt
  • In Euler's method the change in the velocity is computed by assuming that instead of having continuous change we can treat time as if it flowed in "chunks", or timesteps.

  • vx = axt
  • vy = ayt
  • Each dimension is solved separately by the computer to determine the velocity at a small time later.

    Once the new velocity is known, the same thing can be done to determine position.

  • v = d x/dt

  • Breaking into coordinates:

  • vx = d x/dt
  • vy = d y/dt

  • And changing to difference equations:

  • x = vxt
  • y = vyt

  • ©1994-2024 Shodor