title: I am trying to write a program of trapezoidal rule using maple
body: <p>I am trying to write a program of trapezoidal rule using maple, I will post my code but the problem is when I read this article, I found it's difficult to programme all the numerical examples , can anyone can help me?</p>
  
  <p>article on this URL: <a href="http://www.cs.technion.ac.il/~asidi/Sidi_Journal_Papers/P097_JCAM.sinpq.trans.pdf" rel="nofollow">http://www.cs.technion.ac.il/~asidi/Sidi_Journal_Papers/P097_JCAM.sinpq.trans.pdf</a>
  my maple's code :</p>
  
  <pre><code>with(linalg); with(LinearAlgebra); with(plots); with(MTM); 
  a := 0; b := 1; p := 20; 
  k := 1; R := vector(p); 
  f := proc (x) options operator, arrow; x*(1-x)/(1+x) end proc;
  Uex := int(f(x), x = a .. b); 
  Uex := evalf(Uex);
  for N to p do 
      h := (b-a)/N;
      U[N] := (f(a)+f(b))*(1/2);
      for j to N-1 do
          U[N] := U[N]+f(a+j*(b-a)/N)
      end do;
      U[N] := h.U[N]
  end do;
  for N to p do
      R[N] := -evalf(log(abs(Uex-U[N]))/log(10));
      print(N, evalf(Uex-U[N]))
  end do;
  plot(f); listplot(R)
  </code></pre>