Metode Quadratur dan Simpson 1/3 pada Scilab

1. Metode Two-Point Gaussian (Quadratur)
-->exec quadratur.sci
-->function G = quadratur(a,b,f,n)
-->h = (b-a)/n;
-->G=0;
-->// banyaknya blok GO
-->for i = 1: 2: n
--> // menghitung tiap blok dengan fgs gauss3
--> G= G + gauss3(a+(i-1)*h, a+(i+1)*h,f);
--> end
-->endfunction
-->function L= gauss3(a,b,f)
--> L1= 5/9 * f(-sqrt(3/5)*(b-a)/2+(b+a)/2);
--> L2= 8/9 * f((b+a)/2);
--> L3= 5/9 * f(sqrt (3/5)*(b-a)/2+(b+a)/2);
--> L=(b-a)/2 * (L1+L2+L3);
-->endfunction

2. Simpson 1/3
Aturan Simpson pada dasarnya adalah melakukan hampiran terhadap integrasi numerik
->function S=simpson13(a,b,f,n)
--> h = (b-a)/n;
--> S = 0;
--> for i = 3:2 :n
--> S = S + 2 *f(a+(i-1)*h);
--> end
--> for i = 2:2 :n
--> S = S + 4 *f(a+(i-1)*h);
--> end
--> S = S + f(a)+f(b);
--> S = h/3 * S;
-->endfunction