Question: Cant figure out why my code wont run in Maple?

Hi so ive been working on a few codes making Eulers method and RungeKutta and Taylor Series (second order) and I cant figure out why my code is giving me a weird output? I will attach my maple files here, I can post more information if you'd like. Also have no idea how to start for taylor series so any help with code on that would be appreciated!

 


 

euler1 := proc (f, a, b, alpha, h, N) local i, t, w; i := 1; t := a; w := alpha; while i <= N do w := w+h*f(t, w); t := a+i*h; i := i+1 end do; [w] end proc

proc (f, a, b, alpha, h, N) local i, t, w; i := 1; t := a; w := alpha; while i <= N do w := w+h*f(t, w); t := a+i*h; i := i+1 end do; [w] end proc

(1)

euler1(e^(5*3-y), 0, 3, .5, .2, 2)

[.5+.2*e(0, .5)^(15-y(0, .5))+.2*e(.2, .5+.2*e(0, .5)^(15-y(0, .5)))^(15-y(.2, .5+.2*e(0, .5)^(15-y(0, .5))))]

(2)

NULL

NULL

NULL


 

Download p5one.mw
 

RK4 := proc (f, a, b, alpha, h, N) local t, w, i, k1, k2, k3, k4; i := 1; t := a; w := alpha; while i <= N do k1 := h*f(t, w); k2 := h*f(t+(1/2)*h, w+(1/2)*k1); k3 := h*f(t+(1/2)*h, w+(1/2)*k2); k4 := h*f(t+h, w+k3); w := w+(1/6)*k1+(1/3)*k2+(1/3)*k3+(1/6)*k4; t := a+i*h; i := i+1 end do; [w] end proc

proc (f, a, b, alpha, h, N) local t, w, i, k1, k2, k3, k4; i := 1; t := a; w := alpha; while i <= N do k1 := h*f(t, w); k2 := h*f(t+(1/2)*h, w+(1/2)*k1); k3 := h*f(t+(1/2)*h, w+(1/2)*k2); k4 := h*f(t+h, w+k3); w := w+(1/6)*k1+(1/3)*k2+(1/3)*k3+(1/6)*k4; t := a+i*h; i := i+1 end do; [w] end proc

(1)

RK4(exp(5*3-y), 0, 3, .5, .2, 1)

[.5+0.3333333333e-1*(exp(15-y))(0, .5)+0.6666666667e-1*(exp(15-y))(.1000000000, .5+.1000000000*(exp(15-y))(0, .5))+0.6666666667e-1*(exp(15-y))(.1000000000, .5+.1000000000*(exp(15-y))(.1000000000, .5+.1000000000*(exp(15-y))(0, .5)))+0.3333333333e-1*(exp(15-y))(.2, .5+.2*(exp(15-y))(.1000000000, .5+.1000000000*(exp(15-y))(.1000000000, .5+.1000000000*(exp(15-y))(0, .5))))]

(2)

``


 

Download rk4new.mw

 

Please Wait...