(* PROJECT 8 - \(NUMERICAL\ INTEGRATION\ 

          	MIDPOINT\) + 2-POINT GAUSSIAN QUADRATURE
MILAN RAMAIYA - 2001.12  .05 *)

midp[a_, b_, 
            h_] := 
(n = ((b - a)/h) - 2; 
            Return[2  
                h (∑_(j = 0)^((n/2)))f[
                    a + 2  h*j + 
                      h]];);
gq2p[a_, 
        b_] := 
( 
        g[t_] = ((b - a)/2) f[(((b - a) t + a + b)/2)]; 
        Return[g[((Sqrt[3])/3)] + g[((-(Sqrt[3]))/3)]];)

(* I  NPUT *)
f[
            x_] = (E^((x^2))) Sin[2.  π x];
(* EXECUTION *)
Print["OUTPUT"];
Print["Midpoint Algorithm:"];
\(Print[\*""h=\!\(1\/10\):  "", 
        midp[0, 1, 
          1\/10. ]];\)
\(Print[\*""h=(1/100): "", midp[0, 1, 
          1\/100. ]];\)
Print["2-point Gausian \
Quadrature Algorithm:"];
Print[
        gq2p[0, 1]];