Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
6
Task/Euler-method/Maple/euler-method-1.maple
Normal file
6
Task/Euler-method/Maple/euler-method-1.maple
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
with(Student[NumericalAnalysis]);
|
||||
k := 0.07:
|
||||
TR := 20:
|
||||
Euler(diff(T(t), t) = -k*(T(t) - TR), T(0) = 100, t = 100, numsteps = 50); # step size = 2
|
||||
Euler(diff(T(t), t) = -k*(T(t) - TR), T(0) = 100, t = 100, numsteps = 20); # step size = 5
|
||||
Euler(diff(T(t), t) = -k*(T(t) - TR), T(0) = 100, t = 100, numsteps = 10); # step size = 10
|
||||
26
Task/Euler-method/Maple/euler-method-2.maple
Normal file
26
Task/Euler-method/Maple/euler-method-2.maple
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
f := y -> (-0.07) * (y - 20):
|
||||
|
||||
EulerMethod := proc(f, start_time, end_time, y0, h) # y0: initial value #h: step size
|
||||
local cur, y, rate:
|
||||
cur := start_time;
|
||||
y := y0;
|
||||
while cur <= end_time do
|
||||
printf("%g %g\n", cur, y);
|
||||
cur := cur + h;
|
||||
rate := f(y);
|
||||
y := y + h * rate;
|
||||
end do;
|
||||
return y;
|
||||
end proc:
|
||||
|
||||
# step size = 2
|
||||
printf("Step Size = %a\n", 2);
|
||||
EulerMethod(f, 0, 100, 100, 2);
|
||||
|
||||
# step size = 5
|
||||
printf("\nStep Size = %a\n", 5);
|
||||
EulerMethod(f, 0, 100, 100, 5);
|
||||
|
||||
# step size = 10
|
||||
printf("\nStep Size = %a\n", 10);
|
||||
EulerMethod(f, 0, 100, 100, 10);
|
||||
Loading…
Add table
Add a link
Reference in a new issue