> |

|

|
(1) |
> |

|

|
(2) |
> |
![DiscX := proc (N, dx) local i, xv; xv := Vector(N); for i to N do xv[i] := evalf((i-(1/2)*N-1)*dx) end do; return xv end proc:](/view.aspx?sf=233023_question/8c94ce4ab5abda166b97f396bd7cdfe3.gif)
|
> |
![Xfun := proc (f1) local i, xa1, xa2; xa1 := Vector(N); xa2 := Vector(N); for i to N do xa1[i] := evalf(subs(x = a[i], f1(x))) end do; return xa1 end proc:](/view.aspx?sf=233023_question/dc67382c0e4c82acb93c4b5d32313ad4.gif)
|
> |
![IntNum := proc (N, a, c) local i, xv1; xv1 := Vector(N); for i from 2 to N-1 do xv1[i] := evalf((1/2)*(a[i]-a[i+1])*(c[i]+c[i+1])) end do; return xv1 end proc:](/view.aspx?sf=233023_question/d293fb2a61db6a6db6ae931fa73e9f7f.gif)
|
> |
![a := DiscX(N, dx); a[1]; a[100]](/view.aspx?sf=233023_question/24ec3b1002c5ef6f02c315bfd4a40963.gif)
|

|
(3) |
> |
![c := Xfun(f1); c[1]](/view.aspx?sf=233023_question/72f4c72104d30688a21ed7ac1ded6fe0.gif)
|

|
(4) |
> |

|
![k := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})](/view.aspx?sf=233023_question/ae366e5d302e655bd88055d64c2cd501.gif)
|
(5) |
> |
![plot([seq([a[i], k[i]], i = 2 .. N)], style = line, title = typeset("Integ_of_sin(x)"), titlefont = [times, bold, 30]);](/view.aspx?sf=233023_question/cd973f73b26b609c21626f07cad7c107.gif)
|
> |

|
|
Download test.mw
Hey everyone!
I would like to plot the integral of a discrete function. For simplicity, I choose the function sin(x) between –Pi and Pi, which has as an integral -cos(x). I tried to implement that in Maple using the Trapezoidal rule, but the result is simply wrong. Any help would be much appreciated!