home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
elan
/
demo
/
euler.eln
< prev
next >
Wrap
Text File
|
1987-08-18
|
1KB
|
61 lines
REAL PROC wind force (REAL CONST x, y):
300.0 * y / (300.0 * x - 100.0 * sqrt (x * x + y * y))
ENDPROC wind force;
program:
LET x scale = 34.0;
LET y scale = 10.0;
LET l = 20.0;
choose starting point;
ask stepsize;
REP
compute next ordinate;
increment abscissa;
show next point
UNTIL in haven
ENDREP.
choose starting point:
# Based on an idea of L.Klingen #
put ("This program simulates a flight with sidewind.");
line;
REAL VAR x :: 2.0, y :: 2.0.
ask stepsize:
REAL VAR step;
REP
line;
put ("Stepsize (small,negative)?");
get (step)
UNTIL - 0.5 < step AND step < 0.0
ENDREP.
compute next ordinate:
perform predictorstep;
perform correctorstep.
perform predictorstep:
REAL VAR y pred :: y + wind force (x, y) * step.
perform correctorstep:
UPTO 3
REP y pred := y + 0.5 * (wind force (x, y) + wind force (x + step, y pred)) * step
ENDREP;
y := y pred.
increment abscissa:
x INCR step.
show next point:
IF 0.0 <= x AND x < 2.0 AND 0.0 <= y AND y < 2.0
THEN
INT CONST i :: 1 + round (x scale * x), j :: 1 + round (l - y scale * y);
cursor (i, j);
put ("*")
FI.
in haven:
x <= 0.0.