diff options
Diffstat (limited to '413/CH3')
-rw-r--r-- | 413/CH3/EX3.1/Example_3_1.sce | 17 | ||||
-rw-r--r-- | 413/CH3/EX3.2/Example_3_2.sce | 29 | ||||
-rw-r--r-- | 413/CH3/EX3.3/Example_3_3.sce | 32 | ||||
-rw-r--r-- | 413/CH3/EX3.4/Example_3_4.sce | 28 | ||||
-rw-r--r-- | 413/CH3/EX3.5/Table_3_2.sce | 28 | ||||
-rw-r--r-- | 413/CH3/EX3.6/Table_3_5a.sce | 32 | ||||
-rw-r--r-- | 413/CH3/EX3.7/Table_3_5b.sce | 32 |
7 files changed, 198 insertions, 0 deletions
diff --git a/413/CH3/EX3.1/Example_3_1.sce b/413/CH3/EX3.1/Example_3_1.sce new file mode 100644 index 000000000..6b6b409ab --- /dev/null +++ b/413/CH3/EX3.1/Example_3_1.sce @@ -0,0 +1,17 @@ +clc
+clear
+x=[3.2 2.7 1 4.8 5.6]
+y=[22 17.8 14.2 38.3 51.7]
+for i=1:1:5
+X=[x(1,i) y(1,i)]
+disp(X)
+end
+
+P31=(3-x(1,2))*(3-x(1,3))*(3-x(1,4))*(3-x(1,5))*y(1,1)/((x(1,1)-x(1,2))*(x(1,1)-x(1,3))*(x(1,1)-x(1,4))*(x(1,1)-x(1,5)));
+P32=(3-x(1,1))*(3-x(1,3))*(3-x(1,4))*(3-x(1,5))*y(1,2)/((x(1,2)-x(1,1))*(x(1,2)-x(1,3))*(x(1,2)-x(1,4))*(x(1,2)-x(1,5)))
+P33=(3-x(1,2))*(3-x(1,1))*(3-x(1,4))*(3-x(1,5))*y(1,3)/((x(1,3)-x(1,2))*(x(1,3)-x(1,1))*(x(1,3)-x(1,4))*(x(1,3)-x(1,5)))
+P34=(3-x(1,2))*(3-x(1,3))*(3-x(1,1))*(3-x(1,5))*y(1,4)/((x(1,4)-x(1,2))*(x(1,4)-x(1,3))*(x(1,4)-x(1,1))*(x(1,4)-x(1,5)))
+P35=(3-x(1,2))*(3-x(1,3))*(3-x(1,4))*(3-x(1,1))*y(1,5)/((x(1,5)-x(1,2))*(x(1,5)-x(1,3))*(x(1,5)-x(1,4))*(x(1,5)-x(1,1)))
+printf(' Ploynomial at x=3 is')
+P=P31+P32+P33+P34+P35
+disp(P)
\ No newline at end of file diff --git a/413/CH3/EX3.2/Example_3_2.sce b/413/CH3/EX3.2/Example_3_2.sce new file mode 100644 index 000000000..b28cfce2d --- /dev/null +++ b/413/CH3/EX3.2/Example_3_2.sce @@ -0,0 +1,29 @@ +clc
+clear
+x=[32 22.2 41.6 10.1 50.5]
+y=[0.52992 0.37784 0.66393 0.17537 0.63608]
+for i=1:1:5
+X=[x(1,i) y(1,i)]
+disp(X)
+end
+a=27.5
+for i=1:4
+ A(1,i)=((a-x(1,i))*y(1,i+1)+(x(1,i+1)-a)*y(1,i))/(x(1,i+1)-x(1,i))
+end
+for i=1:3
+ B(1,i)=((a-x(1,i))*A(1,i+1)+(x(1,i+2)-a)*A(1,i))/(x(1,i+2)-x(1,i))
+end
+for i=1:2
+ C(1,i)=((a-x(1,i))*B(1,i+1)+(x(1,i+3)-a)*B(1,i))/(x(1,i+3)-x(1,i))
+end
+D(1,1)=((a-x(1,1))*C(1,2)+(x(1,5)-a)*C(1,1))/(x(1,5)-x(1,1))
+out=[0,x(1,1),y(1,1) ]
+disp(out)
+out1=[1,x(1,2),y(1,2), A(1,1) ]
+disp(out1)
+out2=[2,x(1,3),y(1,3), A(1,2), B(1,1),C(1,1),D(1,1) ]
+disp(out2)
+out3=[3,x(1,4),y(1,4), A(1,3), B(1,2),C(1,2) ]
+disp(out3)
+out4=[4,x(1,5),y(1,5), A(1,4), B(1,3) ]
+disp(out4)
\ No newline at end of file diff --git a/413/CH3/EX3.3/Example_3_3.sce b/413/CH3/EX3.3/Example_3_3.sce new file mode 100644 index 000000000..efd167c30 --- /dev/null +++ b/413/CH3/EX3.3/Example_3_3.sce @@ -0,0 +1,32 @@ +clc
+clear
+x=[3.2 2.7 1 4.8 5.6];
+y=[22 17.8 14.2 38.3 51.7]
+for i=1:1:5
+X=[x(1,i) y(1,i)]
+disp(X)
+end
+for i=1:1:4
+A(1,i)=(y(1,i+1)-y(1,i))/(x(1,i+1)-x(1,i))
+end
+for i=1:1:3
+B(1,i)=(A(1,i+1)-A(1,i))/(x(1,i+2)-x(1,i))
+end
+for i=1:1:2
+C(1,i)=(B(1,i+1)-B(1,i))/(x(1,i+3)-x(1,i))
+end
+for i=1:1:1
+D(1,i)=(C(1,i+1)-C(1,i))/(x(1,i+4)-x(1,i))
+end
+out=[x(1,1),y(1,1) ]
+disp(out)
+out1=[x(1,2),y(1,2), A(1,1) ]
+disp(out1)
+out2=[x(1,3),y(1,3), A(1,2), B(1,1),C(1,1),D(1,1) ]
+disp(out2)
+out3=[x(1,4),y(1,4), A(1,3), B(1,2),C(1,2) ]
+disp(out3)
+out4=[x(1,5),y(1,5), A(1,4), B(1,3) ]
+disp(out4)
+P3=C(1,1)*(3-x(1,1))*(3-x(1,2))*(3-x(1,3))+B(1,1)*(3-x(1,1))*(3-x(1,2))+A(1,1)*(3-x(1,1))+y(1,1)
+disp(P3)
\ No newline at end of file diff --git a/413/CH3/EX3.4/Example_3_4.sce b/413/CH3/EX3.4/Example_3_4.sce new file mode 100644 index 000000000..40944d326 --- /dev/null +++ b/413/CH3/EX3.4/Example_3_4.sce @@ -0,0 +1,28 @@ +clc
+clear
+x=[1.10 2.00 3.50 5.00 7.10];
+for i=1:5
+y(1,i)=x(1,i).*x(1,i).*exp(-x(1,i)/2)
+end
+for i=1:1:4
+A(1,i)=(y(1,i+1)-y(1,i))/(x(1,i+1)-x(1,i))
+end
+for i=1:1:3
+B(1,i)=(A(1,i+1)-A(1,i))/(x(1,i+2)-x(1,i))
+end
+for i=1:1:2
+C(1,i)=(B(1,i+1)-B(1,i))/(x(1,i+3)-x(1,i))
+end
+for i=1:1:1
+D(1,i)=(C(1,i+1)-C(1,i))/(x(1,i+4)-x(1,i))
+end
+out=[x(1,1),y(1,1) ]
+disp(out)
+out1=[x(1,2),y(1,2), A(1,1) ]
+disp(out1)
+out2=[x(1,3),y(1,3), A(1,2), B(1,1),C(1,1),D(1,1) ]
+disp(out2)
+out3=[x(1,4),y(1,4), A(1,3), B(1,2),C(1,2) ]
+disp(out3)
+out4=[x(1,5),y(1,5), A(1,4), B(1,3) ]
+disp(out4)
\ No newline at end of file diff --git a/413/CH3/EX3.5/Table_3_2.sce b/413/CH3/EX3.5/Table_3_2.sce new file mode 100644 index 000000000..14ca10cf3 --- /dev/null +++ b/413/CH3/EX3.5/Table_3_2.sce @@ -0,0 +1,28 @@ +clc
+clear
+clc
+clear
+x=[3.2 2.7 1 4.8 5.6];
+y=[22 17.8 14.2 38.3 51.7]
+for i=1:1:4
+A(1,i)=(y(1,i+1)-y(1,i))/(x(1,i+1)-x(1,i))
+end
+for i=1:1:3
+B(1,i)=(A(1,i+1)-A(1,i))/(x(1,i+2)-x(1,i))
+end
+for i=1:1:2
+C(1,i)=(B(1,i+1)-B(1,i))/(x(1,i+3)-x(1,i))
+end
+for i=1:1:1
+D(1,i)=(C(1,i+1)-C(1,i))/(x(1,i+4)-x(1,i))
+end
+out=[x(1,1),y(1,1) ]
+disp(out)
+out1=[x(1,2),y(1,2), A(1,1) ]
+disp(out1)
+out2=[x(1,3),y(1,3), A(1,2), B(1,1),C(1,1),D(1,1) ]
+disp(out2)
+out3=[x(1,4),y(1,4), A(1,3), B(1,2),C(1,2) ]
+disp(out3)
+out4=[x(1,5),y(1,5), A(1,4), B(1,3) ]
+disp(out4)
\ No newline at end of file diff --git a/413/CH3/EX3.6/Table_3_5a.sce b/413/CH3/EX3.6/Table_3_5a.sce new file mode 100644 index 000000000..3ebdbc077 --- /dev/null +++ b/413/CH3/EX3.6/Table_3_5a.sce @@ -0,0 +1,32 @@ +clc
+clear
+x=[0 0.5 1 1.5 2 2.5 3]
+for i=1:7
+y(1,i)=2*x(1,i).*x(1,i).*x(1,i)
+end
+for i=1:1:6
+A(1,i)=(y(1,i+1)-y(1,i))
+end
+for i=1:1:5
+B(1,i)=(A(1,i+1)-A(1,i))
+end
+for i=1:1:4
+C(1,i)=(B(1,i+1)-B(1,i))
+end
+for i=1:1:3
+D(1,i)=(C(1,i+1)-C(1,i))
+end
+out=[x(1,1),y(1,1) ]
+disp(out)
+out1=[x(1,2),y(1,2), A(1,1) ]
+disp(out1)
+out2=[x(1,3),y(1,3), A(1,2), B(1,1),C(1,1),D(1,1) ]
+disp(out2)
+out3=[x(1,4),y(1,4), A(1,3), B(1,2),C(1,2) ]
+disp(out3)
+out4=[x(1,5),y(1,5), A(1,4), B(1,3), C(1,3) ]
+disp(out4)
+out5=[x(1,6),y(1,6), A(1,5), B(1,4) , C(1,4)]
+disp(out5)
+out6=[x(1,7),y(1,7), A(1,6), B(1,5) ]
+disp(out6)
diff --git a/413/CH3/EX3.7/Table_3_5b.sce b/413/CH3/EX3.7/Table_3_5b.sce new file mode 100644 index 000000000..615550cc1 --- /dev/null +++ b/413/CH3/EX3.7/Table_3_5b.sce @@ -0,0 +1,32 @@ +clc
+clear
+x=[0 0.5 1 1.5 2 2.5 3]
+for i=1:7
+y(1,i)=2*x(1,i).*x(1,i).*x(1,i)
+end
+for i=1:1:6
+A(1,i)=(y(1,i+1)-y(1,i))/(x(1,i+1)-x(1,i))
+end
+for i=1:1:5
+B(1,i)=(A(1,i+1)-A(1,i))/(x(1,i+2)-x(1,i))
+end
+for i=1:1:4
+C(1,i)=(B(1,i+1)-B(1,i))/(x(1,i+3)-x(1,i))
+end
+for i=1:1:3
+D(1,i)=(C(1,i+1)-C(1,i))/(x(1,i+4)-x(1,i))
+end
+out=[x(1,1),y(1,1) ]
+disp(out)
+out1=[x(1,2),y(1,2), A(1,1) ]
+disp(out1)
+out2=[x(1,3),y(1,3), A(1,2), B(1,1),C(1,1),D(1,1) ]
+disp(out2)
+out3=[x(1,4),y(1,4), A(1,3), B(1,2),C(1,2) ]
+disp(out3)
+out4=[x(1,5),y(1,5), A(1,4), B(1,3), C(1,3) ]
+disp(out4)
+out5=[x(1,6),y(1,6), A(1,5), B(1,4) , C(1,4)]
+disp(out5)
+out6=[x(1,7),y(1,7), A(1,6), B(1,5) ]
+disp(out6)
|