## 30 Reputation

3 years, 256 days

## Please need help with my proc...

Maple

Please I need help with my proc.

> RK2skritt:=proc(FR::procedure,xo,yo,vxo,vyo,h) local x, y, vx, vy, r, kx1, kx2, kx3, kx4, ky1, ky2, ky3, ky4, l x1, l x2, l x3, l x4, ly1, ly2, ly3, ly4, tmp; r:=sqrt(xo*xo+yo*yo); tmp:=-(h*FR(r))/(r); lx1:=h*vxo; ly1:=h*vyo; kx1:=tmp*xo; ky1:=tmp*yo; lx2:=h*(vxo+0.5*kx1); ly2:=h*(vyo+0.5 ky1); r:=sqrt((xo+0.5*lx1)^(2)+(yo+0.5*ly1)^(2)); tmp:=-(h*FR(r))/(r); kx2:=tmp*(xo+0.5*lx1); ky2:=tmp*(yo+0.5*ly1); lx3:=h*(vxo+0.5*kx2); ly3:=h*(vyo+0.5*ky2); r:=sqrt((xo+0.5*lx2)^(2)+(yo+0.5*ly2)^(2)); tmp:=-(h*FR(r))/(r); kx3:=tmp*(xo+0.5*lx2); ky3:=tmp*(yo+0.5*ly2); lx4:=h*(vxo+kx3); ly4:=h*(vyo+ky3); r:=sqrt((xo+lx3)^(2)+(yo+ly3)^(2)); tmp:=-(h*FR(r))/(r); kx4:=tmp*(xo+lx3); ky4:=tmp(yo+ly3); x:=xo+(lx1+2*lx2+2*lx3+lx4)/(6); y:=yo+(ly1+2*ly2+2*ly3+ly4)/(6); vx:=vxo+(kx1+2*kx2+2*kx3+kx4)/(6); vy:=vyo+(ky1+2*ky2+2*ky3+ky4)/(6); [x,y,vx,vy]; end proc: Error, invalid local declaration Please someone help me!!!!!!!!

## How to use the add command in this scena...

Maple 16
```Lecture 4 - Problem 2
a)
> a := -2100; b := 2100; N := 8; h := (b-a)/N; C := 4491; x := [seq(h, h = -2100 .. 2100, h)]; y := proc (x) options operator, arrow; sqrt(1+((1/2)*exp(x/C)-(1/2)*exp(-x/C))^2) end proc; evalf(y(x[1])); evalf(y(x[N+1])); L := (1/3)*h*(y(x[1])+4*(y(x[2])+y(x[4])+y(x[6])+y(x[N]))+2*(y(x[3])+y(x[5])+y(x[N-1]))+y(x[N+1])); evalf(L);
-2100
2100
8
525
4491
[-2100, -1575, -1050, -525, 0, 525, 1050, 1575, 2100]
/                           2\
|    /1    /x\   1    /  x\\ |
x -> sqrt|1 + |- exp|-| - - exp|- -|| |
\    \2    \C/   2    \  C// /
1.111332350
1.111332350
(1/2)
/                               2\
|    /1    /-700\   1    /700 \\ |
175 |1 + |- exp|----| - - exp|----|| |
\    \2    \1497/   2    \1497// /

(1/2)
/                              2\
|    /1    /-175\   1    /175\\ |
+ 700 |1 + |- exp|----| - - exp|---|| |
\    \2    \499 /   2    \499// /

(1/2)
/                               2\
|    /1    /-175\   1    /175 \\ |
+ 700 |1 + |- exp|----| - - exp|----|| |
\    \2    \1497/   2    \1497// /

(1/2)
/                               2\
|    /1    /175 \   1    /-175\\ |
+ 700 |1 + |- exp|----| - - exp|----|| |
\    \2    \1497/   2    \1497// /

(1/2)
/                              2\
|    /1    /175\   1    /-175\\ |
+ 700 |1 + |- exp|---| - - exp|----|| |
\    \2    \499/   2    \499 // /

(1/2)
/                               2\
|    /1    /-350\   1    /350 \\ |
+ 350 |1 + |- exp|----| - - exp|----|| |      + 350
\    \2    \1497/   2    \1497// /

(1/2)
/                               2\
|    /1    /350 \   1    /-350\\ |
+ 350 |1 + |- exp|----| - - exp|----|| |
\    \2    \1497/   2    \1497// /

(1/2)
/                               2\
|    /1    /700 \   1    /-700\\ |
+ 175 |1 + |- exp|----| - - exp|----|| |
\    \2    \1497/   2    \1497// /
4354.742601
> L := (1/3)*h*(y(x[1])+4*add(y(i), i = y(x[2]) .. y(x[N]), 2)+2*add(y(i), i = y(x[3]) .. y(x[N-1]), 2)+y(x[N+1])); evalf(L);