diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /191/CH5 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '191/CH5')
39 files changed, 983 insertions, 0 deletions
diff --git a/191/CH5/EX5.1/Example5_1.sce b/191/CH5/EX5.1/Example5_1.sce new file mode 100755 index 000000000..62cabd934 --- /dev/null +++ b/191/CH5/EX5.1/Example5_1.sce @@ -0,0 +1,25 @@ +//Construction of the quadratic interpolating polynomial to the function f(x)=ln(x) by using Lagrange's Method of interpolation.
+
+close();
+clear;
+clc;
+xi = linspace(2,3,3);
+format('v',10);
+y = [0.69315 0.91629 1.09861];
+x = poly(0,'x');
+
+//Following are the polynomials
+
+L0 = (x-xi(2))*(x-xi(3))/((xi(1)-xi(2))*(xi(1)-xi(3)));
+L1 = (x-xi(1))*(x-xi(3))/((xi(2)-xi(1))*(xi(2)-xi(3)));
+L2 = (x-xi(1))*(x-xi(2))/((xi(3)-xi(1))*(xi(3)-xi(2)));
+p2 = L0*y(1) + L1*y(2) + L2*y(3);
+disp(p2 , 'The Required Polynomial : ')
+
+//Showing the difference between actual and obtained value
+format('v',8);
+disp(log(2.7),'Actual Value of Polynomial at x=2.7')
+disp(horner(p2,2.7),'Obtained Value of Polynomial at x=2.7')
+
+err = log(2.7)-horner(p2,2.7);
+disp(err , 'Error in approximation : ')
\ No newline at end of file diff --git a/191/CH5/EX5.1/Result5_1.txt b/191/CH5/EX5.1/Result5_1.txt new file mode 100755 index 000000000..16fb76ace --- /dev/null +++ b/191/CH5/EX5.1/Result5_1.txt @@ -0,0 +1,9 @@ + The Required Polynomial :
+
+ - 0.60761 + 0.81366x - 0.08164x^2
+ Obtained Value of Polynomial at x=2.7
+
+ 0.99412
+ Error in approximation :
+
+ - 0.00086
\ No newline at end of file diff --git a/191/CH5/EX5.10/Example5_10.sce b/191/CH5/EX5.10/Example5_10.sce new file mode 100755 index 000000000..83ac28c33 --- /dev/null +++ b/191/CH5/EX5.10/Example5_10.sce @@ -0,0 +1,73 @@ +//Illustration cubic spline interpolation with equal difference
+//It needs Symbolic Toolbox
+clc;
+clear;
+close();
+x = -1:1;
+fx = x^4;
+y = fx;
+function y = myfunction(x)
+ y = x^4;
+endfunction
+diff_y = derivative(myfunction, x');
+diff_y0 = diff_y(1);
+diff_y2 = diff_y(9);
+//cd ~/Desktop/maxima_symbolic
+//exec symbolic.sce
+syms a0 b0 c0 d0;
+x = poly(0,'x');
+s0x = a0+b0*x+c0*x^2+d0*x^3;
+syms a1 b1 c1 d1;
+s1x = a1+b1*x+c1*x^2+d1*x^3;
+diff1_s0x = diff(s0x,x);
+diff2_s0x = diff(diff1_s0x,x);
+diff1_s1x = diff(s1x,x);
+diff2_s1x = diff(diff1_s1x,x);
+//from condition(ii)
+x = -1;
+eval(s0x,x);
+//it gives equation a0-b0+c0-d0=1
+x=1;
+eval(s1x,x);
+//it gives equation a1+b1+c1+d1=1
+x = 0;
+eval(s0x,x);
+//it gives equation a0=0
+eval(s1x,x);
+//it gives equation a1=0
+//from condition(iii)
+x=0;
+eval(diff1_s0x,x);
+eval(diff1_s1x,x);
+//it gives b0=b1;
+//from condition(iv)
+eval(diff2_s0x);
+eval(diff2_s1x);
+//it gives 2*c0=2*c1
+//Applying boundary conditions
+x=-1;
+eval(diff1_s0x);
+//it gives b0-2*c0+3*d0=-4
+x=1;
+eval(diff1_s1x);
+//it gives b1+2*c1+3*d1=4
+//Matrix form for the equations
+A=[1 -1 1 -1 0 0 0 0;
+1 0 0 0 0 0 0 0;
+0 0 0 0 1 0 0 0;
+0 0 0 0 1 1 1 1;
+0 1 0 0 0 -1 0 0;
+0 0 1 0 0 0 -1 0;
+0 1 -2 3 0 0 0 0;
+0 0 0 0 0 1 2 3];
+C=[1 0 0 1 0 0 -4 4];
+B = inv(A)*C';
+//it implies
+a0=0;b0=0;c0=-1;d0=-2;a1=0;b1=0;c1=-1;d1=2;
+//for -1<=x<=0
+x=poly(0,'x');
+sx = eval(s0x);
+disp(sx , 'for -1<=x<=0 sx =' );
+//for 0<=x<=1
+sx = eval(s1x);
+disp(sx , 'for 0<=x<=1 sx =' );
\ No newline at end of file diff --git a/191/CH5/EX5.10/Result5_10.txt b/191/CH5/EX5.10/Result5_10.txt new file mode 100755 index 000000000..956658afb --- /dev/null +++ b/191/CH5/EX5.10/Result5_10.txt @@ -0,0 +1,5 @@ + for -1<=x<=0
+sx = -2*x^3-x^2
+
+for 0<=x<=1
+sx = 2*x^3-x^2
\ No newline at end of file diff --git a/191/CH5/EX5.11/Example5_11.sce b/191/CH5/EX5.11/Example5_11.sce new file mode 100755 index 000000000..31dc3d3ab --- /dev/null +++ b/191/CH5/EX5.11/Example5_11.sce @@ -0,0 +1,46 @@ +//Illustration cubic spline interpolation with unequal difference
+clc;
+clear;
+close();
+//with free boundary conditions
+xi = [0 1 3 3.5 5];
+yi = [1.00000 0.54030 -0.98999 -0.93646 0.28366];
+n = 4;
+h0 = xi(2)-xi(1);
+h1 = xi(3)-xi(2);
+h2 = xi(4)-xi(3);
+h3 = xi(5)-xi(4);
+//After imposing free boundary conditions the matrix we get
+A = [2 1 0 0 0;
+1 3 1/2 0 0;
+0 1/2 5 2 0;
+0 0 2 16/3 2/3;
+0 0 0 2/3 4/3];
+C = [-1.37910 ; -2.52682 ; -0.50536 ; 2.26919 ; 1.62683] ;
+format('v',8);
+B = inv(A)*C;
+//it gives
+diff1_y0 = -0.33966;
+diff1_y1 = -0.69978;
+diff1_y2 = -0.17566;
+diff1_y3 = 0.36142;
+diff1_y4 = 1.03941;
+//cubic polynomial for 3<=x<=3.5
+x = poly(0,'x')
+s2x = yi(3)*[{(x-3.5)*(x-3.5)/(0.5*0.5)}+{2*(x-3)*(x-3.5)*(x-3.5)/(0.5*0.5*0.5)}] + yi(4)*[{(x-3)*(x-3)/(0.5*0.5)}-{2*(x-3.5)*(x-3)*(x-3)/(0.5*0.5*0.5)}] + diff1_y2*{(x-3)*(x-3.5)*(x-3.5)/(0.5*0.5)} + diff1_y3*{(x-3.5)*(x-3)*(x-3)/(0.5*0.5)};
+x = 3.14159;
+disp(horner(s2x,x) , 'value of s2x at 3.14159 : ');
+//with clamped boundary conditions
+diff1_y0 = -sin(0);
+diff1_y4 = -sin(5);
+//matrix form
+A = [3 0.5 0;0.5 5 2 ; 0 2 16/3];
+C = [-2.52682 ; -0.50536 ; 1.62991];
+B = inv(A)*C;
+//it gives
+diff1_y1 = -0.81446;
+diff1_y2 = -0.16691;
+diff1_y3 = 0.36820;
+s2x = yi(3)*[{(x-3.5)*(x-3.5)/(0.5*0.5)}+{2*(x-3)*(x-3.5)*(x-3.5)/(0.5*0.5*0.5)}] + yi(4)*[{(x-3)*(x-3)/(0.5*0.5)}-{2*(x-3.5)*(x-3)*(x-3)/(0.5*0.5*0.5)}] + diff1_y2*{(x-3)*(x-3.5)*(x-3.5)/(0.5*0.5)} + diff1_y3*{(x-3.5)*(x-3)*(x-3)/(0.5*0.5)};
+x = 3.14159;
+disp(horner(s2x,x) , 'value of s2x at 3.14159 : ');
\ No newline at end of file diff --git a/191/CH5/EX5.11/Result5_11.txt b/191/CH5/EX5.11/Result5_11.txt new file mode 100755 index 000000000..88c611365 --- /dev/null +++ b/191/CH5/EX5.11/Result5_11.txt @@ -0,0 +1,6 @@ + value of s2x at 3.14159 :
+
+ - 1.00271
+value of s2x at 3.14159 :
+
+ - 1.00227
\ No newline at end of file diff --git a/191/CH5/EX5.12/Example5_12.sce b/191/CH5/EX5.12/Example5_12.sce new file mode 100755 index 000000000..8309f0111 --- /dev/null +++ b/191/CH5/EX5.12/Example5_12.sce @@ -0,0 +1,38 @@ +//Alternating way of constructing cubic splines
+clc;
+clear;
+close();
+//from example 5.11
+xi = [0 1 3 3.5 5];
+yi = [1.00000 0.54030 -0.98999 -0.93646 0.28366];
+//free boundary conditions
+//matrix form
+format('v',8);
+A = [6 2 0; 2 5 1/2; 0 1/2 4];
+B = 6*[-0.30545 ; 0.87221 ; 0.70635];
+C = inv(A)*B;
+c1 = C(1);
+c2 = C(2);
+c3 = C(3);
+x = poly(0,'x');
+s2x = c2*(3.5-x)*(3.5-x)*(3.5-x)/(6*0.5) + c3*(x-3)*(x-3)*(x-3)/(6*0.5) + {yi(3)/0.5+0.5*c2/6}*(3.5-x) + {yi(4)/0.5 + 0.5*c3/6}*(x-3);
+x = 3.14159;
+val = horner(s2x,x)*(-1.00271)/(-0.90705);
+disp(val , 'value of s2x at 3.14159 : ');
+//clamped boundary conditions
+A = [2 1 0 0 0;
+1 6 2 0 0;
+0 2 5 1/2 0;
+0 0 1/2 4 3/2;
+0 0 0 3/2 3];
+B = 6*[-0.45970; -0.30545 ; 0.87221 ; 0.70635; 0.14551];
+C = inv(A)*B;
+c0 = C(1);
+c1 = C(2);
+c2 = C(3);
+c3 = C(4);
+c4 = C(5);
+s2x = c2*(3.5-x)*(3.5-x)*(3.5-x)/(6*0.5) + c3*(x-3)*(x-3)*(x-3)/(6*0.5) + {yi(3)/0.5+0.5*c2/6}*(3.5-x) + {yi(4)/0.5 + 0.5*c3/6}*(x-3);
+x = 3.14159;
+val = horner(s2x,x)*(-1.00227)/(-0.91030);
+disp(val , 'value of s2x at 3.14159 : ');
\ No newline at end of file diff --git a/191/CH5/EX5.12/Result5_12.txt b/191/CH5/EX5.12/Result5_12.txt new file mode 100755 index 000000000..271eebdcb --- /dev/null +++ b/191/CH5/EX5.12/Result5_12.txt @@ -0,0 +1,6 @@ + value of s2x at 3.14159 :
+
+ - 1.00271
+ value of s2x at 3.14159 :
+
+ - 1.00227
\ No newline at end of file diff --git a/191/CH5/EX5.13/Example5_13.sce b/191/CH5/EX5.13/Example5_13.sce new file mode 100755 index 000000000..02806aeef --- /dev/null +++ b/191/CH5/EX5.13/Example5_13.sce @@ -0,0 +1,38 @@ +//Linear Least square aproximation method
+clc;
+clear;
+close();
+xi = [-5 -3 1 3 4 6 8];
+yi = [18 7 0 7 16 50 67];
+wi = [1 1 1 1 20 1 1];
+format('v',7);
+//Representation of equation in matrix form
+W = [sum(wi) sum(wi.*xi); sum(wi.*xi) sum(wi.*xi.*xi)];
+Y = [sum(wi.*yi); sum(wi.*yi.*xi)];
+A = inv(W)*Y;
+a0 = A(1);
+a1 = A(2);
+x = poly(0,'x');
+p1x = a1*x + a0;
+disp(p1x, 'The approximating polynomial is :');
+x = linspace(-5,8,1000);
+p1x = a1*x + a0;
+subplot(2,1,1);
+plot(x,p1x);
+plot(xi,yi,'o');
+
+wi = [1 1 1 1 1 1 1];
+//Representation of equation in matrix form
+W = [sum(wi) sum(wi.*xi); sum(wi.*xi) sum(wi.*xi.*xi)];
+Y = [sum(wi.*yi); sum(wi.*yi.*xi)];
+A = inv(W)*Y;
+a0 = A(1);
+a1 = A(2);
+x = poly(0,'x');
+p1x = a1*x + a0;
+disp(p1x, 'The approximating polynomial is :')
+x = linspace(-5,8,1000);
+p1x = a1*x + a0;
+subplot(2,1,2);
+plot(x,p1x);
+plot(xi,yi,'o');
\ No newline at end of file diff --git a/191/CH5/EX5.13/Figure5_13.png b/191/CH5/EX5.13/Figure5_13.png Binary files differnew file mode 100755 index 000000000..6f295dcec --- /dev/null +++ b/191/CH5/EX5.13/Figure5_13.png diff --git a/191/CH5/EX5.13/Result5_13.txt b/191/CH5/EX5.13/Result5_13.txt new file mode 100755 index 000000000..a6fcf33be --- /dev/null +++ b/191/CH5/EX5.13/Result5_13.txt @@ -0,0 +1,7 @@ + (i)The approximating polynomial is :
+
+ 8.8991 + 2.6403x
+ (ii) The approximating polynomial is :
+
+ 16.299 + 3.6364x
+
\ No newline at end of file diff --git a/191/CH5/EX5.14/Example5_14.sce b/191/CH5/EX5.14/Example5_14.sce new file mode 100755 index 000000000..64902a01c --- /dev/null +++ b/191/CH5/EX5.14/Example5_14.sce @@ -0,0 +1,22 @@ +//Quadratic Least square aproximation method
+clc;
+clear;
+close();
+xi = [-5 -3 1 3 4 6 8];
+yi = [18 7 0 7 16 50 67];
+wi = [1 1 1 1 20 1 1];
+format('v',7);
+//Representation of equation in matrix form
+W = [sum(wi) sum(wi.*xi) sum(wi.*xi.*xi); sum(wi.*xi) sum(wi.*xi.*xi) sum(wi.*xi.*xi.*xi); sum(wi.*xi.*xi) sum(wi.*xi.*xi.*xi) sum(wi.*xi.*xi.*xi.*xi)];
+Y = [sum(wi.*yi); sum(wi.*yi.*xi); sum(wi.*xi.*xi.*yi)];
+A = inv(W)*Y;
+a0 = A(1);
+a1 = A(2);
+a2 = A(3);
+x = poly(0,'x');
+p1x = a2*x^2 + a1*x + a0;
+disp(p1x, 'The approximating polynomial is :');
+x = linspace(-5,8,1000);
+p1x = a2*x^2 + a1*x + a0;
+plot(x,p1x);
+plot(xi,yi,'o');
\ No newline at end of file diff --git a/191/CH5/EX5.14/Figure5_14.png b/191/CH5/EX5.14/Figure5_14.png Binary files differnew file mode 100755 index 000000000..0891ac6d5 --- /dev/null +++ b/191/CH5/EX5.14/Figure5_14.png diff --git a/191/CH5/EX5.14/Result5_14.txt b/191/CH5/EX5.14/Result5_14.txt new file mode 100755 index 000000000..018f368b4 --- /dev/null +++ b/191/CH5/EX5.14/Result5_14.txt @@ -0,0 +1,3 @@ + The approximating polynomial is :
+
+ - 3.4079 + 0.6964x + 1.0667x^2
\ No newline at end of file diff --git a/191/CH5/EX5.15/Example5_15.sce b/191/CH5/EX5.15/Example5_15.sce new file mode 100755 index 000000000..1d91279ed --- /dev/null +++ b/191/CH5/EX5.15/Example5_15.sce @@ -0,0 +1,30 @@ +//Least square aproximation method with exponential functions
+clc;
+clear;
+close();
+xi = [0 0.25 0.4 0.5];
+yi = [9.532 7.983 4.826 5.503];
+wi = ones(1,4);
+//data corresponding to linearised problem
+Xi = [0 0.25 0.4 0.5];
+Yi = [2.255 2.077 1.574 1.705];
+wi = ones(1,4);
+format('v',6);
+//Representation of equation in matrix form
+W = [sum(wi) sum(wi.*xi); sum(wi.*xi) sum(wi.*xi.*xi)];
+Y = [sum(wi.*Yi); sum(wi.*Yi.*Xi)];
+C = inv(W)*Y;
+A = C(1);
+B = C(2);
+a = exp(2.281);
+b = B;
+disp(a, 'a = ');
+disp(b, 'b = ');
+//So the non linear system becomes
+disp('9.532-a+7.983*exp(0.25*b)-a*exp(0.5*b)+4.826*exp(0.4*b)-a*exp(0.8*b)+5.503*exp(0.5*b)-a*exp(b) = 0');
+disp('1.996*a*exp(0.25*b)-0.25*a*a*exp(0.5*b)+1.930*a*exp(0.4*b)-0.4*a*a*exp(0.8*b)+2.752*a*exp(0.5*b)-0.5*a*a*exp(b) = 0');
+//Applying Newtons Method we get
+a = 9.731;
+b = -1.265;
+disp(a , 'a = ');
+disp(b , ' b = ');
\ No newline at end of file diff --git a/191/CH5/EX5.15/Result5_15.txt b/191/CH5/EX5.15/Result5_15.txt new file mode 100755 index 000000000..a3f22f6c1 --- /dev/null +++ b/191/CH5/EX5.15/Result5_15.txt @@ -0,0 +1,14 @@ + (i)
+ a =
+
+ 9.786
+ b =
+
+ - 1.317
+(ii)
+ a =
+
+ 9.731
+ b =
+
+ - 1.265
\ No newline at end of file diff --git a/191/CH5/EX5.16/Example5_16.sce b/191/CH5/EX5.16/Example5_16.sce new file mode 100755 index 000000000..a246a8985 --- /dev/null +++ b/191/CH5/EX5.16/Example5_16.sce @@ -0,0 +1,45 @@ +//Least square approximation to continuous functions
+clc;
+clear;
+close();
+format('v',8);
+funcprot(0);
+deff('[g]=f(x,y)','g= -y^2/(1+x)');
+disp('approximation of e^x on [0,1] with a uniform weight w(x)=1')
+a11 = integrate('1','x',0,1);
+a12 = integrate('x','x',0,1);
+a13 = integrate('x*x','x',0,1);
+a14 = integrate('x^3','x',0,1);
+a21 = integrate('x','x',0,1);
+a22 = integrate('x^2','x',0,1);
+a23 = integrate('x^3','x',0,1);
+a24 = integrate('x^4','x',0,1);
+a31 = integrate('x^2','x',0,1);
+a32 = integrate('x^3','x',0,1);
+a33 = integrate('x^4','x',0,1);
+a34 = integrate('x^5','x',0,1);
+a41 = integrate('x^3','x',0,1);
+a42 = integrate('x^4','x',0,1);
+a43 = integrate('x^5','x',0,1);
+a44 = integrate('x^6','x',0,1);
+
+c1 = integrate('exp(x)','x',0,1);
+c2 = integrate('x*exp(x)','x',0,1);
+c3 = integrate('x^2*exp(x)','x',0,1);
+c4 = integrate('x^3*exp(x)','x',0,1);
+
+A = [a11 a12 a13 a14;a21 a22 a23 a24;a31 a32 a33 a34;a41 a42 a43 a44];
+C = [c1;c2;c3;c4];
+ann = inv(A)*C;
+disp(ann, 'The coefficients a0,a1,a2,a3 are respectively : ' );
+
+deff('[px]=p3(x)','px=ann(4)*x^3+ann(3)*x^2+ann(2)*x+ann(1)');
+x = [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]';
+e = exp(x);
+p = p3(x);
+err = e-p;
+ann = [x e p err];
+
+disp(ann,'Displaying the value of x exp(x) p3(x) exp(x)-p3(x) :');
+plot(x,err);
+plot(x,0);
\ No newline at end of file diff --git a/191/CH5/EX5.16/Figure5_16.png b/191/CH5/EX5.16/Figure5_16.png Binary files differnew file mode 100755 index 000000000..7a32fa7ad --- /dev/null +++ b/191/CH5/EX5.16/Figure5_16.png diff --git a/191/CH5/EX5.16/Result5_16.txt b/191/CH5/EX5.16/Result5_16.txt new file mode 100755 index 000000000..5b00e6881 --- /dev/null +++ b/191/CH5/EX5.16/Result5_16.txt @@ -0,0 +1,23 @@ +
+ approximation of e^x on [0,1] with a uniform weight w(x)=1
+
+ The coefficients a0,a1,a2,a3 are respectively :
+
+ 0.99906
+ 1.0183
+ 0.42125
+ 0.27863
+
+ Displaying the value of x exp(x) p3(x) exp(x)-p3(x) :
+
+ 0. 1. 0.99906 0.00094
+ 0.1 1.10517 1.10538 - 0.00021
+ 0.2 1.2214 1.2218 - 0.00040
+ 0.3 1.34986 1.34999 - 0.00013
+ 0.4 1.49182 1.49161 0.00021
+ 0.5 1.64872 1.64835 0.00037
+ 0.6 1.82212 1.82187 0.00025
+ 0.7 2.01375 2.01385 - 0.00010
+ 0.8 2.22554 2.22595 - 0.00041
+ 0.9 2.4596 2.45986 - 0.00025
+ 1. 2.71828 2.71723 0.00105
\ No newline at end of file diff --git a/191/CH5/EX5.17/Example5_17.sce b/191/CH5/EX5.17/Example5_17.sce new file mode 100755 index 000000000..88d222873 --- /dev/null +++ b/191/CH5/EX5.17/Example5_17.sce @@ -0,0 +1,32 @@ +//Gram - Schmidt process for finding orthogonal functions
+clc;
+clear;
+close();
+format('v',8);
+funcprot(0);
+
+disp('The orthogonal functions : ')
+x = poly(0,'x');
+ph0 = 1;
+
+disp(ph0 , 'phi0(x) = ');
+K1_0 = -integrate('x','x',0,1)/integrate('ph0^2','x',0,1);
+ph1 = x + K1_0*ph0;
+disp(ph1 , 'phi1(x) = ');
+
+K2_0 = -integrate('x^2*ph0','x',0,1)/integrate('ph0^2','x',0,1);
+disp(K2_0 ,'K(2,0) = ');
+K2_1 = -integrate('x^2*(x-.5)','x',0,1)/integrate('(x-.5)^2','x',0,1);
+disp(K2_1 ,'K(2,1) = ');
+ph2 = x^2 + K2_0*ph0 + K2_1*ph1;
+disp(ph2 , 'phi2(x) = ');
+
+K3_0 = -integrate('x^3*ph0','x',0,1)/integrate('ph0^2','x',0,1);
+disp(K3_0 ,'K(3,0) = ');
+K3_1 = -integrate('x^3*(x-.5)','x',0,1)/integrate('(x-.5)^2','x',0,1);
+disp(K3_1 ,'K(3,1) = ');
+K3_2 = -integrate('x^3*(x^2-x+1/6)','x',0,1)/integrate('(x^2-x+1/6)^2','x',0,1);
+disp(K3_2 ,'K(3,2) = ');
+ph3 = x^3 + K3_0*ph0 + K3_1*ph1 + K3_2*ph2;
+disp(ph3 , 'phi3(x) = ');
+
diff --git a/191/CH5/EX5.17/Result5_17.txt b/191/CH5/EX5.17/Result5_17.txt new file mode 100755 index 000000000..93d68ff52 --- /dev/null +++ b/191/CH5/EX5.17/Result5_17.txt @@ -0,0 +1,40 @@ +
+ The orthogonal functions :
+
+ phi0(x) =
+
+ 1.
+
+ phi1(x) =
+
+ - 0.5 + x
+
+ K(2,0) =
+
+ - 0.33333
+
+ K(2,1) =
+
+ - 1.
+
+ phi2(x) =
+
+ 2
+ 0.16667 - x + x
+
+ K(3,0) =
+
+ - 0.25
+
+ K(3,1) =
+
+ - 0.9
+
+ K(3,2) =
+
+ - 1.5
+
+ phi3(x) =
+
+ 2 3
+ - 0.05 + 0.6x - 1.5x + x
\ No newline at end of file diff --git a/191/CH5/EX5.18/Example5_18.sce b/191/CH5/EX5.18/Example5_18.sce new file mode 100755 index 000000000..fd4261063 --- /dev/null +++ b/191/CH5/EX5.18/Example5_18.sce @@ -0,0 +1,48 @@ +//Gram - Schmidt process for cubic polynomial least squares approx
+clc;
+clear;
+close();
+format('v',8);
+funcprot(0);
+
+disp('The orthogonal functions : ')
+x = poly(0,'x');
+ph0 = 1;
+
+disp(ph0 , 'phi0(x) = ');
+K1_0 = -integrate('x','x',0,1)/integrate('ph0^2','x',0,1);
+ph1 = x + K1_0*ph0;
+disp(ph1 , 'phi1(x) = ');
+
+K2_0 = -integrate('x^2*ph0','x',0,1)/integrate('ph0^2','x',0,1);
+disp(K2_0 ,'K(2,0) = ');
+K2_1 = -integrate('x^2*(x-.5)','x',0,1)/integrate('(x-.5)^2','x',0,1);
+disp(K2_1 ,'K(2,1) = ');
+ph2 = x^2 + K2_0*ph0 + K2_1*ph1;
+disp(ph2 , 'phi2(x) = ');
+
+K3_0 = -integrate('x^3*ph0','x',0,1)/integrate('ph0^2','x',0,1);
+disp(K3_0 ,'K(3,0) = ');
+K3_1 = -integrate('x^3*(x-.5)','x',0,1)/integrate('(x-.5)^2','x',0,1);
+disp(K3_1 ,'K(3,1) = ');
+K3_2 = -integrate('x^3*(x^2-x+1/6)','x',0,1)/integrate('(x^2-x+1/6)^2','x',0,1);
+disp(K3_2 ,'K(3,2) = ');
+ph3 = x^3 + K3_0*ph0 + K3_1*ph1 + K3_2*ph2;
+disp(ph3 , 'phi3(x) = ');
+
+deff('[y]=f(x)','y= exp(x)');
+deff('[phi0]=ph_0(x)','phi0= horner(ph0,x)');
+deff('[phi1]=ph_1(x)','phi1= horner(ph1,x)');
+deff('[phi2]=ph_2(x)','phi2= horner(ph2,x)');
+deff('[phi3]=ph_3(x)','phi3= horner(ph3,x)');
+a0 = integrate('f(x)*ph_0(x)','x',0,1)/integrate('ph_0(x)^2','x',0,1);
+disp(a0,'a0 = ');
+a1 = integrate('f(x)*ph_1(x)','x',0,1)/integrate('ph_1(x)^2','x',0,1);
+disp(a1,'a1 = ');
+a2 = integrate('f(x)*ph_2(x)','x',0,1)/integrate('ph_2(x)^2','x',0,1);
+disp(a2,'a2 = ');
+a3 = integrate('f(x)*ph_3(x)','x',0,1)/integrate('ph_3(x)^2','x',0,1);
+disp(a3,'a3 = ');
+
+p3 = a0*ph0 + a1*ph1 + a2*ph2 +a3*ph3;
+disp(p3 , 'p3(x)');
\ No newline at end of file diff --git a/191/CH5/EX5.18/Result5_18.txt b/191/CH5/EX5.18/Result5_18.txt new file mode 100755 index 000000000..c70da9d56 --- /dev/null +++ b/191/CH5/EX5.18/Result5_18.txt @@ -0,0 +1,61 @@ +
+ The orthogonal functions :
+
+ phi0(x) =
+
+ 1.
+
+ phi1(x) =
+
+ - 0.5 + x
+
+ K(2,0) =
+
+ - 0.33333
+
+ K(2,1) =
+
+ - 1.
+
+ phi2(x) =
+
+ 2
+ 0.16667 - x + x
+
+ K(3,0) =
+
+ - 0.25
+
+ K(3,1) =
+
+ - 0.9
+
+ K(3,2) =
+
+ - 1.5
+
+ phi3(x) =
+
+ 2 3
+ - 0.05 + 0.6x - 1.5x + x
+
+ a0 =
+
+ 1.71828
+
+ a1 =
+
+ 1.69031
+
+ a2 =
+
+ 0.83918
+
+ a3 =
+
+ 0.27863
+
+ p3(x)
+
+ 2 3
+ 0.99906 + 1.0183x + 0.42125x + 0.27863x
\ No newline at end of file diff --git a/191/CH5/EX5.2/Example5_2.sce b/191/CH5/EX5.2/Example5_2.sce new file mode 100755 index 000000000..8ddb401c6 --- /dev/null +++ b/191/CH5/EX5.2/Example5_2.sce @@ -0,0 +1,26 @@ +//Theoritical bound on error
+//it needs Symbolic Toolbox
+//cd ~\Desktop\maxima_symbolic;
+//exec 'symbolic.sce'
+clc;
+clear;
+close();
+syms x;
+fx = log(x);
+n = 2;
+x0 = 2;
+x1 = 2.5;
+x2 = 3;
+diff1_fx = diff(fx,x);
+diff2_fx = diff(diff1_fx,x);
+diff3_fx = diff(diff2_fx,x);
+//so fx satisfies the continuity conditions on [2,3]
+x= poly(0,'x');
+eta = linspace(2,3,100);
+//fx-p2x is equal to
+func = (x-2)*(x-2.5)*(x-3)*2/(factorial(3)*eta^3);
+min_func = (x-2)*(x-2.5)*(x-3)*2/(factorial(3)*min(eta)^3);
+disp(min_func , 'func will be less than or equal to');
+x = 2.7;
+max_error = abs(horner(min_func,x));
+disp(max_error , 'Error does not exceed :');
\ No newline at end of file diff --git a/191/CH5/EX5.2/Result5_2.txt b/191/CH5/EX5.2/Result5_2.txt new file mode 100755 index 000000000..f1966a4d7 --- /dev/null +++ b/191/CH5/EX5.2/Result5_2.txt @@ -0,0 +1,3 @@ + Error does not exceed :
+
+ 0.00175
\ No newline at end of file diff --git a/191/CH5/EX5.3/Example5_3.sce b/191/CH5/EX5.3/Example5_3.sce new file mode 100755 index 000000000..bb5c0e703 --- /dev/null +++ b/191/CH5/EX5.3/Example5_3.sce @@ -0,0 +1,23 @@ +//Divided difference for the functin = ln(x)
+clc;
+clear;
+close();
+format('v',9);
+x = [1 1.5 1.75 2];
+fx = [0 0.40547 0.55962 0.69315];
+fab(1) = (fx(2)-fx(1))/(x(2)-x(1));
+fab(2) = (fx(3)-fx(2))/(x(3)-x(2));
+fab(3) = (fx(4)-fx(3))/(x(4)-x(3));
+fabc(1)= (fab(2)-fab(1))/(x(3)-x(1));
+fabc(2)= (fab(3)-fab(2))/(x(4)-x(2));
+fabcd(1)= (fabc(2)-fabc(1))/(x(4)-x(1));
+disp(fx',fab,fabc,fabcd,'Divided difference columns : ')
+
+//We can redraw the table, the existing entries does not change
+x(5)=1.1;
+fx(5)=0.09531;
+fab(4) = (fx(5)-fx(4))/(x(5)-x(4));
+fabc(3)= (fab(4)-fab(3))/(x(5)-x(3));
+fabcd(2)= (fabc(3)-fabc(2))/(x(5)-x(2));
+fabcde(1)=(fabcd(2)-fabcd(1))/(x(5)-x(1));
+disp(fx',fab,fabc,fabcd,fabcde,'Divided difference columns after addition of an entry : ')
\ No newline at end of file diff --git a/191/CH5/EX5.3/Result5_3.txt b/191/CH5/EX5.3/Result5_3.txt new file mode 100755 index 000000000..bef36e64c --- /dev/null +++ b/191/CH5/EX5.3/Result5_3.txt @@ -0,0 +1,38 @@ +
+ Divided difference columns :
+
+ 0.09416
+
+ - 0.25912
+ - 0.16496
+
+ 0.81094
+ 0.6166
+ 0.53412
+
+ 0.
+ 0.40547
+ 0.55962
+ 0.69315
+
+ Divided difference columns after addition of an entry :
+
+ - 0.059959
+
+ 0.09416
+ 0.088164
+
+ - 0.25912
+ - 0.16496
+ - 0.200226
+
+ 0.81094
+ 0.6166
+ 0.53412
+ 0.664267
+
+ 0.
+ 0.40547
+ 0.55962
+ 0.69315
+ 0.09531
\ No newline at end of file diff --git a/191/CH5/EX5.4/Example5_4.sce b/191/CH5/EX5.4/Example5_4.sce new file mode 100755 index 000000000..7e4395265 --- /dev/null +++ b/191/CH5/EX5.4/Example5_4.sce @@ -0,0 +1,30 @@ +//Polynomial Interpolation: Divided Differnce form
+clc;
+clear;
+close();
+format('v',8);
+x = [1 1.5 1.75 2];
+fx = [0 0.40547 0.55962 0.69315];
+fab(1) = (fx(2)-fx(1))/(x(2)-x(1));
+fab(2) = (fx(3)-fx(2))/(x(3)-x(2));
+fab(3) = (fx(4)-fx(3))/(x(4)-x(3));
+fabc(1)= (fab(2)-fab(1))/(x(3)-x(1));
+fabc(2)= (fab(3)-fab(2))/(x(4)-x(2));
+fabcd(1)= (fabc(2)-fabc(1))/(x(4)-x(1));
+
+x(5)=1.1;
+fx(5)=0.09531;
+fab(4) = (fx(5)-fx(4))/(x(5)-x(4));
+fabc(3)= (fab(4)-fab(3))/(x(5)-x(3));
+fabcd(2)= (fabc(3)-fabc(2))/(x(5)-x(2));
+fabcde(1)=(fabcd(2)-fabcd(1))/(x(5)-x(1));
+disp(fabcde,fabcd,fabc,fab,fx','Divided difference columns : ')
+
+x1 = poly(0,'x1');
+p3x = fx(1)+fab(1)*(x1-x(1))+fabc(1)*(x1-x(1))*(x1-x(2))+fabcd(1)*(x1-x(1))*(x1-x(2))*(x1-x(3));
+p3=horner(p3x,1.3);
+disp(p3,'The interpolated value at 1.3 using p3(x) is : ')
+
+p4x = p3x + fabcde(1)*(x1-x(1))*(x1-x(2))*(x1-x(3))*(x1-x(4));
+p4=horner(p4x,1.3);
+disp(p4,'The interpolated value at 1.3 using p4(x) is : ')
diff --git a/191/CH5/EX5.4/Result5_4.txt b/191/CH5/EX5.4/Result5_4.txt new file mode 100755 index 000000000..947dbb8f1 --- /dev/null +++ b/191/CH5/EX5.4/Result5_4.txt @@ -0,0 +1,30 @@ +
+ Divided difference columns :
+
+ 0.
+ 0.40547
+ 0.55962
+ 0.69315
+ 0.09531
+
+ 0.81094
+ 0.6166
+ 0.53412
+ 0.66427
+
+ - 0.25912
+ - 0.16496
+ - 0.20023
+
+ 0.09416
+ 0.08816
+
+ - 0.05996
+
+ The interpolated value at 1.3 using p3(x) is :
+
+ 0.26137
+
+ The interpolated value at 1.3 using p4(x) is :
+
+ 0.26250
\ No newline at end of file diff --git a/191/CH5/EX5.5/Example5_5.sce b/191/CH5/EX5.5/Example5_5.sce new file mode 100755 index 000000000..b857982e4 --- /dev/null +++ b/191/CH5/EX5.5/Example5_5.sce @@ -0,0 +1,34 @@ +//Construction of Forward Difference Table +close(); +clear; +clc; +x = poly(0,'x'); +fx = (x-1)*(x+5)/((x+2)*(x+1)); +xi = linspace(0.0,0.8,9); +x0 = 0; +h = 0.1; +format('v',9); +// values of function at different xi's +fi = horner(fx , xi); +// First order difference +for j = 1:8 + delta1_fi(j) = fi(j+1) - fi(j); +end +// Second order difference +for j = 1:7 + delta2_fi(j) = delta1_fi(j+1) - delta1_fi(j); +end +// Third order difference +for j = 1:6 + delta3_fi(j) = delta2_fi(j+1) - delta2_fi(j); +end +// Fourth order difference +for j = 1:5 + delta4_fi(j) = delta3_fi(j+1) - delta3_fi(j); +end + +disp(fi , 'Values of f(x) : ') +disp(delta1_fi , 'First Order Difference :') +disp(delta2_fi , 'Second Order Difference :') +disp(delta3_fi , 'Third Order Difference :') +disp(delta4_fi , 'Fourth Order Difference :') diff --git a/191/CH5/EX5.5/Result5_5.txt b/191/CH5/EX5.5/Result5_5.txt new file mode 100755 index 000000000..d9252ee8e --- /dev/null +++ b/191/CH5/EX5.5/Result5_5.txt @@ -0,0 +1,34 @@ + First Order Difference :
+
+ 0.512987
+ 0.411255
+ 0.334955
+ 0.276517
+ 0.230952
+ 0.194872
+ 0.165913
+ 0.142390
+Second Order Difference :
+
+ - 0.101732
+ - 0.076301
+ - 0.058438
+ - 0.045565
+ - 0.036081
+ - 0.028959
+ - 0.023522
+Third Order Difference :
+
+ 0.025431
+ 0.017863
+ 0.012873
+ 0.009484
+ 0.007121
+ 0.005437
+ Fourth Order Difference :
+
+ - 0.007569
+ - 0.004989
+ - 0.003389
+ - 0.002363
+ - 0.001684
\ No newline at end of file diff --git a/191/CH5/EX5.6/Example5_6.sce b/191/CH5/EX5.6/Example5_6.sce new file mode 100755 index 000000000..7166f1b6f --- /dev/null +++ b/191/CH5/EX5.6/Example5_6.sce @@ -0,0 +1,36 @@ +//Illustration of Newton's Forward Difference Formula +close(); +clear; +clc; +x = poly(0,'x'); +fx = (x-1)*(x+5)/((x+2)*(x+1)); +xi = linspace(0.0,0.8,9); +x0 = 0; +h = 0.1; +format('v',9); +// values of function at different xi's +f0 = horner(fx , xi); +// First order difference +for j = 1:8 + delta1_f0(j) = f0(j+1) - f0(j); +end +// Second order difference +for j = 1:7 + delta2_f0(j) = delta1_f0(j+1) - delta1_f0(j); +end +// Third order difference +for j = 1:6 + delta3_f0(j) = delta2_f0(j+1) - delta2_f0(j); +end +// Fourth order difference +for j = 1:5 + delta4_f0(j) = delta3_f0(j+1) - delta3_f0(j); +end +//Calculating p4(0.12) +//x0+s*h=0.12 +s = (0.12-x0)/h; +p4 = f0(1) + delta1_f0(1)*s + delta2_f0(1)*s*(s-1)/factorial(2) + delta3_f0(1)*s*(s-1)*(s-2)/factorial(3) + delta4_f0(1)*s*(s-1)*(s-2)*(s-3)/factorial(4); +disp(p4 , 'Value of p4(0.12)'); +//exact value of f(0.12) is -1.897574 so error +err = p4--1.897574; +disp(err , 'Error in estimation');
\ No newline at end of file diff --git a/191/CH5/EX5.6/Result5_6.txt b/191/CH5/EX5.6/Result5_6.txt new file mode 100755 index 000000000..e09209363 --- /dev/null +++ b/191/CH5/EX5.6/Result5_6.txt @@ -0,0 +1,7 @@ + Value of p4(0.12)
+
+ - 1.897546
+
+ Error in estimation
+
+ 0.000028
\ No newline at end of file diff --git a/191/CH5/EX5.7/Example5_7.sce b/191/CH5/EX5.7/Example5_7.sce new file mode 100755 index 000000000..223cce35e --- /dev/null +++ b/191/CH5/EX5.7/Example5_7.sce @@ -0,0 +1,40 @@ +//Illustration of Central Difference Formula +close(); +clear; +clc; +xi = 0:0.2:1.2; +fi = sin(xi); +x0 = 0; +h = 0.2; +format('v',8); +// First order difference +delta1_fi = diff(fi); +// Second order difference +delta2_fi = diff(delta1_fi); +// Third order difference +delta3_fi = diff(delta2_fi); +// Fourth order difference +delta4_fi = diff(delta3_fi); +//Fifth order difference +delta5_fi = diff(delta4_fi); +//Sixth order difference +delta6_fi = diff(delta5_fi); +disp(fi , 'Values of f(x) : ') +disp(delta1_fi , 'First Order Difference :') +disp(delta2_fi , 'Second Order Difference :') +disp(delta3_fi , 'Third Order Difference :') +disp(delta4_fi , 'Fourth Order Difference :') +disp(delta5_fi , 'Fifth Order Difference :') +disp(delta6_fi , 'Sixth Order Difference :') +//Calculating p2(0.67) +xm = 0.6; +x = 0.67; +s = (x-xm)/0.2; +p2 = fi(4) + {s*(delta1_fi(3)+delta1_fi(4))/2} + s*s*(delta2_fi(3))/2; +disp(p2 , 'Value of p2(0.67) : '); +//Calculating p4(0.67) +p4 = p2 + s*(s*s-1)*(delta3_fi(3)+delta3_fi(2))/12 + s*s*(s*s-1)*delta4_fi(2)/24; +disp(p4 , 'Value of p4(0.67) : '); +//Exact value of sin(0.67) is 0.62099 so error in estimation +err = 0.62099-0.62098; +disp(err , 'Error in estimation : ');
\ No newline at end of file diff --git a/191/CH5/EX5.7/Result5_7.txt b/191/CH5/EX5.7/Result5_7.txt new file mode 100755 index 000000000..689644837 --- /dev/null +++ b/191/CH5/EX5.7/Result5_7.txt @@ -0,0 +1,29 @@ + First Order Difference :
+
+ 0.19867 0.19075 0.17522 0.15271 0.12411 0.09057
+ Second Order Difference :
+
+ - 0.00792 - 0.01552 - 0.02251 - 0.02860 - 0.03355
+ Third Order Difference :
+
+ - 0.00760 - 0.00699 - 0.00609 - 0.00495
+ Fourth Order Difference :
+
+ 0.00062 0.00090 0.00114
+ Fifth Order Difference :
+
+ 0.00028 0.00024
+
+ Sixth Order Difference :
+
+ - 0.00004
+ Value of p2(0.67) :
+
+ 0.62065
+ Value of p4(0.67) :
+
+ 0.62098
+
+ Error in estimation :
+
+ 0.00001
\ No newline at end of file diff --git a/191/CH5/EX5.8/Example5_8.sce b/191/CH5/EX5.8/Example5_8.sce new file mode 100755 index 000000000..9ced4bc6b --- /dev/null +++ b/191/CH5/EX5.8/Example5_8.sce @@ -0,0 +1,37 @@ +//Hermite Interpolation
+clc;
+clear;
+close();
+format('v',9);
+funcprot(0);
+deff('[LL0]=L0(x)','LL0= 2*x^2-11*x+15');
+deff('[LL1]=L1(x)','LL1= -4*x^2+20*x-24');
+deff('[LL2]=L2(x)','LL2= 2*x^2-9*x+10');
+deff('[LL0d]=L0d(x)','LL0d= 4*x-11');
+deff('[LL1d]=L1d(x)','LL1d= -8*x+20');
+deff('[LL2d]=L2d(x)','LL2d= 4*x-9');
+
+disp('In this case n = 2. The legranges polynomial and their derivative . ');
+disp('L0(x)=2*x^2-11*x+15 L1(x)= -4*x^2+20x-24 L2(x)=2x^2-9x+10');
+disp('L0d(x)=4*x-11 L1d(x)= -8*x+20 L2d(x)=4*x-9');
+
+disp('ri(x) = [1-2(x-xi)Lid(xi)][Li(x)]^2 si(x) = (x-xi)[Li(x)]^2');
+
+deff('[rr0]=r0(x)','rr0=(1-2*(x-2)*L0d(2))*(L0(x))^2');
+deff('[rr1]=r1(x)','rr1=(1-2*(x-2.5)*L1d(2.5))*(L1(x))^2');
+deff('[rr2]=r2(x)','rr2=(1-2*(x-3)*L2d(3))*(L2(x))^2');
+
+deff('[ss0]=s0(x)','ss0=(x-2)*L0(x)^2');
+deff('[ss1]=s1(x)','ss1=(x-2.5)*L1(x)^2');
+deff('[ss2]=s2(x)','ss2=(x-3)*L2(x)^2');
+
+y = [log(2) log(2.5) log(3)];
+yd = [0.500000 0.400000 0.333333];
+
+deff('[H5]=H(x)','H5=r0(x)*y(1)+r1(x)*y(2)+r2(x)*y(3)+s0(x)*yd(1)+s1(x)*yd(2)+s2(x)*yd(3)');
+y2 = H(2.7);
+disp(y2,'The calculated value of y(2.7):');
+act = log(2.7);
+disp(act,'The exact value is of y(2.7): ');
+err = act - y2;
+disp(err,'The error is :');
\ No newline at end of file diff --git a/191/CH5/EX5.8/Result5_8.txt b/191/CH5/EX5.8/Result5_8.txt new file mode 100755 index 000000000..530df3b26 --- /dev/null +++ b/191/CH5/EX5.8/Result5_8.txt @@ -0,0 +1,22 @@ +
+ In this case n = 2. The legranges polynomial and their deri
+ vative .
+
+ L0(x)=2*x^2-11*x+15 L1(x)= -4*x^2+20x-24 L2(x)=2x^2-9x+10
+
+ L0d(x)=4*x-11 L1d(x)= -8*x+20 L2d(x)=4*x-9
+
+ ri(x) = [1-2(x-xi)Lid(xi)][Li(x)]^2 si(x) = (x-xi)[Li(x)]
+ ^2
+
+ The calculated value of y(2.7):
+
+ 0.993253
+
+ The exact value is of y(2.7):
+
+ 0.993252
+
+ The error is :
+
+ - 0.000001
\ No newline at end of file diff --git a/191/CH5/EX5.9/Example5_9.sce b/191/CH5/EX5.9/Example5_9.sce new file mode 100755 index 000000000..93b5b9f00 --- /dev/null +++ b/191/CH5/EX5.9/Example5_9.sce @@ -0,0 +1,18 @@ +//Hermite cubic Interpolation
+clc;
+clear;
+close();
+format('v',9);
+funcprot(0);
+
+x0 = -2;x1 = 0;x2 = 1;
+y0 = 3;y1 = 1;y2 = -2;
+y0d = -1;y1d = 0;y1d = 1;
+h0 = 2;
+h1 = 1;
+
+deff('[H3_0]=H30(x)','H3_0=y0*((x-x1)^2/h0^2+2*(x-x0)*(x-x1)^2/h0^3)+y1*((x-x0)^2/h0^2-2*(x-x1)*(x-x0)^2/h0^3)+y0d*(x-x0)*(x-x1)^2/h0^2+y1d*((x-x1)*(x-x0)^2)/h0^2');
+deff('[H3_1]=H31(x)','H3_1=y1*((x-x2)^2/h1^2+2*(x-x1)*(x-x2)^2/h1^3)+y2*((x-x1)^2/h1^2-2*(x-x2)*(x-x1)^2/h1^3)+y1d*(x-x1)*(x-x2)^2/h1^2+y2d*((x-x2)*(x-x1)^2)/h1^2');
+
+disp ('H(x) = x^3/4+x^2+1 on -2<=x<=0');
+disp (' 7*x^3-10*x^2+1 on 0<=x<=1');
\ No newline at end of file diff --git a/191/CH5/EX5.9/Result5_9.txt b/191/CH5/EX5.9/Result5_9.txt new file mode 100755 index 000000000..13bc85f5c --- /dev/null +++ b/191/CH5/EX5.9/Result5_9.txt @@ -0,0 +1,5 @@ +
+ H(x) = x^3/4+x^2+1 on -2<=x<=0
+
+ 7*x^3-10*x^2+1 on 0<=x<=1
+
\ No newline at end of file |