diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /1964/CH15 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '1964/CH15')
-rwxr-xr-x | 1964/CH15/EX15.1/ex15_1.sce | 11 | ||||
-rwxr-xr-x | 1964/CH15/EX15.10/ex15_10.sce | 21 | ||||
-rwxr-xr-x | 1964/CH15/EX15.11/ex15_11.sce | 17 | ||||
-rwxr-xr-x | 1964/CH15/EX15.12/ex15_12.sce | 20 | ||||
-rwxr-xr-x | 1964/CH15/EX15.13/ex15_13.sce | 23 | ||||
-rwxr-xr-x | 1964/CH15/EX15.17/ex15_17.sce | 12 | ||||
-rwxr-xr-x | 1964/CH15/EX15.19/ex15_19.sce | 10 | ||||
-rwxr-xr-x | 1964/CH15/EX15.2/ex15_2.sce | 12 | ||||
-rwxr-xr-x | 1964/CH15/EX15.20/ex15_20.sce | 7 | ||||
-rwxr-xr-x | 1964/CH15/EX15.3/ex15_3.sce | 13 | ||||
-rwxr-xr-x | 1964/CH15/EX15.4/ex15_4.sce | 8 | ||||
-rwxr-xr-x | 1964/CH15/EX15.5/ex15_5.sce | 18 | ||||
-rwxr-xr-x | 1964/CH15/EX15.6/ex15_6.sce | 22 | ||||
-rwxr-xr-x | 1964/CH15/EX15.7/ex15_7.sce | 25 | ||||
-rwxr-xr-x | 1964/CH15/EX15.8/ex15_8.sce | 24 | ||||
-rwxr-xr-x | 1964/CH15/EX15.9/ex15_9.sce | 24 |
16 files changed, 267 insertions, 0 deletions
diff --git a/1964/CH15/EX15.1/ex15_1.sce b/1964/CH15/EX15.1/ex15_1.sce new file mode 100755 index 000000000..7b97789f4 --- /dev/null +++ b/1964/CH15/EX15.1/ex15_1.sce @@ -0,0 +1,11 @@ +//Chapter-15, Example 15.1, Page 492
+//=============================================================================
+clc
+clear
+//INPUT DATA
+x=12;//in decimal form
+//CALCULATIONS
+y=dec2oct(x);//converting to octal form
+mprintf("Thus octal number is");
+disp(y);
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.10/ex15_10.sce b/1964/CH15/EX15.10/ex15_10.sce new file mode 100755 index 000000000..fad908300 --- /dev/null +++ b/1964/CH15/EX15.10/ex15_10.sce @@ -0,0 +1,21 @@ +//Chapter-15, Example 15.10, Page 497
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+//using 1's complement method
+x1=base2dec(['1000'],2)//converting binary to decimal
+x=bin2dec('1010')
+x2=dec2bin(bitcmp(x,4))//1's complement of a number
+disp(x2)
+x3=base2dec([x2],2)
+x4=x1+x3+1;
+x5=dec2base(x4,2)//converting decimal to hexadecimal
+disp(x5)
+//using normal method
+a=base2dec(['1000','1010'],2);//converting binary to decimal
+b=a(2)-a(1);//subtraction
+c=dec2base(b,2)//converting decimal to binary
+disp(c)
+//since we cannot use dec2base for negative integers,we cannot do (a(1)-a(2)) but we can do (a(2)-a(1)),with '-' sign added before the result.hence 'c' here is actually -'c'
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.11/ex15_11.sce b/1964/CH15/EX15.11/ex15_11.sce new file mode 100755 index 000000000..b719ac2a9 --- /dev/null +++ b/1964/CH15/EX15.11/ex15_11.sce @@ -0,0 +1,17 @@ +//Chapter-15, Example 15.11, Page 500
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+x1=base2dec(['1001'],2)//converting binary to decimal
+x2=base2dec(['0100'],2)//converting binary to decimal
+x3=x1+x2;
+if(x3>9)
+ x3=x3+6;
+ z1=dec2base(x3,2)//converting decimal to binary
+else
+ z1=dec2base(x3,2)//converting decimal to binary
+end
+disp(z1)
+//note:last 4 bits represent 3 and 5th bit prefixed with 3 bits will look as 1.hence the combined result will be 13
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.12/ex15_12.sce b/1964/CH15/EX15.12/ex15_12.sce new file mode 100755 index 000000000..e980e0338 --- /dev/null +++ b/1964/CH15/EX15.12/ex15_12.sce @@ -0,0 +1,20 @@ +//Chapter-15, Example 15.12, Page 502
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+disp('given=> Y=(A+AB)')
+//given in the question//
+disp('Y=A(1+B)')//by distributive law
+disp('A.1')//by law 2
+disp('A')//by law 4
+disp('given=> Y=(A+A''B)')
+disp('(A+A'').(A+B)')//by distributive law
+disp('1.(A+B)')//by law 6
+disp('A+B')//by law 4
+disp('given=>(AB+A''C+BC)')
+disp('AB+A''C+BC(A+A'')')
+disp('AB+A''C+ABC+A''BC')
+disp('AB(1+C)+A''C(1+B)')//by consensus theorem
+disp('AB+A''C')
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.13/ex15_13.sce b/1964/CH15/EX15.13/ex15_13.sce new file mode 100755 index 000000000..d7a2d70d4 --- /dev/null +++ b/1964/CH15/EX15.13/ex15_13.sce @@ -0,0 +1,23 @@ +//Chapter-15, Example 15.13, Page 503
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+//for (a)
+disp('given=> Y=(A+AB+AB''C)')
+disp('Y=A+AB''C')//by (A+AB=A)------>step 1
+disp('A(A+B''C)')//by distributive law--------->step 2
+disp('A(1.(1+B''C))')//by talking A as common--------->step 3
+disp('A.1=A')//by 1+B''C=1--------->step 4
+//for (b)
+disp('given=> Y=(A''+B)C+ABC')
+disp('A''C+BC+ABC')//by distributive law-------->step 1
+disp('A''C+BC(1+A)')//by taking BC as common--------->step 2
+disp('A''C+BC')//by rule 2 --------->step 3
+disp('C(A''+B)')//taking C as common term-------->step 4
+//for (c)
+disp('given=> Y=(AB''BCD+AB''CDE+AC'')')
+disp('AB''CDE+AC''')//applying rules 8 and 7 to first and second terms,respectively -------->step 1
+disp('A(B''CDE+C'')')//taking A as common term--------->step 2
+disp('A(B''DE+C'')')//by applying B''CDE+C'=B'DE+C'--------->step 3
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.17/ex15_17.sce b/1964/CH15/EX15.17/ex15_17.sce new file mode 100755 index 000000000..43e13e958 --- /dev/null +++ b/1964/CH15/EX15.17/ex15_17.sce @@ -0,0 +1,12 @@ +//Chapter-15, Example 15.17, Page 513
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+disp('((((A+C''))''(BD''))''.((A+C'').(BD''))'')''')//------>step 1
+disp('((A+C'')+((BD'')'').((A+C)''+(BD'')''))''')//------>step 2
+disp('((A+C'')+(BD'')'').((A+C'')''+(BD'')'')''')//------>step 3
+disp('((BD'')''+((A+C'')((A+C''))'')''')//------>step 4
+disp('(BD'')'')''')//------>step 5
+disp('BD''')//------>step 6
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.19/ex15_19.sce b/1964/CH15/EX15.19/ex15_19.sce new file mode 100755 index 000000000..b08694ed0 --- /dev/null +++ b/1964/CH15/EX15.19/ex15_19.sce @@ -0,0 +1,10 @@ +//Chapter-15, Example 15.19, Page 519
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+//The adjacent cells that can be combined together are the cells 000 and 100 and the cell 011 and 111
+//By combining the adjacent cells,we get
+disp('((A''+A)B''C'')+(A''+A)BC)')//------>step 1
+disp('(B''C'')+(BC)')//------>step 2
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.2/ex15_2.sce b/1964/CH15/EX15.2/ex15_2.sce new file mode 100755 index 000000000..8a7c6d81f --- /dev/null +++ b/1964/CH15/EX15.2/ex15_2.sce @@ -0,0 +1,12 @@ +//Chapter-15, Example 15.2, Page 492
+//=============================================================================
+clc
+clear
+//INPUT DATA
+x1=444;//in octal form
+x2=237;//in octal form
+x3=120;//in octal form
+//CALCULATIONS
+x1=base2dec(['444','237','120'],8)//converting octal to decimal
+disp(x1);
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.20/ex15_20.sce b/1964/CH15/EX15.20/ex15_20.sce new file mode 100755 index 000000000..ada4d2872 --- /dev/null +++ b/1964/CH15/EX15.20/ex15_20.sce @@ -0,0 +1,7 @@ +//Chapter-15, Example 15.20, Page 519
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+disp('(B''C''D'')+(BC''D)')
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.3/ex15_3.sce b/1964/CH15/EX15.3/ex15_3.sce new file mode 100755 index 000000000..727e2f530 --- /dev/null +++ b/1964/CH15/EX15.3/ex15_3.sce @@ -0,0 +1,13 @@ +//Chapter-15, Example 15.3, Page 493
+//=============================================================================
+clc
+clear
+//INPUT DATA
+x1=112;//in decimal form
+x2=253;//in decimal form
+//CALCULATIONS
+y1=dec2base(x1,16)//converting decimal to hexadecimal
+y2=dec2base(x2,16)//converting decimal to hexadecimal
+disp(y1);
+disp(y2);
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.4/ex15_4.sce b/1964/CH15/EX15.4/ex15_4.sce new file mode 100755 index 000000000..00fcd8e1d --- /dev/null +++ b/1964/CH15/EX15.4/ex15_4.sce @@ -0,0 +1,8 @@ +//Chapter-15, Example 15.4, Page 494
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+x1=base2dec(['4AB','23F'],16)//converting hexadecimal to decimal
+disp(x1);
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.5/ex15_5.sce b/1964/CH15/EX15.5/ex15_5.sce new file mode 100755 index 000000000..0d16eaec2 --- /dev/null +++ b/1964/CH15/EX15.5/ex15_5.sce @@ -0,0 +1,18 @@ +//Chapter-15, Example 15.5, Page 496
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+x1=base2dec(['1101','1100'],2)//converting binary to decimal
+x2=base2dec(['1000','101'],2)//converting binary to decimal
+x3=base2dec(['1111','1001'],2)//converting binary to decimal
+y1=(x1(1))*(x1(2));//multiplying
+y2=(x2(1))*(x2(2));//multiplying
+y3=(x3(1))*(x3(2));//multiplying
+z1=dec2base(y1,2)//converting decimal to hexadecimal
+z2=dec2base(y2,2)//converting decimal to hexadecimal
+z3=dec2base(y3,2)//converting decimal to hexadecimal
+disp(z1)
+disp(z2)
+disp(z3)
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.6/ex15_6.sce b/1964/CH15/EX15.6/ex15_6.sce new file mode 100755 index 000000000..f35878ce1 --- /dev/null +++ b/1964/CH15/EX15.6/ex15_6.sce @@ -0,0 +1,22 @@ +//Chapter-15, Example 15.6, Page 497
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+x1=base2dec(['110','10'],2)//converting binary to decimal
+x2=base2dec(['1111','110'],2)//converting binary to decimal
+y1=(x1(1))/(x1(2));//dividing
+y2=(x2(1))/(x2(2));//dividing
+z1=dec2base(y1,2);//converting decimal to binary
+[f,e]=frexp(y2);//separting exponent and mantissa
+disp(f)//mantissa
+disp(e)//exponent
+f=f*2;
+g=floor(f);//rounding to nearest integer
+disp(g);
+z2=dec2base(e,2);//converting decimal to binary--------->before point part of resultant binary number
+disp(z2)
+g1=dec2base(g,2);//converting decimal to binary--------->after point part of resultant binary number
+disp(g1)
+//NOTE:here floating point decimal cannot be directly converted to binary for second case.Hence computed to binary
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.7/ex15_7.sce b/1964/CH15/EX15.7/ex15_7.sce new file mode 100755 index 000000000..2639010fc --- /dev/null +++ b/1964/CH15/EX15.7/ex15_7.sce @@ -0,0 +1,25 @@ +//Chapter-15, Example 15.7, Page 497
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+//using 1's complement method
+x1=base2dec(['1111'],2)//converting binary to decimal
+x=bin2dec('1010')
+x2=dec2bin(bitcmp(x,4))//1's complement of a number
+disp(x2)
+x3=base2dec([x2],2)
+x4=x1+x3;
+x5=dec2base(x4,2)//converting decimal to hexadecimal
+disp(x5)
+y=15;
+z=bitand(x4,y);//eliminating carry
+z1=bitset(z,1);//setting 1st bit t0 1
+z2=dec2base(z1,2)//converting decimal to binary
+disp(z2)
+//using normal method
+a=base2dec(['1111','1010'],2);//converting binary to decimal
+b=a(1)-a(2);//subtraction
+c=dec2base(b,2)//converting decimal to binary
+disp(c)
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.8/ex15_8.sce b/1964/CH15/EX15.8/ex15_8.sce new file mode 100755 index 000000000..d8c7b0f54 --- /dev/null +++ b/1964/CH15/EX15.8/ex15_8.sce @@ -0,0 +1,24 @@ +//Chapter-15, Example 15.8, Page 498
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+//using 1's complement method
+x1=base2dec(['1000'],2)//converting binary to decimal
+x=bin2dec('1010')
+x2=dec2bin(bitcmp(x,4))//1's complement of a number
+disp(x2)
+x3=base2dec([x2],2)
+x4=x1+x3;
+x5=dec2base(x4,2)//converting decimal to hexadecimal
+disp(x5)
+y=15;
+z=bitand(x4,y);//eliminating carry
+z2=dec2base(z,2)//converting decimal to binary
+disp(z2)
+//using normal method
+a=base2dec(['1000','1010'],2);//converting binary to decimal
+b=a(2)-a(1);//subtraction
+c=dec2base(b,2)//converting decimal to binary
+disp(c);//since we cannot use dec2base for negative integers,we cannot do (a(1)-a(2)) but we can do (a(2)-a(1)),with '-' sign added before the result.hence 'c' here is actually -'c'
+//=================================END OF PROGRAM=======================================================================================================
diff --git a/1964/CH15/EX15.9/ex15_9.sce b/1964/CH15/EX15.9/ex15_9.sce new file mode 100755 index 000000000..8595d2df4 --- /dev/null +++ b/1964/CH15/EX15.9/ex15_9.sce @@ -0,0 +1,24 @@ +//Chapter-15, Example 15.9, Page 497
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+//using 1's complement method
+x1=base2dec(['1111'],2)//converting binary to decimal
+x=bin2dec('1010')
+x2=dec2bin(bitcmp(x,4))//1's complement of a number
+disp(x2)
+x3=base2dec([x2],2)
+x4=x1+x3+1;
+x5=dec2base(x4,2)//converting decimal to hexadecimal
+disp(x5)
+y=15;
+z=bitand(x4,y);//eliminating carry
+z2=dec2base(z,2)//converting decimal to binary
+disp(z2)
+//using normal method
+a=base2dec(['1111','1010'],2);//converting binary to decimal
+b=a(1)-a(2);//subtraction
+c=dec2base(b,2)//converting decimal to binary
+disp(c)
+//=================================END OF PROGRAM=======================================================================================================
|