Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Euler-method/ALGOL-68/euler-method.alg
Normal file
24
Task/Euler-method/ALGOL-68/euler-method.alg
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#
|
||||
Approximates y(t) in y'(t)=f(t,y) with y(a)=y0 and
|
||||
t=a..b and the step size h.
|
||||
#
|
||||
PROC euler = (PROC(REAL,REAL)REAL f, REAL y0, a, b, h)REAL: (
|
||||
REAL y := y0,
|
||||
t := a;
|
||||
WHILE t < b DO
|
||||
printf(($g(-6,3)": "g(-7,3)l$, t, y));
|
||||
y +:= h * f(t, y);
|
||||
t +:= h
|
||||
OD;
|
||||
printf($"done"l$);
|
||||
y
|
||||
);
|
||||
|
||||
# Example: Newton's cooling law #
|
||||
PROC newton cooling law = (REAL time, t)REAL: (
|
||||
-0.07 * (t - 20)
|
||||
);
|
||||
|
||||
main: (
|
||||
euler(newton cooling law, 100, 0, 100, 10)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue