summaryrefslogtreecommitdiff
path: root/50/CH5/EX5.17/ex_5_17.sce
blob: f0e6d0b6f98a1f74d7bc11826e6fc5ff1d920e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// example 5.17
// caption: gauss-legendre method
// I= integral 2*x/(1+x^4) in the range [1,2];
// first we need ti transform the interval [1,2 ] to [-1,1], since gauss-legendre three point method is applicable in the range[-1,1],

// let t=ax+b;
// solving for a,b from the two ranges, we get a=1/2; b=3/2; x=(t+3)/2;

// hence I=integral  2*x/(1+x^4) in the range [0,1]= integral 8*(t+3)/16+(t+3)^4 in the range [-1,1];


deff('[y]=f(t)','y=8*(t+3)/(16+(t+3)^4) ');

// 1) since , from gauss legendre one point rule;
I1=2*f(0)

// 2) since , from gauss legendre two point rule;
I2=f(-1/sqrt(3))+f(1/sqrt(3))

// 3) since , from gauss legendre three point rule;
I=(1/9)*(5*f(-sqrt(3/5))+8*f(0)+5*f(sqrt(3/5))) 


// we know , exact solution is 0.5404;