Theory
Calculate the next position with an Euler step
In an Euler step, you use the current velocity to estimate the position one time step later.
The displacement in that step is velocity × time step.
Use: new position = current position + velocity × time step.
- Read position, velocity and time stepTake the current position, current velocity and time step from the problem.
- Calculate velocity × time stepWork out the intermediate step using the values from the problem.
- Add it to the positionWork out the intermediate step using the values from the problem.
A model has x = 10 m, v = 4 m/s and dt = 0,2 s. Calculate the next position.
- Read position, velocity and time stepPosition = 10 m. Velocity = 4 m/s. Time step = 0,2 s.
- Calculate velocity × time step4 × 0,2 = 0,8 m.
- Add it to the position10 + 0,8 = 10,8 m.
Calculating the next velocity with an Euler step
In the Euler method, you calculate a model forward in small time steps.
The velocity changes in one step by acceleration × time step.
Use: new velocity = current velocity + acceleration × time step.
- Read velocity, acceleration and time stepTake the current velocity, acceleration and time step from the problem.
- Calculate acceleration × time stepWork out the intermediate step using the values from the problem.
- Add to the velocityWork out the intermediate step using the values from the problem.
A model has v = 4 m/s, a = 1,5 m/s 2 and dt = 0,2 s. Calculate the next velocity.
- Read velocity, acceleration and time stepVelocity = 4 m/s. Acceleration = 1,5 m/
s 2. Time step = 0,2 s. - Calculate acceleration × time step1,5 × 0,2 = 0,3 m/s.
- Add to the velocity4 + 0,3 = 4,3 m/s.