diff options
author | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
commit | 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch) | |
tree | dbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /260/CH10/EX10.5 | |
parent | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff) | |
download | Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2 Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip |
initial commit / add all books
Diffstat (limited to '260/CH10/EX10.5')
-rw-r--r-- | 260/CH10/EX10.5/10_5.sce | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/260/CH10/EX10.5/10_5.sce b/260/CH10/EX10.5/10_5.sce new file mode 100644 index 000000000..7074fb0b5 --- /dev/null +++ b/260/CH10/EX10.5/10_5.sce @@ -0,0 +1,39 @@ +//Eg-10.5
+//pg-437
+
+clear
+clc
+close()
+
+X = [0;5;10;15];
+
+Y = [53;127;213;378];
+
+T = zeros(4,4);
+
+T(:,1) = Y;
+
+for(j = 2:4)
+ for(i = 1:4+1-j)
+ T(i,j) = T(i+1,j-1) - T(i,j-1);
+ end
+end
+
+//disp(T)
+
+// Using Gauss backward formula
+
+//p3 = f + d*A + d2*A(A+1)/2 + d3*A*(A-1)*(A+1)/6
+
+//Note that 'alpha' is replaced by A and 'small delta' by d
+
+f = T(3,1);
+d = T(2,2);
+d2 = T(2,3);
+d3 = T(1,4);
+
+A = (7-10)/5;
+
+p37 = f + d*A + d2*A*(A+1)/2 + d3*A*(A-1)*(A+1)/6;
+
+printf('Therefore, the number of houses after seven years is %d\n',p37)
|