diff options
Diffstat (limited to '845/CH5')
-rwxr-xr-x | 845/CH5/EX5.1/Ex5_1.sce | 21 | ||||
-rwxr-xr-x | 845/CH5/EX5.10/Ex5_10.sce | 35 | ||||
-rwxr-xr-x | 845/CH5/EX5.2/Ex5_2.sce | 21 | ||||
-rwxr-xr-x | 845/CH5/EX5.3/Ex5_3.sce | 22 | ||||
-rwxr-xr-x | 845/CH5/EX5.4/Ex5_4.sce | 19 | ||||
-rwxr-xr-x | 845/CH5/EX5.5/Ex5_5.sce | 22 | ||||
-rwxr-xr-x | 845/CH5/EX5.6/Ex5_6.sce | 20 | ||||
-rwxr-xr-x | 845/CH5/EX5.7/Ex5_7.sce | 22 | ||||
-rwxr-xr-x | 845/CH5/EX5.8/Ex5_8.sce | 23 | ||||
-rwxr-xr-x | 845/CH5/EX5.9/Ex5_9.sce | 25 |
10 files changed, 230 insertions, 0 deletions
diff --git a/845/CH5/EX5.1/Ex5_1.sce b/845/CH5/EX5.1/Ex5_1.sce new file mode 100755 index 000000000..4c3cbaf8c --- /dev/null +++ b/845/CH5/EX5.1/Ex5_1.sce @@ -0,0 +1,21 @@ +//Example 5.1
+clc
+clear
+
+x = 10:10:80;
+y = [1.06 1.33 1.52 1.68 1.81 1.91 2.01 2.11];
+
+X = log(x);
+Y = log(y);
+
+n = length(Y);
+M1 = [sum(Y); sum(X.*Y)];
+M2 = [n sum(X); sum(X) sum(X.^2)];
+
+A = M2\M1;
+
+m = exp(A(1));
+n = A(2);
+
+disp(round(m*10^4)/10^4, "m =")
+disp(round(n*10^4)/10^4, "n =")
diff --git a/845/CH5/EX5.10/Ex5_10.sce b/845/CH5/EX5.10/Ex5_10.sce new file mode 100755 index 000000000..83ae771b0 --- /dev/null +++ b/845/CH5/EX5.10/Ex5_10.sce @@ -0,0 +1,35 @@ +//Example 5.10
+
+clc
+clear
+
+x = 3:7;
+y = [31.9 34.6 33.8 27 31.6];
+
+delx = x(2) - x(1);
+mu1 = delx * sum(y);
+mu2 = delx * sum(x.*y);
+mu3 = delx * sum(x^2 .*y);
+
+n = length(y);
+l = x(1) - delx/2;
+u = x(n) + delx/2;
+
+t0 = u-l;
+t1 = integrate("x",'x',l,u);
+t2 = integrate("x^2",'x',l,u);
+t3 = integrate("x^3",'x',l,u);
+t4 = integrate("x^4",'x',l,u);
+
+M1 = [t2 t1 t0; t3 t2 t1; t4 t3 t2];
+M2 = [mu1; mu2; mu3];
+M1 = round(M1*10^2)/10^2;
+M = M1\M2;
+
+c = M(1);
+b = M(2);
+a = M(3);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")
+disp(round(c*10^4)/10^4, "c =")
diff --git a/845/CH5/EX5.2/Ex5_2.sce b/845/CH5/EX5.2/Ex5_2.sce new file mode 100755 index 000000000..76e6c91af --- /dev/null +++ b/845/CH5/EX5.2/Ex5_2.sce @@ -0,0 +1,21 @@ +//Example 5.2
+clc
+clear
+
+x = [20 30 35 40 45 50];
+y = [10 11 11.8 12.4 13.5 14.4];
+
+X = x.^2;
+Y = y;
+
+n = length(Y);
+M1 = [sum(Y); sum(X.*Y)];
+M2 = [n sum(X); sum(X) sum(X.^2)];
+
+A = M2\M1;
+
+a = A(1);
+b = A(2);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")
diff --git a/845/CH5/EX5.3/Ex5_3.sce b/845/CH5/EX5.3/Ex5_3.sce new file mode 100755 index 000000000..fcfb407a9 --- /dev/null +++ b/845/CH5/EX5.3/Ex5_3.sce @@ -0,0 +1,22 @@ +//Example 5.3
+
+clc
+clear
+
+x = [8 10 15 20 30 40];
+y = [13 14 15.4 16.3 17.2 17.8];
+
+X = 1 ./x;
+Y = 1 ./y;
+
+n = length(Y);
+M1 = [sum(Y); sum(X.*Y)];
+M2 = [n sum(X); sum(X) sum(X.^2)];
+
+A = M2\M1;
+
+b = A(1);
+a = A(2);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")
diff --git a/845/CH5/EX5.4/Ex5_4.sce b/845/CH5/EX5.4/Ex5_4.sce new file mode 100755 index 000000000..0d101b7af --- /dev/null +++ b/845/CH5/EX5.4/Ex5_4.sce @@ -0,0 +1,19 @@ +//Example 5.4
+
+clc
+clear
+
+X = 0.5:0.5:3;
+Y = [15 17 19 14 10 7];
+
+n = length(Y);
+M1 = [sum(Y); sum(X.*Y)];
+M2 = [n sum(X); sum(X) sum(X.^2)];
+
+A = M2\M1;
+
+b = A(1);
+a = A(2);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")
diff --git a/845/CH5/EX5.5/Ex5_5.sce b/845/CH5/EX5.5/Ex5_5.sce new file mode 100755 index 000000000..0c5c5eccd --- /dev/null +++ b/845/CH5/EX5.5/Ex5_5.sce @@ -0,0 +1,22 @@ +//Example 5.5
+
+clc
+clear
+
+x = 1:6;
+y = [2.6 5.4 8.7 12.1 16 20.2];
+
+X = x;
+Y = y ./x;
+
+n = length(Y);
+M1 = [sum(Y); sum(X.*Y)];
+M2 = [n sum(X); sum(X) sum(X.^2)];
+
+A = M2\M1;
+
+a = A(1);
+b = A(2);
+
+disp(round(a*10^5)/10^5, "a =")
+disp(round(b*10^5)/10^5, "b =")
diff --git a/845/CH5/EX5.6/Ex5_6.sce b/845/CH5/EX5.6/Ex5_6.sce new file mode 100755 index 000000000..5d3aafd28 --- /dev/null +++ b/845/CH5/EX5.6/Ex5_6.sce @@ -0,0 +1,20 @@ +//Example 5.6
+
+clc
+clear
+
+X = 1:0.2:2;
+Y = [0.98 1.4 1.86 2.55 2.28 3.2];
+
+n = length(Y);
+M1 = [sum(X.^4) sum(X.^3) sum(X.^2); sum(X.^3) sum(X.^2) sum(X); sum(X.^2) sum(X) n];
+M2 = [sum(X.^2 .* Y); sum(X.*Y); sum(Y)];
+A = M1\M2;
+
+a = A(1);
+b = A(2);
+c = A(3);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")
+disp(round(c*10^4)/10^4, "c =")
diff --git a/845/CH5/EX5.7/Ex5_7.sce b/845/CH5/EX5.7/Ex5_7.sce new file mode 100755 index 000000000..f5eb5968b --- /dev/null +++ b/845/CH5/EX5.7/Ex5_7.sce @@ -0,0 +1,22 @@ +//Example 5.7
+
+clc
+clear
+
+x = 2:5;
+y = [27.8 62.1 110 161];
+
+X = log(x);
+Y = log(y);
+
+n = length(Y);
+M1 = [sum(X.^2) sum(X); sum(X) n];
+M2 = [sum(X.*Y); sum(Y)];
+M = M1\M2;
+
+b = M(1);
+A = M(2);
+a = exp(A);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")
diff --git a/845/CH5/EX5.8/Ex5_8.sce b/845/CH5/EX5.8/Ex5_8.sce new file mode 100755 index 000000000..c21e12a77 --- /dev/null +++ b/845/CH5/EX5.8/Ex5_8.sce @@ -0,0 +1,23 @@ +//Example 5.8
+
+clc
+clear
+
+x = 1:4;
+y = [1.65 2.7 4.5 7.35];
+
+X = x;
+Y = log10(y);
+
+n = length(Y);
+M1 = [sum(X.^2) sum(X); sum(X) n];
+M2 = [sum(X.*Y); sum(Y)];
+M = M1\M2;
+
+B = M(1);
+A = M(2);
+a = 10^A;
+b = B/log10(%e);
+
+disp(round(a), "a =")
+disp(round(b*10^4)/10^4, "b =")
diff --git a/845/CH5/EX5.9/Ex5_9.sce b/845/CH5/EX5.9/Ex5_9.sce new file mode 100755 index 000000000..7ecf22c1f --- /dev/null +++ b/845/CH5/EX5.9/Ex5_9.sce @@ -0,0 +1,25 @@ +//Example 5.9
+
+clc
+clear
+
+x = 2:5;
+y = [27 40 55 68];
+
+delx = x(2) - x(1);
+mu1 = delx * sum(y);
+mu2 = delx * sum(x.*y);
+
+n = length(y);
+l = x(1) - delx/2;
+u = x(n) + delx/2;
+
+M1 = [integrate("x",'x',l,u) u-l; integrate("x^2",'x',l,u) integrate("x",'x',l,u)];
+M2 = [mu1; mu2];
+M = M1\M2;
+
+a = M(1);
+b = M(2);
+
+disp(round(a*10^4)/10^4, "a =")
+disp(round(b*10^4)/10^4, "b =")
|