summaryrefslogtreecommitdiff
path: root/1332/CH5/EX5.38/5_38.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1332/CH5/EX5.38/5_38.sce
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '1332/CH5/EX5.38/5_38.sce')
-rwxr-xr-x1332/CH5/EX5.38/5_38.sce19
1 files changed, 19 insertions, 0 deletions
diff --git a/1332/CH5/EX5.38/5_38.sce b/1332/CH5/EX5.38/5_38.sce
new file mode 100755
index 000000000..5706e0a48
--- /dev/null
+++ b/1332/CH5/EX5.38/5_38.sce
@@ -0,0 +1,19 @@
+//Example 5.38
+//Newton Raphson Method
+//Page no. 205
+clc;clear;close;
+deff('y=f(p)','y=p^3-9*p^2+33*p-65')
+deff('y=f1(p)','y=3*p^2-18*p+33')
+printf('n\txn\t\t\f(xn)\t\tf1(xn)\t\tXn+1\t\tError\n')
+printf('-----------------------------------------------------------------------------------------------------\n')
+x0=6;e=0.00001
+for i=1:10
+ x1=x0-f(x0)/f1(x0)
+ e1=abs(x0-x1)
+ printf(' %i\t%.10f\t%.10f\t%.10f\t%.10f\t%.10f\n',i-1,x0,f(x0),f1(x0),x1,e1)
+ x0=x1;
+ if abs(x0)<e then
+ break;
+ end
+end
+printf('\n\nTherefore, Market Price at equilibrium = Rs. %.f',x1) \ No newline at end of file