Seite 1 von 1

### Integration constant acceleration

Verfasst: 16. Feb 2018 15:41
Hallo,

I have a question about the calculation of position by using Euler method in exercise 8 as shown in the attached picture.

Is it not like "y = 1/2 * (-10) * t^2"? For t = 2, y = –20? Why is it –30?

### Re: Integration constant acceleration

Verfasst: 16. Feb 2018 16:00
Hi,

Look in the script: pos_new = pos_old + v_old * deltaT. The solution actually uses the current velocity.

Perhaps you will find the explanation here https://gafferongames.com/post/integration_basics/ better.

Kind regards
Polona

### Re: Integration constant acceleration

Verfasst: 16. Feb 2018 17:02
if I use pos_new = pos_old + v_old * deltaT

pos_old = 0.5 * (-10) * 1^2 = -5 ?
v_old = (-10) * 1= -10 ?
pos_new = -5 + (-10) * 1 = -15 ?

and if I use y = 1/2 * (-10) * t^2" then y = 1/2 * (-10) * 2^2 = 20 ?

### Re: Integration constant acceleration

Verfasst: 16. Feb 2018 17:24
The formula used in the solution is pos_new = pos_old + v_new * deltaT which is an equally valid approximation (calculate the new speed first vs calculate the new position first). In the exam both variations would get you all the points. But your original question was basically "why is it not the analytical solution" which is actually part of question b. The euler integration is an approximation which does not use t, just delta t. Analytical solutions are typically not usable because many values depend on user input and whatnot and are not formulas you could do proper math on (for example acceleration - typically that is not a constant but some value which changes in unpredictable ways). For that reason we do approximations on small time steps instead of using the proper formulas.

### Re: Integration constant acceleration

Verfasst: 17. Feb 2018 08:11
ok, thanks a lot. 