[Hans Blom, 970313]
Bill, can you please review the following program, after running it,
and tell me where I go wrong?
Greetings,
Hans
program open_loop_theodolite;
var
a, v, xa, x1, x2, t, dt: real;
c: integer;
begin
c := 0;
dt := 0.01;
x1 := 0.0;
x2 := 0.0;
v := 0.0;
t := 0.0;
repeat
if (c mod 10) = 0 then {show results}
writeln (t:12:3, v:12:3, x1:12:3, x2:12:3, xa:12:3);
v := v + a * dt; {this we agree on}
x1 := x1 + v * dt; {my formula}
x2 := x2 + v * dt + 0.5 * a * dt * dt; {your formula}
xa := 0.5 * t * t; {exact solution}
t := t + dt;
c := c + 1;
until t > 2.3
end.
···
a := 1.0; {constant acceleration}