## Integration constant acceleration

Forever
Neuling Beiträge: 7
Registriert: 18. Jun 2017 20:02

### Integration constant acceleration

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?
Dateianhänge QQ20180216-152522@2x.png (53.91 KiB) 6577 mal betrachtet
Zuletzt geändert von Forever am 16. Feb 2018 17:03, insgesamt 1-mal geändert.

Polona
Windoof-User Beiträge: 40
Registriert: 10. Okt 2010 10:45

### Re: Integration constant acceleration

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

Forever
Neuling Beiträge: 7
Registriert: 18. Jun 2017 20:02

### Re: Integration constant acceleration

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 ?

RobDangerous
Computerversteher Beiträge: 363
Registriert: 14. Okt 2014 17:05

### Re: Integration constant acceleration

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.

Forever
Neuling Beiträge: 7
Registriert: 18. Jun 2017 20:02

### Re: Integration constant acceleration

ok, thanks a lot. 