summaryrefslogtreecommitdiff
path: root/260/CH2
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /260/CH2
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-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/CH2')
-rw-r--r--260/CH2/EX2.1/2_1.sce20
-rw-r--r--260/CH2/EX2.2/2_2.sce14
-rw-r--r--260/CH2/EX2.3/2_3.sce15
-rw-r--r--260/CH2/EX2.4/2_4.sce27
4 files changed, 76 insertions, 0 deletions
diff --git a/260/CH2/EX2.1/2_1.sce b/260/CH2/EX2.1/2_1.sce
new file mode 100644
index 000000000..18f449df5
--- /dev/null
+++ b/260/CH2/EX2.1/2_1.sce
@@ -0,0 +1,20 @@
+//Eg-2.1
+//pg-50
+
+clear
+clc
+close()
+
+H=[1 1/2 1/3;1/2 1/3 1/4;1/3 1/4 1/5];
+
+//two significant figures
+H_1=[1 .5 .33;.5 .33 .25;.33 .25 .2]
+Hinv1=inv(H_1);
+
+//four significant figures
+H_2=[1 .5 .3333;.5 .3333 .25;.3333 .25 .2]
+Hinv2=inv(H_2);
+
+disp("inverse matrices")
+disp(Hinv1)
+disp(Hinv2)
diff --git a/260/CH2/EX2.2/2_2.sce b/260/CH2/EX2.2/2_2.sce
new file mode 100644
index 000000000..33df1f268
--- /dev/null
+++ b/260/CH2/EX2.2/2_2.sce
@@ -0,0 +1,14 @@
+//Eg-2.2
+//pg-51
+
+clear
+clc
+close()
+
+truevalue=.69;
+operatingvalue=0.63;
+err=truevalue-operatingvalue;
+perrelerr=err/truevalue*100;
+disp("error and pecentage relative error")
+disp(err)
+disp(perrelerr) \ No newline at end of file
diff --git a/260/CH2/EX2.3/2_3.sce b/260/CH2/EX2.3/2_3.sce
new file mode 100644
index 000000000..3641ab3b7
--- /dev/null
+++ b/260/CH2/EX2.3/2_3.sce
@@ -0,0 +1,15 @@
+//Eg-2.3
+//pg-53
+
+clear
+clc
+close()
+
+a=1.234;
+b=.0005678;
+x=nearfloat("succ",a+b);
+y=double(a+b);
+
+printf('The value of sum of two numbers using float data type is ')
+disp(x)
+printf('and the one using the double precision is \n%f\n',y)
diff --git a/260/CH2/EX2.4/2_4.sce b/260/CH2/EX2.4/2_4.sce
new file mode 100644
index 000000000..63878779d
--- /dev/null
+++ b/260/CH2/EX2.4/2_4.sce
@@ -0,0 +1,27 @@
+//Eg-2.4
+//pg-55
+
+clear
+clc
+close()
+
+//exp(x) value determination
+
+//maclaurin expansion truncated after second term
+x=0.5;
+expx1=1+x;
+
+//maclaurin expansion truncated after fourth term
+expx2=1+x+x^2/2+x^3/6;
+
+//Pade approximation
+expx3=(1+2/3*x+1/6*x^2)/(1-1/3*x);
+
+//from scilab
+expx4=exp(x);
+
+disp("results")
+disp(expx1)
+disp(expx2)
+disp(expx3)
+disp(expx4) \ No newline at end of file