eggs1996

5 Reputation

One Badge

4 years, 344 days

MaplePrimes Activity


These are questions asked by eggs1996

I have to do a homework on the euler explicite and when I am trying to test it I get an erreor can someone help me please :)

restart;
eulerexp := proc (fin, condin, h, tmax)

local i, n, j, tab, N; N := tmax/h;

for j to 5 do

tab[1, j] := condin[1, j]

end do;

for n from 2 to N do

tab[n, 1] := tab[n-1, 1]+h;

tab[n, 2] = tab[n-1, 2]+h*fin[1](tab[n-1, 1], tab[n-1, 2], tab[n-1, 3], tab[n-1, 4], tab[n-1, 5]);

tab[n, 3] = tab[n-1, 3]+h*fin[2](tab[n-1, 1], tab[n-1, 2], tab[n-1, 3], tab[n-1, 4], tab[n-1, 5]);

tab[n, 4] = tab[n-1, 4]+h*fin[3](tab[n-1, 1], tab[n-1, 2], tab[n-1, 3], tab[n-1, 4], tab[n-1, 5]);

tab[n, 5] = tab[n-1, 5]+h*fin[4](tab[n-1, 1], tab[n-1, 2], tab[n-1, 3], tab[n-1, 4], tab[n-1, 5]);

end do;

return tab end proc;

condin := [25, 1, 2, 3, 4];
                        [25, 1, 2, 3, 4]


fin := proc (t, w, x, y, z) options operator, arrow; [2*t-4*w+5*x-6*y-z, x, z, t] end proc;
(t, w, x, y, z) -> [2 t - 4 w + 5 x - 6 y - z, x, z, t]

h := .1;
                              0.1
tmax := 20;
                               20


eulerexp(fin, condin, h, tmax);
Error, (in eulerexp) invalid subscript selector


 

Page 1 of 1