Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
44
Task/Euler-method/PL-I/euler-method.pli
Normal file
44
Task/Euler-method/PL-I/euler-method.pli
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
test: procedure options (main); /* 3 December 2012 */
|
||||
|
||||
declare (x, y, z) float;
|
||||
declare (T0 initial (100), Tr initial (20)) float;
|
||||
declare k float initial (0.07);
|
||||
declare t fixed binary;
|
||||
declare h fixed binary;
|
||||
|
||||
x, y, z = T0;
|
||||
/* Step size is 2 seconds */
|
||||
h = 2;
|
||||
put skip data (h);
|
||||
put skip list (' t By formula', 'By Euler');
|
||||
do t = 0 to 100 by 2;
|
||||
put skip edit (t, Tr + (T0 - Tr)/exp(k*t), x) (f(3), 2 f(17,10));
|
||||
x = x + h*f(t, x);
|
||||
end;
|
||||
|
||||
/* Step size is 5 seconds */
|
||||
h = 5;
|
||||
put skip data (h);
|
||||
put skip list (' t By formula', 'By Euler');
|
||||
do t = 0 to 100 by 5;
|
||||
put skip edit ( t, Tr + (T0 - Tr)/exp(k*t), y) (f(3), 2 f(17,10));
|
||||
y = y + h*f(t, y);
|
||||
end;
|
||||
|
||||
/* Step size is 10 seconds */
|
||||
h = 10;
|
||||
put skip data (h);
|
||||
put skip list (' t By formula', 'By Euler');
|
||||
do t = 0 to 100 by 10;
|
||||
put skip edit (t, Tr + (T0 - Tr)/exp(k*t), z) (f(3), 2 f(17,10));
|
||||
z = z + h*f(t, z);
|
||||
end;
|
||||
|
||||
f: procedure (dummy, T) returns (float);
|
||||
declare dummy fixed binary;
|
||||
declare T float;
|
||||
|
||||
return ( -k*(T - Tr) );
|
||||
end f;
|
||||
|
||||
end test;
|
||||
Loading…
Add table
Add a link
Reference in a new issue