diff options
Diffstat (limited to '260/CH1')
-rw-r--r-- | 260/CH1/EX1.1/1_01.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.10/1_10.sce | 16 | ||||
-rw-r--r-- | 260/CH1/EX1.11/1_11.sce | 9 | ||||
-rw-r--r-- | 260/CH1/EX1.12/1_12.sce | 9 | ||||
-rw-r--r-- | 260/CH1/EX1.13/1_13.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.14/1_14.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.15/1_15.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.16/1_16.sce | 16 | ||||
-rw-r--r-- | 260/CH1/EX1.17/1_17.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.18/1_18.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.19/1_19.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.2/1_02.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.20/1_20.sce | 12 | ||||
-rw-r--r-- | 260/CH1/EX1.21/1_21.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.3/1_03.sce | 12 | ||||
-rw-r--r-- | 260/CH1/EX1.4/1_4.sce | 14 | ||||
-rw-r--r-- | 260/CH1/EX1.5/1_5.sce | 13 | ||||
-rw-r--r-- | 260/CH1/EX1.6/1_06.sce | 6 | ||||
-rw-r--r-- | 260/CH1/EX1.7/1_7.sce | 19 | ||||
-rw-r--r-- | 260/CH1/EX1.8/1_8.sce | 14 | ||||
-rw-r--r-- | 260/CH1/EX1.9/1_9.sce | 14 |
21 files changed, 208 insertions, 0 deletions
diff --git a/260/CH1/EX1.1/1_01.sce b/260/CH1/EX1.1/1_01.sce new file mode 100644 index 000000000..d74634311 --- /dev/null +++ b/260/CH1/EX1.1/1_01.sce @@ -0,0 +1,6 @@ +//Eg No. 1.1
+//Pg No. 8
+clc ;
+clear ;
+close ;
+printf('did not have a scilab analogy for the c++ code, for details go the page no. 8')
\ No newline at end of file diff --git a/260/CH1/EX1.10/1_10.sce b/260/CH1/EX1.10/1_10.sce new file mode 100644 index 000000000..2a4edfc9f --- /dev/null +++ b/260/CH1/EX1.10/1_10.sce @@ -0,0 +1,16 @@ +//Eg-1.10
+//pg-24
+
+clear
+clc
+
+a=input("enter any number");
+printf('Enter \n1 to find square root \n2 to find logarithm \n3 to find the exponential\n\n')
+choice = input("Enter your choice");
+
+select choice,
+ case 1 then r=sqrt(a);disp(r),
+ case 2 then r=log(a);disp(r),
+ case 3 then r=exp(a);disp(r),
+ else printf('Invalid Choice\n')
+end
\ No newline at end of file diff --git a/260/CH1/EX1.11/1_11.sce b/260/CH1/EX1.11/1_11.sce new file mode 100644 index 000000000..354446a77 --- /dev/null +++ b/260/CH1/EX1.11/1_11.sce @@ -0,0 +1,9 @@ +//Eg-1.11
+//pg-26
+
+clear
+clc
+
+x=input("enter any value in radians to find its sine value")
+v=sin(x);
+disp(v)
\ No newline at end of file diff --git a/260/CH1/EX1.12/1_12.sce b/260/CH1/EX1.12/1_12.sce new file mode 100644 index 000000000..012bfad15 --- /dev/null +++ b/260/CH1/EX1.12/1_12.sce @@ -0,0 +1,9 @@ +//Eg-1.12
+//pg-27
+
+clear
+clc
+
+x = input("enter any value ")
+v = exp(-(x)^2/2);
+disp(v)
\ No newline at end of file diff --git a/260/CH1/EX1.13/1_13.sce b/260/CH1/EX1.13/1_13.sce new file mode 100644 index 000000000..137a6e416 --- /dev/null +++ b/260/CH1/EX1.13/1_13.sce @@ -0,0 +1,6 @@ +//Eg No. 1.13
+//Pg No. 29
+clc ;
+clear ;
+close ;
+printf('did not have a scilab analogy for the c++ code, for details go the page no. 29')
\ No newline at end of file diff --git a/260/CH1/EX1.14/1_14.sce b/260/CH1/EX1.14/1_14.sce new file mode 100644 index 000000000..fd59a6e21 --- /dev/null +++ b/260/CH1/EX1.14/1_14.sce @@ -0,0 +1,6 @@ +//Eg No. 1.14
+//Pg No. 31
+clc ;
+clear ;
+close ;
+printf('did not have a scilab analogy for the c++ code, for details go the page no. 31')
\ No newline at end of file diff --git a/260/CH1/EX1.15/1_15.sce b/260/CH1/EX1.15/1_15.sce new file mode 100644 index 000000000..f4655f483 --- /dev/null +++ b/260/CH1/EX1.15/1_15.sce @@ -0,0 +1,6 @@ +//Eg No. 1.15
+//Pg No. 33
+clc ;
+clear ;
+close ;
+printf('did not have a scilab analogy for the c++ code, for details go the page no. 33')
\ No newline at end of file diff --git a/260/CH1/EX1.16/1_16.sce b/260/CH1/EX1.16/1_16.sce new file mode 100644 index 000000000..7cb207893 --- /dev/null +++ b/260/CH1/EX1.16/1_16.sce @@ -0,0 +1,16 @@ +//Eg-1.16
+//pg-35
+
+clear
+clc
+
+a=[0.5 0.5 -0.5;0.5 1 -1;-1 0.5 0.5];
+
+printf('The given matrix is \n\n')
+disp(a)
+
+printf('The program prints the elements of the matrix as the following\n\n')
+
+for i=1:9
+ printf("a(%d) = %f\n",i,a(i))
+end
\ No newline at end of file diff --git a/260/CH1/EX1.17/1_17.sce b/260/CH1/EX1.17/1_17.sce new file mode 100644 index 000000000..e9ab0deb5 --- /dev/null +++ b/260/CH1/EX1.17/1_17.sce @@ -0,0 +1,6 @@ +//Eg No. 1.17
+//Pg No. 36
+clc ;
+clear ;
+close ;
+printf('did not have a scilab analogy for the c++ code, for details go the page no. 36')
\ No newline at end of file diff --git a/260/CH1/EX1.18/1_18.sce b/260/CH1/EX1.18/1_18.sce new file mode 100644 index 000000000..99e11b21d --- /dev/null +++ b/260/CH1/EX1.18/1_18.sce @@ -0,0 +1,6 @@ +//Eg No. 1.18
+//Pg No. 37
+clc ;
+clear ;
+close ;
+printf('did not have a scilab analogy for the c++ code, for details go the page no. 37')
\ No newline at end of file diff --git a/260/CH1/EX1.19/1_19.sce b/260/CH1/EX1.19/1_19.sce new file mode 100644 index 000000000..2b6cbc8ab --- /dev/null +++ b/260/CH1/EX1.19/1_19.sce @@ -0,0 +1,6 @@ +//Eg No. 1.19
+//Pg No. 39
+clc ;
+clear ;
+close ;
+printf('did not have a scilab analogy for the c++ code, for details go the page no. 39')
\ No newline at end of file diff --git a/260/CH1/EX1.2/1_02.sce b/260/CH1/EX1.2/1_02.sce new file mode 100644 index 000000000..cb8cb864d --- /dev/null +++ b/260/CH1/EX1.2/1_02.sce @@ -0,0 +1,6 @@ +//Eg No. 1.2
+//Pg No. 10
+clc ;
+clear ;
+close ;
+printf('did not have a scilab analogy for the c++ code, for details go the page no. 10')
\ No newline at end of file diff --git a/260/CH1/EX1.20/1_20.sce b/260/CH1/EX1.20/1_20.sce new file mode 100644 index 000000000..603ecd34e --- /dev/null +++ b/260/CH1/EX1.20/1_20.sce @@ -0,0 +1,12 @@ +//Eg-1.20
+//pg-35
+
+clear
+clc
+
+summ=0;
+for i=1:9;
+ summ=summ+i;
+end
+disp("sum of first 9 natural no.s")
+disp(summ)
\ No newline at end of file diff --git a/260/CH1/EX1.21/1_21.sce b/260/CH1/EX1.21/1_21.sce new file mode 100644 index 000000000..56f1a1486 --- /dev/null +++ b/260/CH1/EX1.21/1_21.sce @@ -0,0 +1,6 @@ +//Eg No. 1.21
+//Pg No. 43
+clc ;
+clear ;
+close ;
+printf('did not have a scilab analogy for the c++ code, for details go the page no. 43')
\ No newline at end of file diff --git a/260/CH1/EX1.3/1_03.sce b/260/CH1/EX1.3/1_03.sce new file mode 100644 index 000000000..b6af9334c --- /dev/null +++ b/260/CH1/EX1.3/1_03.sce @@ -0,0 +1,12 @@ +//Eg No. 1.3
+//Pg No. 12
+clc ;
+clear ;
+close ;
+deff('v = f(R,T,M)','v = sqrt(8*R*T/(3.14159*M))')
+R = 8.314*(10^7)
+M = input('Enter the value of M')
+T = input ('Enter the value of T')
+v = f(R,M,T)
+disp('v = ')
+disp(v)
\ No newline at end of file diff --git a/260/CH1/EX1.4/1_4.sce b/260/CH1/EX1.4/1_4.sce new file mode 100644 index 000000000..c0469f5a5 --- /dev/null +++ b/260/CH1/EX1.4/1_4.sce @@ -0,0 +1,14 @@ +//Eg-1.4 +//pg-13 + +clear +clc + + +a=input("enter any number") +r=a-round(a/2)*2; +if r==0 then + disp("even number") +else + disp("odd number") +end
\ No newline at end of file diff --git a/260/CH1/EX1.5/1_5.sce b/260/CH1/EX1.5/1_5.sce new file mode 100644 index 000000000..ca87a6395 --- /dev/null +++ b/260/CH1/EX1.5/1_5.sce @@ -0,0 +1,13 @@ +//Eg-1.5
+//pg-16
+
+clear
+clc
+
+
+summ=0;
+for i=1:100
+ summ=summ+i^2;
+end
+disp("sum of squares of first 100 natural numbers is")
+disp(summ)
\ No newline at end of file diff --git a/260/CH1/EX1.6/1_06.sce b/260/CH1/EX1.6/1_06.sce new file mode 100644 index 000000000..cf402cab5 --- /dev/null +++ b/260/CH1/EX1.6/1_06.sce @@ -0,0 +1,6 @@ +//Example 1.6
+//Pg No. 18
+choice = 'a'
+while choice ~= 'T'
+ choice = input('Type T and press enter to terminate')
+end
\ No newline at end of file diff --git a/260/CH1/EX1.7/1_7.sce b/260/CH1/EX1.7/1_7.sce new file mode 100644 index 000000000..80b252510 --- /dev/null +++ b/260/CH1/EX1.7/1_7.sce @@ -0,0 +1,19 @@ +//Eg-1.7
+//pg-19
+
+clear
+clc
+
+
+F(1)=1;
+F(2)=1;
+eps=10^(-12);
+err=100;
+i=1;
+while err>=eps
+ F(i+2)=F(i+1)+F(i);
+ err=abs((F(i+1)/F(i+2)-(F(i)/F(i+1))));
+ i=i+1;
+ end
+goldenratio=F(i)/F(i+1);
+disp(goldenratio)
\ No newline at end of file diff --git a/260/CH1/EX1.8/1_8.sce b/260/CH1/EX1.8/1_8.sce new file mode 100644 index 000000000..d16f8cc33 --- /dev/null +++ b/260/CH1/EX1.8/1_8.sce @@ -0,0 +1,14 @@ +//Eg-1.8
+//pg-21
+
+clear
+clc
+
+a=input("enter any number")
+if a<=0 then
+ disp("logarithm cannot be computed")
+else
+ p=log(a);
+ disp("logarithm of given number is ")
+ disp(p)
+end
\ No newline at end of file diff --git a/260/CH1/EX1.9/1_9.sce b/260/CH1/EX1.9/1_9.sce new file mode 100644 index 000000000..469ce0af5 --- /dev/null +++ b/260/CH1/EX1.9/1_9.sce @@ -0,0 +1,14 @@ +//Eg-1.9
+//pg-22
+
+clear
+clc
+
+a=input("enter any number")
+if a<=0 then
+ disp("logarithm cannot be computed")
+exit(0);
+end
+ p=log(a);
+ disp("logarithm of given number is ")
+ disp(p)
|