summaryrefslogtreecommitdiff
path: root/48
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /48
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 '48')
-rwxr-xr-x48/CH1/EX1.1/eg_1_1.sce41
-rwxr-xr-x48/CH1/EX1.10/eg_1_10.sce10
-rwxr-xr-x48/CH1/EX1.2/eg_1_2.sce37
-rwxr-xr-x48/CH1/EX1.3/eg_1_3.sce35
-rwxr-xr-x48/CH1/EX1.4/eg_1_4.sce20
-rwxr-xr-x48/CH1/EX1.5/eg_1_5.sce40
-rwxr-xr-x48/CH1/EX1.6/eg_1_6.sce87
-rwxr-xr-x48/CH1/EX1.7/eg_1_7.sce9
-rwxr-xr-x48/CH1/EX1.8/eg_1_8.sce9
-rwxr-xr-x48/CH1/EX1.9/eg_1_9.sce9
-rwxr-xr-x48/CH10/EX10.1/eg_10_1.sce33
-rwxr-xr-x48/CH10/EX10.2/eg_10_2.sce7
-rwxr-xr-x48/CH12/EX12.10/eg_12_10.sce6
-rwxr-xr-x48/CH12/EX12.11/eg_12_11.sce7
-rwxr-xr-x48/CH12/EX12.12/eg_12_12.sce21
-rwxr-xr-x48/CH12/EX12.14/eg_12_14.sce26
-rwxr-xr-x48/CH12/EX12.4/eg_12_4.sce23
-rwxr-xr-x48/CH12/EX12.5/eg_12_5.sce14
-rwxr-xr-x48/CH12/EX12.7/eg_12_7.sce7
-rwxr-xr-x48/CH12/EX12.8/eg_12_8.sce9
-rwxr-xr-x48/CH12/EX12.9/eg_12_9.sce11
-rwxr-xr-x48/CH13/EX13.1/eg_13_1.sce23
-rwxr-xr-x48/CH14/EX14.2/eg_14_2.sce50
-rwxr-xr-x48/CH14/EX14.3/eg_14_3.sce105
-rwxr-xr-x48/CH14/EX14.4/eg_14_4.sce22
-rwxr-xr-x48/CH14/EX14.6/eg_14_6.sce32
-rwxr-xr-x48/CH14/EX16.7/eg_14_7.sce26
-rwxr-xr-x48/CH15/EX15.10/eg_15_10.sce16
-rwxr-xr-x48/CH15/EX15.11/eg_15_11.sce25
-rwxr-xr-x48/CH15/EX15.12/eg_15_12.sce29
-rwxr-xr-x48/CH15/EX15.15/eg_15_15.sce18
-rwxr-xr-x48/CH15/EX15.16/eg_15_16.sce44
-rwxr-xr-x48/CH15/EX15.17/eg_15_17.sce18
-rwxr-xr-x48/CH15/EX15.3/eg_15_3.sce30
-rwxr-xr-x48/CH15/EX15.4/eg_15_4.sce23
-rwxr-xr-x48/CH15/EX15.5/eg_15_5.sce23
-rwxr-xr-x48/CH15/EX15.6/eg_15_6.sce24
-rwxr-xr-x48/CH16/EX16.2/eg_16_2.sce9
-rwxr-xr-x48/CH16/EX16.3/eg_16_3.sce10
-rwxr-xr-x48/CH2/EX2.1/eg_2_1.sce22
-rwxr-xr-x48/CH2/EX2.11/eg_2_11.sce23
-rwxr-xr-x48/CH2/EX2.12/eg_2_12.sce34
-rwxr-xr-x48/CH2/EX2.15/eg_2_15.sce31
-rwxr-xr-x48/CH2/EX2.16/eg_2_16.sce12
-rwxr-xr-x48/CH2/EX2.2/eg_2_2.sce85
-rwxr-xr-x48/CH2/EX2.4/eg_2_4.sce25
-rwxr-xr-x48/CH2/EX2.5/eg_2_5.sce61
-rwxr-xr-x48/CH2/EX2.6/eg_2_6.sce34
-rwxr-xr-x48/CH2/EX2.7/eg_2_7.sce31
-rwxr-xr-x48/CH3/EX3.1/eg_1.sce13
-rwxr-xr-x48/CH3/EX3.10/eg_3_10.sce34
-rwxr-xr-x48/CH3/EX3.11/eg_3_11.sce16
-rwxr-xr-x48/CH3/EX3.12/eg_3_12.sce5
-rwxr-xr-x48/CH3/EX3.13/eg_3_13.sce22
-rwxr-xr-x48/CH3/EX3.14/eg_3_14.sce35
-rwxr-xr-x48/CH3/EX3.2/eg_3_2.sce16
-rwxr-xr-x48/CH3/EX3.3/eg_3_3.sce14
-rwxr-xr-x48/CH3/EX3.4/eg_3_4.sce23
-rwxr-xr-x48/CH3/EX3.5/eg_3_5.sce11
-rwxr-xr-x48/CH3/EX3.6/eg_3_6.sce13
-rwxr-xr-x48/CH3/EX3.7/eg_3_7.sce7
-rwxr-xr-x48/CH3/EX3.8/eg_3_8.sce10
-rwxr-xr-x48/CH3/EX3.9/eg_3_9.sce6
-rwxr-xr-x48/CH4/EX4.1/eg_4_1.sce286
-rwxr-xr-x48/CH4/EX4.10/eg_4_10.sce4
-rwxr-xr-x48/CH4/EX4.2/eg_4_2.sce284
-rwxr-xr-x48/CH4/EX4.3/eg_4_3.sce288
-rwxr-xr-x48/CH4/EX4.4/eg_4_4.sce34
-rwxr-xr-x48/CH4/EX4.5/eg_4_5.sce608
-rwxr-xr-x48/CH4/EX4.6/eg_4_6.sce38
-rwxr-xr-x48/CH4/EX4.7/eg_4_7.sce5
-rwxr-xr-x48/CH4/EX4.8/eg_4_8.sce8
-rwxr-xr-x48/CH4/EX4.9/eg_4_9.sce7
-rwxr-xr-x48/CH5/EX5.1/eg_5_1.sce27
-rwxr-xr-x48/CH5/EX5.2/eg_5_2.sce30
-rwxr-xr-x48/CH5/EX5.3/eg_5_3.sce32
-rwxr-xr-x48/CH5/EX5.4/eg_5_4.sce33
-rwxr-xr-x48/CH5/EX5.5/eg_5_5.sce9
-rwxr-xr-x48/CH6/EX6.1/eg_6_1.sce8
-rwxr-xr-x48/CH6/EX6.3/eg_6_3.sce50
-rwxr-xr-x48/CH6/EX6.6/eg_6_6.sce8
-rwxr-xr-x48/CH6/EX6.7/eg_6_7.sce8
-rwxr-xr-x48/CH7/EX7.1/eg_7_1.sce45
-rwxr-xr-x48/CH7/EX7.2/eg_7_2.sce53
-rwxr-xr-x48/CH7/EX7.3/eg_7_3.sce6
-rwxr-xr-x48/CH7/EX7.4/eg_7_4.sce5
-rwxr-xr-x48/CH7/EX7.5/eg_7_5.sce22
-rwxr-xr-x48/CH8/EX8.1/eg_8_1.sce17
-rwxr-xr-x48/CH8/EX8.2/eg_8_2.sce11
-rwxr-xr-x48/CH8/EX8.3/eg_8_3.sce8
-rwxr-xr-x48/CH8/EX8.4/eg_8_4.sce9
-rwxr-xr-x48/DEPENDENCIES/bin21dec.sci46
-rwxr-xr-x48/DEPENDENCIES/check.sci9
-rwxr-xr-x48/DEPENDENCIES/dec21bin.sci40
-rwxr-xr-x48/DEPENDENCIES/donkmap.sci282
-rwxr-xr-x48/DEPENDENCIES/karmap.sci276
-rwxr-xr-x48/DEPENDENCIES/karmap1.sci275
-rwxr-xr-x48/DEPENDENCIES/karmap3.sci148
-rwxr-xr-x48/DEPENDENCIES/noof3.sci13
-rwxr-xr-x48/DEPENDENCIES/number_of.sci11
100 files changed, 4614 insertions, 0 deletions
diff --git a/48/CH1/EX1.1/eg_1_1.sce b/48/CH1/EX1.1/eg_1_1.sce
new file mode 100755
index 000000000..70ae10166
--- /dev/null
+++ b/48/CH1/EX1.1/eg_1_1.sce
@@ -0,0 +1,41 @@
+clc //clears the command window
+clear//clears all the variables
+
+i=1;w=1;//flags
+
+bin=432.2//given octal number which should be expressed in base 10
+temp1=floor(bin);//separating integer part from the given number
+temp2=modulo(bin,1);//separating decimal part from the given number
+temp2=temp2*10^3;//converting decimal value to interger for convenience
+while(temp1>0)//storing each integer digit in vector for convenience
+ p(i)=modulo(temp1,10);
+ temp1=round(temp1/10);
+ i=i+1;
+end
+while(temp2>0)//storing each decimal digit in vector for convenience
+ q(w)=modulo(temp2,10);
+ temp2=(temp2/10);
+ temp2=round(temp2);
+ w=w+1;
+end
+temp1=0;//clearing temporary variable 'temp1'
+for i=1:length(p)//checking whether it is a binary number or not
+ if(p(i)>8) then
+ disp('not a binary number');
+ abort;
+ end
+end
+
+for i=1:length(p)//multipliying the bits of integer part with their position values and adding
+ temp1=temp1+(p(i)*8^(i-1));
+end
+
+temp2=0;//flag bit
+
+for z=1:length(q)
+//multipliying the bits of decimal part with their position values and adding
+ temp2=temp2+(q(z)*8^(-1*(4-z)));
+end
+temp=temp1+temp2;
+//finally adding both the integer and decimal parts to get total output.
+disp(temp);//displaying the output \ No newline at end of file
diff --git a/48/CH1/EX1.10/eg_1_10.sce b/48/CH1/EX1.10/eg_1_10.sce
new file mode 100755
index 000000000..27bbfd166
--- /dev/null
+++ b/48/CH1/EX1.10/eg_1_10.sce
@@ -0,0 +1,10 @@
+clc;
+format('v',8);//changing the default precision to 8
+a=1000100110;//first number
+b=11001;//second number
+A=bin21dec(a);//converting a in to decimal number
+B=bin21dec(b);//converting b in to decimal number
+S=A/B; //multiply the two decimal numbers
+temp=dec21bin(S);//converting the decimal product back to binary
+disp("quotient");
+disp(temp);//displaying the final output \ No newline at end of file
diff --git a/48/CH1/EX1.2/eg_1_2.sce b/48/CH1/EX1.2/eg_1_2.sce
new file mode 100755
index 000000000..5f876c250
--- /dev/null
+++ b/48/CH1/EX1.2/eg_1_2.sce
@@ -0,0 +1,37 @@
+clc;//clears the command window
+clear;//clears all the variables
+i=1;w=1;
+bin=1101.01;//Given binary number which we need to be convert into decimal
+temp1=floor(bin);//separating integer part from the given number
+temp2=modulo(bin,1);//separating decimal part from the given number
+temp2=temp2*10^3;//converting decimal value to interger for convenience
+while(temp1>0)//storing each integer digit in vector for convenience
+ p(i)=modulo(temp1,10);
+ temp1=floor(temp1/10);
+ i=i+1;
+end
+while(temp2>0)//storing each decimal digit in vector for convenience
+ q(w)=modulo(temp2,2);
+ temp2=(temp2/10);
+ temp2=floor(temp2);
+ w=w+1;
+end
+temp1=0;//flag bit
+for i=1:length(p)//checking whether it is a binary number or not
+ if(p(i)>1) then
+ disp('not a binary number');
+ abort;
+ end
+end
+for i=1:length(p)
+//multipliying bits of integer part with their position values and adding
+ temp1=temp1+(p(i)*2^(i-1));
+end
+temp2=0;//flag bit
+for z=1:length(q)
+//multipliying bits of decimal part with their position values and adding
+ temp2=temp2+(q(z)*2^(-1*(4-z)));
+end
+temp=temp1+temp2;
+//finally adding both the integer and decimal parts to get total output.
+disp(temp);//displaying the output
diff --git a/48/CH1/EX1.3/eg_1_3.sce b/48/CH1/EX1.3/eg_1_3.sce
new file mode 100755
index 000000000..853fc513d
--- /dev/null
+++ b/48/CH1/EX1.3/eg_1_3.sce
@@ -0,0 +1,35 @@
+clc;//clears the command window
+clear;//clears all the variables
+format('v',8);//making the default precision to 8 significant digits
+i=1;
+dec=548;//given decimal number which should be expressed in base 8
+temp=dec;
+i=1;
+d=8;
+while(temp>0)//storing each integer digit in vector for convenience
+ p(i)=(modulo(floor(temp),d))
+ temp=floor(temp)/d;
+ i=i+1;
+end
+temp2=0;
+for j=1:length(p)
+//multipliying bits of integer part with their position values and adding
+ temp2=temp2+(p(j)*10^(j-1));
+end
+disp(temp2,"Octal number");
+dec=345;
+//given decimal number which should be expressed in base 8
+temp=dec;
+i=1;
+d=6;
+while(temp>0)//storing each integer digit in vector for convenience
+ p(i)=(modulo(floor(temp),d))
+ temp=floor(temp)/d;
+ i=i+1;
+end
+temp2=0;
+for j=1:length(p)
+//multipliying bits of integer part with their position values and adding
+ temp2=temp2+(p(j)*10^(j-1));
+end
+disp(temp2,"Base 6"); \ No newline at end of file
diff --git a/48/CH1/EX1.4/eg_1_4.sce b/48/CH1/EX1.4/eg_1_4.sce
new file mode 100755
index 000000000..d2fd429f5
--- /dev/null
+++ b/48/CH1/EX1.4/eg_1_4.sce
@@ -0,0 +1,20 @@
+clc;//clears the command window
+clear;//clears all the variables
+format('v',8);//making the default precision to 8 significant digits
+i=1;
+dec=0.3125;//given decimal number which should be expressed in base 8
+temp=modulo(0.3125,1);//separating decimal part from the given number
+
+while(temp~=0) //storing each decimal digit in vector for convenience
+ temp=temp*8;
+ p(i)=floor(temp);
+ i=i+1;
+ temp=modulo(temp,1);
+end
+
+temp1=0; //flag bit
+for j=1:length(p)
+//multipliying bits of decimal part with their position values and adding
+ temp1=temp1+(10^(-1*j)*p(j))
+end
+disp(temp1);//displays the final output \ No newline at end of file
diff --git a/48/CH1/EX1.5/eg_1_5.sce b/48/CH1/EX1.5/eg_1_5.sce
new file mode 100755
index 000000000..8a51aa6ea
--- /dev/null
+++ b/48/CH1/EX1.5/eg_1_5.sce
@@ -0,0 +1,40 @@
+clc;//clears the command window
+clear;//clears all the variables
+format('v',18);//changing the default prcision to 20 significant digits
+
+i=1;x=1;//flag bits
+
+dec=432.354;//given decimal number which should be expressed in base 2
+temp2=floor(dec);//separating integer part from the given number
+temp4=modulo(dec,1);//separating decimal part from the given number
+
+while(temp2>0)//storing each integer digit in vector for convenience
+ p(i)=(modulo(floor(temp2),2))
+ temp2=floor(temp2)/2;
+ i=i+1;
+end
+
+temp2=0;//clearing temporary variable 'temp2'
+
+for j=1:length(p)
+//multipliying bits of integer part with their position values and adding
+ temp2=temp2+(p(j)*10^(j-1));
+end
+
+while(temp4~=0) //storing each decimal digit in vector for convenience
+ temp4=temp4*2;
+ d(x)=floor(temp4);
+ x=x+1;
+ temp4=modulo(temp4,1);
+end
+
+temp5=0; //clearing temporary variable 'temp5'
+
+for j=1:length(d)
+//multipliying bits of decimal part with their position values and adding
+ temp5=temp5+(10^(-1*j)*d(j))
+end
+
+temp3=temp2+temp5;
+//finally adding both the integer and decimal parts to get total output.
+disp(temp3);//displays output \ No newline at end of file
diff --git a/48/CH1/EX1.6/eg_1_6.sce b/48/CH1/EX1.6/eg_1_6.sce
new file mode 100755
index 000000000..e187bd410
--- /dev/null
+++ b/48/CH1/EX1.6/eg_1_6.sce
@@ -0,0 +1,87 @@
+clc;//clears the command window
+clear;//clears all the variables
+format('v',8);//setting the default precision to 8
+
+i=1;w=1;
+
+bin=123.4; //Given octal number which we need to be convert into binary
+temp1=floor(bin);//separating integer part from the given number
+temp2=modulo(bin,1);//separating decimal part from the given number
+temp2=temp2*10^3;//converting decimal value to interger for convenience
+
+while(temp1>0) //storing each integer digit in vector for convenience
+ p(i)=modulo(temp1,10);
+ temp1=round(temp1/10);
+ i=i+1;
+end
+
+while(temp2>0) //storing each decimal digit in vector for convenience
+ q(w)=modulo(temp2,10);
+ temp2=(temp2/10);
+ temp2=round(temp2);
+ w=w+1;
+end
+
+temp1=0; //clearing temporary variable 'temp1'
+
+for i=1:length(p) //checking whether it is a binary number or not
+ if(p(i)>8) then
+ disp('not a binary number');
+ abort;
+ end
+end
+
+for i=1:length(p)
+//multipliying bits of decimal part with their position values and adding
+ temp1=temp1+(p(i)*8^(i-1));
+end
+
+temp2=0;//clearing temporary variable 'temp2'
+
+for z=1:length(q)
+//multipliying bits of decimal part with their position values and adding
+ temp2=temp2+(q(z)*8^(-1*(4-z)));
+end
+
+temp=temp1+temp2;
+//adding both integer and decimal parts to get total deciaml value.
+dec=temp;
+
+temp2=floor(dec); //separating integer part from the given number
+temp3=modulo(dec,1);//separating decimal part from the given number
+format('v',18);//setting the default precision to 8
+
+i=1;x=1;//flag bits
+
+while(temp2>0)//storing each integer digit in vector for convenience
+ p(i)=(modulo(floor(temp2),2))
+ temp2=floor(temp2)/2;
+ i=i+1;
+end
+
+temp2=0; //clears temporary variable 'temp2'
+
+for j=1:length(p)
+//multipliying bits of integer part with their position values and adding
+ temp2=temp2+(p(j)*10^(j-1));
+end
+
+temp4=modulo(temp3,1);
+
+while(temp4~=0)//storing each decimal digit in vector for convenience
+ temp4=temp4*2;
+ d(x)=floor(temp4);
+ x=x+1;
+ temp4=modulo(temp4,1);
+end
+
+temp5=0; //clears temporary variable 'temp2'
+
+for j=1:length(d)
+//multipliying bits of decimal part with their position values and adding
+ temp5=temp5+(10^(-1*j)*d(j))
+end
+
+temp=temp2+temp5;
+//finally adding both the integer and decimal parts to get total output.
+disp(temp);//displaying the output \ No newline at end of file
diff --git a/48/CH1/EX1.7/eg_1_7.sce b/48/CH1/EX1.7/eg_1_7.sce
new file mode 100755
index 000000000..1ca84a0c6
--- /dev/null
+++ b/48/CH1/EX1.7/eg_1_7.sce
@@ -0,0 +1,9 @@
+clc;
+a=0111.10; //first number
+b=1111.01; //second number
+A=bin21dec(a); //converting a in to decimal number
+B=bin21dec(b); //converting b in to decimal number
+S=A+B; //adding the two decimal numbers
+temp=dec21bin(S); //converting the decimal sum back to binary
+format('v',10); //changing the default precision to 8
+disp(temp); //displaying the final output \ No newline at end of file
diff --git a/48/CH1/EX1.8/eg_1_8.sce b/48/CH1/EX1.8/eg_1_8.sce
new file mode 100755
index 000000000..57a88e9da
--- /dev/null
+++ b/48/CH1/EX1.8/eg_1_8.sce
@@ -0,0 +1,9 @@
+clc;
+format('v',8); //changing the default precision to 8
+a=10010.11; //first number
+b=01100.10; //second number
+A=bin21dec(a); //converting a in to decimal number
+B=bin21dec(b); //converting b in to decimal number
+S=A-B; //subtracting the two decimal numbers
+temp=dec21bin(S); //converting the decimal number back to binary
+disp(temp); //displaying the final output \ No newline at end of file
diff --git a/48/CH1/EX1.9/eg_1_9.sce b/48/CH1/EX1.9/eg_1_9.sce
new file mode 100755
index 000000000..84549d6ee
--- /dev/null
+++ b/48/CH1/EX1.9/eg_1_9.sce
@@ -0,0 +1,9 @@
+clc;
+format('v',8); //changing the default precision to 8
+a=11001.1; //first number
+b=110.1; //second number
+A=bin21dec(a); //converting a in to decimal number
+B=bin21dec(b); //converting b in to decimal number
+S=A*B; //multiply the two decimal numbers
+temp=dec21bin(S); //converting the decimal product back to binary
+disp(temp); //displaying the final output \ No newline at end of file
diff --git a/48/CH10/EX10.1/eg_10_1.sce b/48/CH10/EX10.1/eg_10_1.sce
new file mode 100755
index 000000000..f9ef40593
--- /dev/null
+++ b/48/CH10/EX10.1/eg_10_1.sce
@@ -0,0 +1,33 @@
+clc;
+clear;
+disp(" ... NS ");
+disp(" PS x=0 x=1 ");
+disp(" A E,0 C,0 ");
+disp(" B C,0 A,0 ");
+disp(" C B,0 G,0 ");
+disp(" D G,0 A,0 ");
+disp(" E F,1 B,0 ");
+disp(" F E,0 D,0 ");
+disp(" G D,0 G,0 ");
+disp("Initial partition consists of all the states");
+disp("P0=(ABCDEFG)");
+disp("Since E only has 1 equivalent different from others,it can be partitioned from others");
+disp("P1=(ABCDFG)E");
+disp("now check for 2-equivalent i.e. 1-equivalent and their Ii succesors for all possible Ii are also 1 equivalent");
+disp("A,F dont satisfy the 2-equivalent so they can be partitioned from others");
+disp("P2=(AF)(BCDG)E");
+disp("In the similar manner P3 can be obtained by splitting BD and CG since they dont have the same 3 equivalent");
+disp("P3=(AF)(BD)(CG)E");
+disp("In the same way P4 can be obtained by splitting A and F");
+disp("P4=(A)(F)(BD)(CG)E");
+disp("P4 cant be splitted more so P5 will be the same and the partition stops");
+disp("P5=(A)(F)(BD)(CG)(E)");
+disp("so the reduced machine is");
+disp(" ... NS ");
+disp(" .. PS x=0 x=1 ");
+disp(" A----a e,0 c,0 ");
+disp(" F----f e,0 b,0 ");
+disp(" .(BD)--b c,0 a,0 ");
+disp(" (CG)--c b,0 c,0 ");
+disp(" E----e f,1 b,0 ");
+
diff --git a/48/CH10/EX10.2/eg_10_2.sce b/48/CH10/EX10.2/eg_10_2.sce
new file mode 100755
index 000000000..2b9759589
--- /dev/null
+++ b/48/CH10/EX10.2/eg_10_2.sce
@@ -0,0 +1,7 @@
+clc;
+clear;
+disp("Considering the merger graph of machine M6 in PG 339");
+disp("A set of compaitabilities is said to be closed if and only if for every compaitable contained in the set and all its implied compaitabilities are also in the same set");
+disp("A closed set of compaitables which contains all the states of M is called a closed covering");
+disp("By observing the merger graph we can find that {(AD)(BE)(CD)} is a closed set ");
+disp("And the set {(AB)(CD)(EF)} appears to be a closed covering"); \ No newline at end of file
diff --git a/48/CH12/EX12.10/eg_12_10.sce b/48/CH12/EX12.10/eg_12_10.sce
new file mode 100755
index 000000000..96e782628
--- /dev/null
+++ b/48/CH12/EX12.10/eg_12_10.sce
@@ -0,0 +1,6 @@
+clc;
+clear;
+disp("Partition pi of the machine M5 is {(AB),(CD),(EF)}");
+disp("If M5 posses a closed partition pi such that pi>λi .if the autonomous clock has #pi states the period p will be less than or equal to #pi ");
+disp("since in the above closed partition of M5 we have 3 states i.e. (AB) as one state and (CD) and (EF) as other two");
+disp("So the periodof the autonomous clock is p=3") \ No newline at end of file
diff --git a/48/CH12/EX12.11/eg_12_11.sce b/48/CH12/EX12.11/eg_12_11.sce
new file mode 100755
index 000000000..200e07ef6
--- /dev/null
+++ b/48/CH12/EX12.11/eg_12_11.sce
@@ -0,0 +1,7 @@
+clc;
+clear
+disp("From the definition of partition pair(T,T^)which is an ordered pair of partitions such that if Si and Sj are in the same block of t, then for every input Ik in I, next states are in the same block of T^ ");
+disp("By applying the above definition we can obtain the following partition pairs");
+disp("(pi1,pi1^)=({(ABC),(DEF)},{(ABC),(DEF)})");
+disp("(t1,t1^)=({(ABCD),(EF)},{(AE),(BCDF)})");
+disp("(t2,t2^)=({(AE),(BCDF)},{(ACDE),(BF)})"); \ No newline at end of file
diff --git a/48/CH12/EX12.12/eg_12_12.sce b/48/CH12/EX12.12/eg_12_12.sce
new file mode 100755
index 000000000..f2082d374
--- /dev/null
+++ b/48/CH12/EX12.12/eg_12_12.sce
@@ -0,0 +1,21 @@
+clc;
+clear;
+//1 is equivalent to A ad 2 to B and so on.
+p1=['A' 'D']; //pairs in partition t(1 and 4 represents that 1st and 4th state are in the same block);
+p2=['C' 'E'];
+
+q1=['A' 'E']; //pairs in partition t^
+q2=['B' 'D'];
+q3=['C' 'F'];
+
+disp("the following are the partitions of the machine M8");
+disp("T");
+disp('F',p2(2),p2(1),'B',p1);
+disp("T^");
+disp(q3,q2,q1);
+disp("------");
+disp("T");
+disp('F',p2,'B',p1);
+disp("T^");
+disp(q3,[q1 q2]);
+disp("------"); \ No newline at end of file
diff --git a/48/CH12/EX12.14/eg_12_14.sce b/48/CH12/EX12.14/eg_12_14.sce
new file mode 100755
index 000000000..2b2bcac77
--- /dev/null
+++ b/48/CH12/EX12.14/eg_12_14.sce
@@ -0,0 +1,26 @@
+clc;
+clear;
+//assume the first cloumn values are of machine M1 and 2nd column are of M2
+p=[1,1;1 3;2 2;2 4;3 3;3 1;4 4;4 2];
+z=1;
+for i=1:length(p(:,1))
+ for j=i:length(p(:,1))
+ if(p(i,1)==p(j,1) & i~=j)
+ q(z,:)=[p(i,:) p(j,:)];
+ z=z+1;
+ end
+ end
+end
+disp("pi(R)");
+disp(q);
+z=1;
+for i=1:length(p(:,1))
+ for j=i:length(p(:,1))
+ if(p(i,2)==p(j,2) & i~=j)
+ q(z,:)=[p(i,:) p(j,:)];
+ z=z+1;
+ end
+ end
+end
+disp("pi(S)");
+disp(q); \ No newline at end of file
diff --git a/48/CH12/EX12.4/eg_12_4.sce b/48/CH12/EX12.4/eg_12_4.sce
new file mode 100755
index 000000000..5cc873342
--- /dev/null
+++ b/48/CH12/EX12.4/eg_12_4.sce
@@ -0,0 +1,23 @@
+clc;
+clear;
+disp("we know that a partition pi on the set of states of a Sequential machine M is said to be closed if,for every two states Si and Sj which are in the same block of pi and any Ith input successor of Si and Sj are also in the same group");
+disp("Based on the above definition we can make seven closed partitions as below");
+disp("**Parition 1**");
+disp("{A,B,C,D,E,F,G,H}")
+disp("**Parition 1**");
+disp("{(ABCD)(EFGH)}");
+disp("**Parition 2**");
+disp("{(ADEH)(BCFG)}")
+disp("**Parition 3**");
+disp("{(AD)(BCFG)(EH)}");
+disp("**Parition 4**");
+disp("{(ADEH)(BC)(FG)}")
+disp("**Parition 5**");
+disp("{(AD)(BC)(EH)(FG)}")
+disp("**Parition 6**");
+disp("{(ABCCDEFGH)}");
+disp("By assigning values from 000 to 111 to all the states from A to H and obtaining the functions for Y1,Y2,Y3 and z will result in this equations");
+disp("Y1=x^y1^");
+disp("Y2=x^y2+xy2^");
+disp("Y3=xy2+x^y1^y2y3^+y3^y2^y3+y1y2y3+x^y1y2^y3^");
+disp("z=y1^y2^y3"); \ No newline at end of file
diff --git a/48/CH12/EX12.5/eg_12_5.sce b/48/CH12/EX12.5/eg_12_5.sce
new file mode 100755
index 000000000..d137fbed7
--- /dev/null
+++ b/48/CH12/EX12.5/eg_12_5.sce
@@ -0,0 +1,14 @@
+clc;
+clear;
+disp("For the 4 state machine M4 in PG 397");
+disp("IF the four states A,B,C,D are assigned as 00,01,10,11(ta={(AC)(BD)}) and 00,01,11,10(tb={(AD)(BC)})");
+disp("And if the output,next state functions of both the assignments are calculated we can find that ");
+disp("For first assignment ");
+disp("Y1=x^y1+xy1^");
+disp("Y2=x^y2^+y1^y2^+xy1y2");
+disp("z=x^y1^y2^+x^y1y2+xy1^y2+xy1y2^");
+disp("Second Assignment ");
+disp("Y1=x^y1+x^y1");
+disp("Y2=x^y2^+xy1^y2+y1y2^");
+disp("z=x^y2^+xy2");
+disp("Since the second assignment results in reduced output expression this partition is called as output-consistent partition") \ No newline at end of file
diff --git a/48/CH12/EX12.7/eg_12_7.sce b/48/CH12/EX12.7/eg_12_7.sce
new file mode 100755
index 000000000..a1fc60df4
--- /dev/null
+++ b/48/CH12/EX12.7/eg_12_7.sce
@@ -0,0 +1,7 @@
+clc;
+clear;
+disp("A partition pi0 on the states of a machine M is said to be output consistent if for every block pi0 and every input,all the states contained in the block have the same outputs");
+disp("Considering the above definition It can be understood that");
+disp("pi0={(AD),(BC)} is an output consistent partition of machine M4");
+disp("since the outputs of A,D states for any inputs are same and similarly the outputs of B,C are same.");
+disp("So the partition {(AD),(BC)} are said to be output consistent"); \ No newline at end of file
diff --git a/48/CH12/EX12.8/eg_12_8.sce b/48/CH12/EX12.8/eg_12_8.sce
new file mode 100755
index 000000000..9ac7518d2
--- /dev/null
+++ b/48/CH12/EX12.8/eg_12_8.sce
@@ -0,0 +1,9 @@
+clc;
+clear;
+disp("For the Machine M5 in PG 400");
+disp("State A implies the identification of states C and D");
+disp("similarly C implies the identification of E and F states");
+disp("In the same way C implies the identification of A and B");
+disp("Thus the smallest input consistent partition for M5 is ");
+disp("pi={(AB),(CD),(EF)}");
+disp("Any other partition that contains pi is also input consistent") \ No newline at end of file
diff --git a/48/CH12/EX12.9/eg_12_9.sce b/48/CH12/EX12.9/eg_12_9.sce
new file mode 100755
index 000000000..91a7fdc31
--- /dev/null
+++ b/48/CH12/EX12.9/eg_12_9.sce
@@ -0,0 +1,11 @@
+clc;
+clear;
+disp("In previosuly problems we have determined the input and output consistent partitions for the Machine M5");
+disp("Input consistent partition {(AB),(CD),(EF)}");
+disp("Output consistent partition {(ACE),(BDF)}");
+disp("By assigning 000 to 101 to all the states from A to F");
+disp("we can find the expressions for the next state and the output");
+disp("Y1=y2");
+disp("Y2=y1^y2^");
+disp("Y3=xy3+xy2+x^y2^y3^+y2y3");
+disp("z=xy3^"); \ No newline at end of file
diff --git a/48/CH13/EX13.1/eg_13_1.sce b/48/CH13/EX13.1/eg_13_1.sce
new file mode 100755
index 000000000..48f896163
--- /dev/null
+++ b/48/CH13/EX13.1/eg_13_1.sce
@@ -0,0 +1,23 @@
+clc;
+clear;
+disp("By following the general procedure for fault detection in the text book Page n.o 478");
+disp("According to 3 & 4 steps of general procedure all the inputs are taken as 0 and the output is checked]");
+disp("X: 0 0 0");
+disp(" A B A B");
+disp("Z: 1 0 1");
+disp("By following the step 5");
+disp("X: 1 0");
+disp(" B B A");
+disp("Z: 0 0");
+disp("Accoring to step 6");
+disp("X: 1 0 0 1 0 0");
+disp(" A D D D C D D");
+disp("Z: 0 3 3 1 2 3");
+disp("Step 7 & 8")
+disp("X: 1 1 0");
+disp(" D C A B");
+disp("Z: 1 1 1");
+disp("Whole checking experiment")
+disp("X: 0 0 0 1 0 1 0 0 1 0 0 1 1 0");
+disp(" A B A B B A D D D C D D C A B");
+disp("Z: 1 0 1 0 0 0 3 3 1 2 3 1 1 1"); \ No newline at end of file
diff --git a/48/CH14/EX14.2/eg_14_2.sce b/48/CH14/EX14.2/eg_14_2.sce
new file mode 100755
index 000000000..7659bfce4
--- /dev/null
+++ b/48/CH14/EX14.2/eg_14_2.sce
@@ -0,0 +1,50 @@
+clc;
+clear;
+N=4;
+//state table of the machine
+s=[ 'PS' 'x=0' 'x=1';
+ 'A' 'A' 'B';
+ 'B' 'C' 'B';
+ 'C' 'A' 'D';
+ 'D' 'C' 'B'];
+
+k=1;l=2;m=1;n=1;
+f(k,4)='ABCD';
+k=k+1;
+for i=2:max(size(s(:,1)))
+ for j=i:max(size(s(:,1)))
+ if(s(i,2)==s(j,2) & i~=j)
+ f(k,l)=strcat([s(i,1) s(j,1)]);
+ l=l+4;
+ if(s(i,2)==s(j,2))
+ g(n,m)=s(i,2);
+ g(n,m+1)='-';
+ m=m+2;
+ else
+ g(n,m)=s(i,2);
+ g(n,m+1)=s(j,2);
+ g(n,m+2)='-';
+ m=m+3;
+ end
+ if(s(i,3)==s(j,3))
+ g(n,m)=s(i,3);
+ g(n,m+1)='-';
+ m=m+2;
+ else
+ g(n,m)=strcat([s(i,3) s(j,3)]);
+ g(n,m+1)='-';
+ m=m+2;
+ for z=2:max(size(s(:,1)))
+ if(s(z,3)==s(z,1))
+ h(1,3)=s(z,2);
+ h(1,5)=s(z,3);
+ end
+ end
+ end
+ end
+ end
+end
+disp("Synchronizing tree for Machine M3 is ")
+disp(f);
+disp(g);
+disp(h); \ No newline at end of file
diff --git a/48/CH14/EX14.3/eg_14_3.sce b/48/CH14/EX14.3/eg_14_3.sce
new file mode 100755
index 000000000..022920cbf
--- /dev/null
+++ b/48/CH14/EX14.3/eg_14_3.sce
@@ -0,0 +1,105 @@
+clc;
+clear;
+s=['PS' 'x=0' 'x=1';
+ 'A' 'A' 'B';
+ 'B' 'E' 'B';
+ 'C' 'E' 'F';
+ 'D' 'E' 'F';
+ 'E' 'A' 'D';
+ 'F' 'E' 'B'];
+z=0;
+disp("Original Machine M4");
+disp(s);
+p=s;
+n=max(size(s(:,1)));
+for i=2:n
+ for j=i:n
+ if(s(i,2)==s(j,2) & s(i,3)==s(j,3) & i~=j)
+ z=z+1;
+ for k=j:n-1
+ p(k,:)=p(k+1,:);
+ end
+ for k=2:n-1
+ if(p(k,2)==s(j,1))
+ p(k,2)=s(i,1);
+ end
+ if(p(k,3)==s(j,1))
+ p(k,3)=s(i,1);
+ end
+ end
+ end
+ end
+end
+s=p(1:n-z,:);
+disp("The contracted Table M4");
+disp(s);
+p=s;
+n=n-z;
+z=0;
+for i=2:n
+ for j=i:n
+ if(s(i,2)==s(j,2) & s(i,3)==s(j,3) & i~=j)
+ z=z+1;
+ for k=j:n-1
+ p(k,:)=p(k+1,:);
+ end
+ for k=2:n-1
+ if(p(k,2)==s(j,1))
+ p(k,2)=s(i,1);
+ end
+ if(p(k,3)==s(j,1))
+ p(k,3)=s(i,1);
+ end
+ end
+ end
+ end
+end
+s=p(1:n-z,:);
+disp("Repeated Contractions of M4");
+disp(s);
+p=s;
+n=n-z;
+z=0;
+for i=2:n
+ for j=i:n
+ if(s(i,2)==s(j,2) & s(i,3)==s(j,3) & i~=j)
+ z=z+1;
+ for k=j:n-1
+ p(k,:)=p(k+1,:);
+ end
+ for k=2:n-1
+ if(p(k,2)==s(j,1))
+ p(k,2)=s(i,1);
+ end
+ if(p(k,3)==s(j,1))
+ p(k,3)=s(i,1);
+ end
+ end
+ end
+ end
+end
+s=p(1:n-z,:);
+disp(s);
+p=s;
+n=n-z;
+z=0;
+for i=2:n
+ for j=i:n
+ if(s(i,2)==s(j,2) & s(i,3)==s(j,3) & i~=j)
+ z=z+1;
+ for k=j:n-1
+ p(k,:)=p(k+1,:);
+ end
+ for k=2:n-1
+ if(p(k,2)==s(j,1))
+ p(k,2)=s(i,1);
+ end
+ if(p(k,3)==s(j,1))
+ p(k,3)=s(i,1);
+ end
+ end
+ end
+ end
+end
+s=p(1:n-z,:);
+disp(s);
diff --git a/48/CH14/EX14.4/eg_14_4.sce b/48/CH14/EX14.4/eg_14_4.sce
new file mode 100755
index 000000000..a2973daa9
--- /dev/null
+++ b/48/CH14/EX14.4/eg_14_4.sce
@@ -0,0 +1,22 @@
+clc;
+clear;
+N=4;
+s=[ 'PS' 'x=0' 'x=1';
+ 'A' 'A' 'B';
+ 'B' 'C' 'B';
+ 'C' 'A' 'D';
+ 'D' 'C' 'B'];
+n=max(size(s(:,1)));
+s(n+1,:)=['-' '-' '-'];
+l=2;
+for i=2:n
+ for j=i:n
+ if(i~=j)
+ s(n+l,1)=strcat([s(i,1) s(j,1)]);
+ s(n+l,2)=strcat([s(i,2) s(j,2)]);
+ s(n+l,3)=strcat([s(i,3) s(j,3)]);
+ l=l+1;
+ end
+ end
+end
+disp(s); \ No newline at end of file
diff --git a/48/CH14/EX14.6/eg_14_6.sce b/48/CH14/EX14.6/eg_14_6.sce
new file mode 100755
index 000000000..5d306d766
--- /dev/null
+++ b/48/CH14/EX14.6/eg_14_6.sce
@@ -0,0 +1,32 @@
+clc;
+clear;
+s=['PS' 'x=0' 'x=1';
+ 'A' 'A' 'B';
+ 'B' 'C' 'D';
+ 'C' 'D' 'C';
+ 'D' 'B' 'A'];
+q=[0 0;0 0;1 1;1 1];
+n=max(size(s(:,1)));
+l=1;
+for i=2:n
+ z=0;x=0;
+ for j=i:n
+ if(q(i-1,1)==0 & q(i-1,2)==0 & i~=j & z==0)
+ p(l,1)=s(i,1);
+ p(l,2)=strcat([s(i,2) s(i,3)]);
+ p(l,3)='-';
+ l=l+1;z=z+1;
+ else
+ if(q(i-1,1)==1 & q(i-1,2)==1 & x==0)
+ p(l,1)=s(i,1);
+ p(l,2)='-';
+ p(l,3)=strcat([s(i,2) s(i,3)]);
+ l=l+1;x=x+1;
+ end
+ end
+ end
+end
+disp(['PS' 'z=0' 'z=1']);
+disp(p);
+disp(['AB' '(AC)(AD)(BC)(BD)' '-';
+ 'CD' '-' '(AC)(AD)(BC)(BD)']);
diff --git a/48/CH14/EX16.7/eg_14_7.sce b/48/CH14/EX16.7/eg_14_7.sce
new file mode 100755
index 000000000..c93845ad3
--- /dev/null
+++ b/48/CH14/EX16.7/eg_14_7.sce
@@ -0,0 +1,26 @@
+clc;
+clear;
+s=['S' 'C1' 'SB1';
+ 'B1' 'S' '-';
+ 'C1' 'C2' '-';
+ 'C2' '-' 'S'];
+n=max(size(s(:,1)));
+l=1;
+for i=1:n
+ for j=i:n
+ if(i~=j)
+ p(l,1)=strcat([s(i,1) s(j,1)]);
+ if(s(i,2)=='-' | s(j,2)=='-')
+ p(l,2)='-';
+ else
+ p(l,2)=strcat([s(i,2) s(j,2)]);
+ end
+ if(s(i,3)=='-' | s(j,3)=='-')
+ p(l,3)='-';
+ else
+ p(l,3)=strcat([s(i,3) s(j,3)]);
+ end
+ l=l+1;
+ end
+ end
+end \ No newline at end of file
diff --git a/48/CH15/EX15.10/eg_15_10.sce b/48/CH15/EX15.10/eg_15_10.sce
new file mode 100755
index 000000000..c97c27b62
--- /dev/null
+++ b/48/CH15/EX15.10/eg_15_10.sce
@@ -0,0 +1,16 @@
+clc;
+clear;
+A=[0 1 1;
+ 1 0 0;
+ 1 0 0];
+B=[1;1;0];
+C=[1 1 0;
+ 1 1 1];
+D=[0;1];
+K=[C;C*A;C*(A*A)];
+K=modulo(K,2);
+disp("K matrix")
+disp(K);
+disp(rank(K),'since the rank of K is ');
+disp("K is not further reducible");
+//z=K * y; \ No newline at end of file
diff --git a/48/CH15/EX15.11/eg_15_11.sce b/48/CH15/EX15.11/eg_15_11.sce
new file mode 100755
index 000000000..bc81bcfff
--- /dev/null
+++ b/48/CH15/EX15.11/eg_15_11.sce
@@ -0,0 +1,25 @@
+clc;
+clear;
+A=[0 1 0;
+ 1 0 0;
+ 0 1 1];
+B=[1;1;1];
+C=[1 0 0];
+D=[1];
+K=[C;C*A;C*(A*A)];
+disp(K);
+disp(rank(K),'rank of K matrix is ');
+disp("Since the rank is 2 K matrix can be reduced");
+disp("As only the first 2 rows are linearly independent therefore");
+T=[1 0 0;0 1 0];
+disp(T,'T =');
+disp("In this case Q is");
+Q=[1 0;0 1];
+disp(Q);
+Q_inv=inv(Q);
+R=T';
+//y_red=T*y;
+A_red=T*A*R;
+B_red=T*B;
+C_red=C*R;
+D_red=D; \ No newline at end of file
diff --git a/48/CH15/EX15.12/eg_15_12.sce b/48/CH15/EX15.12/eg_15_12.sce
new file mode 100755
index 000000000..077a1fdb3
--- /dev/null
+++ b/48/CH15/EX15.12/eg_15_12.sce
@@ -0,0 +1,29 @@
+clc;
+clear;
+A=[1 0 0 0;
+ 0 0 1 1;
+ 1 1 0 0;
+ 1 0 1 0];
+B=[1 0;
+ 0 0;
+ 1 1;
+ 1 1];
+C=[0 1 0 1;
+ 1 1 1 0];
+D=[1 0;
+ 0 1];
+K=[C;C*A;C*(A*A)];
+K=modulo(K,2);
+T=K(1:3,:);
+Q=K(1:3,1:3);
+Q_inv=inv(Q);
+Q_inv=abs(modulo(Q_inv,2));
+R=[Q_inv;[0 0 0]];
+disp("Reduced matrix A is");
+disp(A_red=T*A*R);
+disp("Reduced matrix B is");
+disp(B_red=T*B);
+disp("Reduced matrix C is");
+disp(C_red=C*R);
+disp("Reduced matrix D is");
+disp(D_red=D); \ No newline at end of file
diff --git a/48/CH15/EX15.15/eg_15_15.sce b/48/CH15/EX15.15/eg_15_15.sce
new file mode 100755
index 000000000..ed93014d1
--- /dev/null
+++ b/48/CH15/EX15.15/eg_15_15.sce
@@ -0,0 +1,18 @@
+clc;
+clear;
+n=4;
+for i=1:4
+ for j=1:4
+ p(i,j)=modulo(i+j-2,4);
+ end
+end
+disp("modulo 4 Addition");
+disp(p);
+for i=1:4
+ for j=1:4
+ p(i,j)=modulo((i-1)*(j-1),4);
+ end
+end
+disp("modulo 4 Multiplication");
+disp(p);
+
diff --git a/48/CH15/EX15.16/eg_15_16.sce b/48/CH15/EX15.16/eg_15_16.sce
new file mode 100755
index 000000000..af4427950
--- /dev/null
+++ b/48/CH15/EX15.16/eg_15_16.sce
@@ -0,0 +1,44 @@
+clc;
+clear;
+n=4;
+a=zeros(1,n);
+for i=1:n
+ for j=1:n
+ pad(i,j)=modulo(i+j-2,4);
+ end
+end
+for i=1:n
+ for j=1:n
+ pmu(i,j)=modulo((i-1)*(j-1),4);
+ end
+end
+t=0;
+for i=1:n
+ for j=1:n
+ if(pad(i,j)==1)
+ t=1;
+ break;
+ end
+ end
+end
+if(t==0)
+ disp("Modulo 4 ring is not a field");
+end
+for i=0:3
+ for j=0:3
+ if(modulo(i*j,4)==1)
+ a(i)=1;
+ end
+ end
+end
+res=0;
+for i=1:max(size(a))
+ if(a(i)==1)
+ res=res+1;
+ end
+end
+if(res==4)
+ disp("Modulo 4 ring is a field");
+else
+ disp("Modulo 4 ring is not a field");
+end \ No newline at end of file
diff --git a/48/CH15/EX15.17/eg_15_17.sce b/48/CH15/EX15.17/eg_15_17.sce
new file mode 100755
index 000000000..799e08ea3
--- /dev/null
+++ b/48/CH15/EX15.17/eg_15_17.sce
@@ -0,0 +1,18 @@
+clc;
+clear;
+n=3;
+for i=1:n
+ for j=1:n
+ p(i,j)=modulo(i+j-2,3);
+ end
+end
+disp("modulo 3 Addition");
+disp(p);
+for i=1:n
+ for j=1:n
+ p(i,j)=modulo((i-1)*(j-1),3);
+ end
+end
+disp("modulo 3 Multiplication");
+disp(p);
+
diff --git a/48/CH15/EX15.3/eg_15_3.sce b/48/CH15/EX15.3/eg_15_3.sce
new file mode 100755
index 000000000..0aa8bc2c3
--- /dev/null
+++ b/48/CH15/EX15.3/eg_15_3.sce
@@ -0,0 +1,30 @@
+clc;
+clear;
+T1=[1 2 1];
+T2=[0 1 1];
+n=max(size(T1));
+a=n-1;
+b=a;
+T3=zeros(1,a+b+1);
+for i=1:n
+ b=n-1;
+ for j=1:n
+ T3(a+b+1)=T3(a+b+1)+(T1(i)*T2(j));
+ b=b-1;
+ end
+ a=a-1;
+end
+m=max(size(T3));
+i=1;
+j=m;
+while(i<=floor(m/2) & j>=(ceil(m/2)+1))
+ t=T3(i);
+ T3(i)=modulo(T3(j),3);
+ T3(j)=modulo(t,3);
+ i=i+1;
+ j=j-1;
+end
+T3(ceil(m/2))=modulo(T3(ceil(m/2)),3);
+disp("Top row of the below matrix is powers of the transfer function and bottom row is of coefficients of respective powers");
+disp([4 3 2 1 0]);
+disp(T3); \ No newline at end of file
diff --git a/48/CH15/EX15.4/eg_15_4.sce b/48/CH15/EX15.4/eg_15_4.sce
new file mode 100755
index 000000000..c9010c34f
--- /dev/null
+++ b/48/CH15/EX15.4/eg_15_4.sce
@@ -0,0 +1,23 @@
+clc;
+clear;
+T1=[1 0 1 1];
+h=[1 1 0 1 0 0 0 0 0];
+in=[1 0 1 1];
+l=1;
+for i=2:max(size(in(1,:)))
+ h1=h;
+ if(in(i)==1)
+ for k=1:i-1
+ t=h1(max(size(h1(1,:))));
+ for j=max(size(h1(1,:)))-1:-1:1
+ h1(j+1)=h1(j);
+ end
+ h1(1)=t;
+ end
+ D(l,:)=h1(1,:);
+ l=l+1;
+ end
+end
+output=h+D(1,:)+D(2,:);
+output=modulo(output,2);
+disp(output); \ No newline at end of file
diff --git a/48/CH15/EX15.5/eg_15_5.sce b/48/CH15/EX15.5/eg_15_5.sce
new file mode 100755
index 000000000..5edda0967
--- /dev/null
+++ b/48/CH15/EX15.5/eg_15_5.sce
@@ -0,0 +1,23 @@
+clc;
+clear;
+//T=1+D+D^3 over GF(2)
+//let X0 is the null sequence
+//0=X0+DX0+D^3X0 since output of the null sequence is zero
+//Adding X0 on both sides we get X0=DX0+D^3X0
+nul=[0 0 1];
+T=[0 1 0 1];
+j=1;
+for i=1:max(size(T));
+ if(T(i)==1)
+ s(1,j)=i-1;
+ j=j+1;
+ end
+end
+j=4;
+for i=1:7
+ nul(1,j)=nul(1,j-s(1))+nul(1,j-s(2));
+ nul(1,j)=modulo(nul(1,j),2);
+ j=j+1;
+end
+disp("Null Sequence for input 001 is ");
+disp(nul); \ No newline at end of file
diff --git a/48/CH15/EX15.6/eg_15_6.sce b/48/CH15/EX15.6/eg_15_6.sce
new file mode 100755
index 000000000..764b0d32e
--- /dev/null
+++ b/48/CH15/EX15.6/eg_15_6.sce
@@ -0,0 +1,24 @@
+clc;
+clear;
+//T=1+2D^2+D^3 over GF(3)
+//let X0 is the null sequence
+//0=X0+2D^2*X0+D^3*X0 since output of the null sequence is zero
+//Adding X0 on both sides we get 2X0=2D^2*X0+D^3*X0
+//X0=D^2*X0+2D^3*X0
+nul=[1 1 1];
+T=[0 0 1 2];
+j=1;
+for i=1:max(size(T));
+ if(T(i)>=1)
+ s(1,j)=i-1;
+ j=j+1;
+ end
+end
+j=4;
+for i=1:15
+ nul(1,j)=nul(1,j-s(1))+2*nul(1,j-s(2));
+ nul(1,j)=modulo(nul(1,j),3);
+ j=j+1;
+end
+disp("Null Sequence for input 001 is ");
+disp(nul); \ No newline at end of file
diff --git a/48/CH16/EX16.2/eg_16_2.sce b/48/CH16/EX16.2/eg_16_2.sce
new file mode 100755
index 000000000..ce72395ab
--- /dev/null
+++ b/48/CH16/EX16.2/eg_16_2.sce
@@ -0,0 +1,9 @@
+clc;
+clear;
+disp("R1=λ+1*(011)*(1*(011)*)*");
+//from the identity λ+RR*=R* where R=1*(011)*
+disp("R2=(1+011)*");
+//from the identity (P+Q)*=(P*Q*)*
+disp("R1=λ+1*(011)*(1*(011)*)*");
+disp("(1*(011)*)*");
+disp("(1+011)*=R2"); \ No newline at end of file
diff --git a/48/CH16/EX16.3/eg_16_3.sce b/48/CH16/EX16.3/eg_16_3.sce
new file mode 100755
index 000000000..77e4f6899
--- /dev/null
+++ b/48/CH16/EX16.3/eg_16_3.sce
@@ -0,0 +1,10 @@
+clc;
+clear;
+disp("(1+00*1)+(1+00*1)(0+10*1)*(0+10*1)=0*1(0+10*1)*");
+disp("(1+00*1)+(1+00*1)(0+10*1)*(0+10*1)");
+//by taking (1+00*1) as common
+disp("=(1+00*1)[λ+(0+10*1)*(0+10*1)]");
+disp("[(λ+00*)1][λ+(0+10*1)*(0+10*1)]");
+//from the identity λ+RR*=R*
+disp("[0*1(0+10*1)*]");
+
diff --git a/48/CH2/EX2.1/eg_2_1.sce b/48/CH2/EX2.1/eg_2_1.sce
new file mode 100755
index 000000000..21e773b09
--- /dev/null
+++ b/48/CH2/EX2.1/eg_2_1.sce
@@ -0,0 +1,22 @@
+clear;
+clc;
+//lower=input("input the lower limit of the set");
+//upper=input("input the upper limit of the set");
+lower=1; //lower limit of the set
+upper=10; //upper limit of the set
+temp=lower;
+h=1;i=1;
+while(temp<=upper)
+ if(modulo(temp,2)==0) //checking whether a number is even or not
+ e(h)=temp;
+ h=h+1;
+ else
+ o(i)=temp; //odd number
+ i=i+1;
+ end
+ temp=temp+1;
+end;
+disp("the set of even number between the limits")
+disp(e);
+disp("the set of odd number between the limits")
+disp(o);
diff --git a/48/CH2/EX2.11/eg_2_11.sce b/48/CH2/EX2.11/eg_2_11.sce
new file mode 100755
index 000000000..520598f91
--- /dev/null
+++ b/48/CH2/EX2.11/eg_2_11.sce
@@ -0,0 +1,23 @@
+clear;
+clc;
+//N=input("enter the number for which divisibilty ");
+N=45; //divident
+h=1;
+for i=1:N //finding all the divisors of 45
+ if(modulo(N,i)==0)
+ r(h)=i;
+ h=h+1;
+ end
+end
+n=max(size(r));
+disp("Hasse Diagram") //displaying in the form of hasse diagram
+disp("------------")
+disp(r(n));
+h=2;
+for i=n-1:-2:3
+ disp("-----------");
+ disp(r(i),r(i-1));
+ h=h+1;
+end
+disp("----------")
+disp(r(1));
diff --git a/48/CH2/EX2.12/eg_2_12.sce b/48/CH2/EX2.12/eg_2_12.sce
new file mode 100755
index 000000000..2378410ee
--- /dev/null
+++ b/48/CH2/EX2.12/eg_2_12.sce
@@ -0,0 +1,34 @@
+clear
+clc
+N=4;
+//defining all the partial ordered sets
+s(1,:)=[1 0];
+s(2,:)=[0 1];
+s(3,:)=[0 0];
+s(4,:)=[1 1];
+//Finding
+a=1;b=1;
+for i=1:1:N //sorting based on the level
+ for j=i:1:N
+ if(i~=j)
+ u=s(i,1)+s(i,2);
+ v=s(j,1)+s(j,2);
+ if(u<v)
+ temp(1)=s(i,1);
+ temp(2)=s(i,2);
+ s(i,1)=s(j,1);
+ s(i,2)=s(j,2);
+ s(j,1)=temp(1);
+ s(j,2)=temp(2);
+ end
+ end
+ end
+end
+// displaying in the form of hasse graph form
+disp("1st stage of Hasse diagram");
+disp(s(1,:));
+disp("2nd stage of Hasse diagram");
+disp(s(2,:));
+disp(s(3,:));
+disp("3rd stage of Hasse diagram");
+disp(s(4,:)); \ No newline at end of file
diff --git a/48/CH2/EX2.15/eg_2_15.sce b/48/CH2/EX2.15/eg_2_15.sce
new file mode 100755
index 000000000..c7a250e6c
--- /dev/null
+++ b/48/CH2/EX2.15/eg_2_15.sce
@@ -0,0 +1,31 @@
+clear
+clc
+N=3;
+s=['a' 'b' 'c']; //set for which lattice should be defined
+for i=2:2^3
+ s(i,:)=s(1,:);
+end
+//defining 2nd level vertices of the lattice
+for i=2:4
+ s(i,i-1)='0';
+end
+//defining 3rd level vertices of the lattice
+for i=5:6
+ s(i,i-4)='0';
+ s(i,i-3)='0';
+end
+s(7,1)='0';s(7,3)='0';
+//defining the final level of vertices of the lattice
+s(8,:)=['0' '0' '0'];
+disp("1st level");
+disp(s(1,:));
+disp("2nd level");
+disp(s(2,:));
+disp(s(3,:));
+disp(s(4,:));
+disp("3rd level");
+disp(s(5,:));
+disp(s(6,:));
+disp(s(7,:));
+disp("4th level");
+disp(s(8,:)); \ No newline at end of file
diff --git a/48/CH2/EX2.16/eg_2_16.sce b/48/CH2/EX2.16/eg_2_16.sce
new file mode 100755
index 000000000..dd4507ba8
--- /dev/null
+++ b/48/CH2/EX2.16/eg_2_16.sce
@@ -0,0 +1,12 @@
+clear;
+clc;
+par1=['ab','cde','fh','gi']; //initial partitions par1
+par2=['abc','de','fg','hi']; //partition 2
+//par=par1+par2;
+//lub-lower upper bound
+par_lub=['abcde','fghi'];
+disp(par_lub);
+//par=par1.par2
+//glb-greatest lower bound
+par_glb=['ab','c','de','f','g','h','i'];
+disp(par_glb); \ No newline at end of file
diff --git a/48/CH2/EX2.2/eg_2_2.sce b/48/CH2/EX2.2/eg_2_2.sce
new file mode 100755
index 000000000..a8d16dadc
--- /dev/null
+++ b/48/CH2/EX2.2/eg_2_2.sce
@@ -0,0 +1,85 @@
+clear;
+clc;
+//N=input("enter the elements in the set");
+//n=1;
+//while(n<=N)
+// i(n)=input("enter the elements of first set");
+// n=n+1;
+//end;
+N=6;
+i(1)='f1';i(2)='f2';i(3)='f3';i(4)='f4';i(5)='f5';i(6)='f6';
+disp("null set"); //since null set is subset of any set.
+for a=1:1:N //set of single elements
+ disp(i(a));
+end
+c=1;
+for a=1:1:N-1 //set of two elements
+ for b=a:1:N
+ if(a~=b)
+ m(c,1)=i(a);
+ m(c,2)=i(b);
+ c=c+1;
+ end
+ end;
+end;
+disp(m);
+d=1;
+for a=1:1:N //set of three elements
+ for b=a:1:N
+ for c=b:1:N
+ if((a~=b)&(b~=c)&(c~=a))
+ p(d,1)=i(a);
+ p(d,2)=i(b);
+ p(d,3)=i(c);
+ d=d+1;
+ end
+ end
+ end
+end
+disp(p);
+e=1;
+for a=1:1:N //set of four elements
+ for b=a:1:N
+ for c=b:1:N
+ for d=c:1:N
+ if((a~=b)&(b~=c)&(c~=d)&(d~=a)&(b~=d)&(a~=c))
+ q(e,1)=i(a);
+ q(e,2)=i(b);
+ q(e,3)=i(c);
+ q(e,4)=i(d)
+ e=e+1;
+ end
+ end
+ end
+ end
+end
+disp(q);
+f=1;
+for a=1:1:N //set of five elements
+ for b=a:1:N
+ for c=b:1:N
+ for d=c:1:N
+ for e=d:1:N
+ if((a~=b)&(b~=c)&(c~=d)&(d~=e)&(e~=a)&(a~=c)&(a~=d)&(b~=d)&(c~=e)&(b~=e))
+ r(f,1)=i(a);
+ r(f,2)=i(b);
+ r(f,3)=i(c);
+ r(f,4)=i(d);
+ r(f,5)=i(e);
+ f=f+1;
+ end
+ end
+ end
+ end
+ end
+end
+disp(r);
+for a=1:1:N //set of six elements
+ s(1,1)=i(1);
+ s(1,2)=i(2);
+ s(1,3)=i(3);
+ s(1,4)=i(4);
+ s(1,5)=i(5);
+ s(1,6)=i(6);
+end
+disp(s); \ No newline at end of file
diff --git a/48/CH2/EX2.4/eg_2_4.sce b/48/CH2/EX2.4/eg_2_4.sce
new file mode 100755
index 000000000..131e07aaf
--- /dev/null
+++ b/48/CH2/EX2.4/eg_2_4.sce
@@ -0,0 +1,25 @@
+clear;
+clc;
+N1=2;
+N2=3;
+//n=1;
+//while(n<=N1)
+// i(n)=input("enter the elements of first set");
+// n=n+1;
+//end;
+i=['p' 'q']; //set A
+//n=1;
+//while(n<=N2)
+// j(n)=input("enter the elements of second set");
+// n=n+1;
+//end;
+j=['r' 's' 't']; //set B
+c=1;d=1;
+for a=1:1:N1 //realtion between sets A and B
+ for b=1:1:N2
+ m(c,d)=i(a);
+ m(c,d+1)=j(b);
+ c=c+1;
+ end;
+end;
+disp(m); \ No newline at end of file
diff --git a/48/CH2/EX2.5/eg_2_5.sce b/48/CH2/EX2.5/eg_2_5.sce
new file mode 100755
index 000000000..a43c42d09
--- /dev/null
+++ b/48/CH2/EX2.5/eg_2_5.sce
@@ -0,0 +1,61 @@
+clear;
+clc;
+//N=input("enter the no of elements in the set :");
+//for i=1:1:N
+// s(1,i)=input("enter the elements in the set :");
+//end;
+//n=input("enter the number of pairs in the relation :");
+//for j=1:1:n
+// for k=1:1:2
+// r(j,k)=input("enter the elements in the relation :");
+// end
+//end
+N=2;
+s=['a' 'b']; //elements in the set
+n=3;
+r=['a' 'a';'b' 'b';'a' 'b']; //realtion between the elements in the above set.
+ref=zeros(1,N);
+for a=1:1:N
+ for b=1:1:n
+ if(r(b,1)==s(1,a)&r(b,2)==s(1,a))
+ ref(1,a)=1;
+ end
+ end
+end
+for i=1:1:N //checking whether above relation is reflexive or not
+ if(ref(1,i)==1)
+ disp("the above relation is reflexive with elements ");
+ disp(s(1,i));
+ disp(" ");
+ end
+end
+sym=zeros(1,(N*N-1)/2);
+s(1,N+1)=s(1,1);
+for a=1:1:N //checking whether above relation is symmetric or not
+ for b=1:1:n
+ if(r(b,1)==s(1,a)&r(b,2)==s(1,a+1))
+ for d=1:1:n
+ if(r(d,1)==s(1,a+1)&r(d,2)==s(1,a))
+ sym(1,a)=1;
+ disp("the above relation is symmetric for these pairs :");
+ disp(")",s(1,a+1),s(1,a),"(");
+ end
+ end
+ end
+ end
+end
+for a=1:1:n //checking whether it is transtive or not.
+ u=r(a,1);
+ v=r(a,2);
+ for b=a:1:n
+ if(r(b,1)==v)
+ w=r(b,2);
+ for c=b:1:n
+ if(r(c,1)==w&r(c,2)==u)
+ disp("satisfies transtitve property");
+ abort;
+ end
+ end
+ end
+ end
+end \ No newline at end of file
diff --git a/48/CH2/EX2.6/eg_2_6.sce b/48/CH2/EX2.6/eg_2_6.sce
new file mode 100755
index 000000000..bc5faded8
--- /dev/null
+++ b/48/CH2/EX2.6/eg_2_6.sce
@@ -0,0 +1,34 @@
+clear;
+clc;
+//N=input("enter the elements in the set :");
+//for i=1:1:N
+// s(i)=input("enter the elements :");
+//end
+N=2;
+s=['a' 'b'];
+disp("The equivalence relation of above set is :");
+h=1;
+for i=1:1:N //to satisfy reflexive property
+ ref(h,1)=s(i);
+ ref(h,2)=s(i);
+ h=h+1;
+end
+for i=1:1:N //to satisfy symmetric property
+ for j=i:1:N
+ if(i~=j)
+ ref(h,1)=s(i);
+ ref(h,2)=s(j);
+ h=h+1;
+ end
+ end
+end
+m=1;
+for i=1:max(size(ref(:,1))) //to satisfy transtive property
+ if(ref(i,1)~=ref(i,2))
+ ref1(m,1)=ref(i,2);
+ ref1(m,2)=ref(i,1);
+ m=m+1;
+ end
+end
+disp(ref);
+disp(ref1); \ No newline at end of file
diff --git a/48/CH2/EX2.7/eg_2_7.sce b/48/CH2/EX2.7/eg_2_7.sce
new file mode 100755
index 000000000..5977bd696
--- /dev/null
+++ b/48/CH2/EX2.7/eg_2_7.sce
@@ -0,0 +1,31 @@
+clc;
+clear;
+//n1=input("enter the no of elements in the 1st set");
+//for i=1:1:n1
+// s1(i)=input("enter the elements of 1st set:");
+//end
+n1=3;
+s1=['a1' 'a2' 'a3']; //set A
+//n2=input("enter the no of elements in the 2nd set");
+//for i=1:1:n2
+// s2(i)=input("enter the elements of 2ns set:");
+//end
+n2=2;
+s1=['b1' 'b2']; //set B
+//N=input("enter the pairs in the relation which you want to check whether is a function");
+//for i=1:1:N
+// for j=1:1:2
+// r(i,j)=input("enter the elements in the relation:");
+// end
+//end
+N=3;
+r=['a1' 'b1';'a2' 'b2';'a2' 'b1']; //Realtion r
+for i=1:1:N //checks whether the relation is function or not
+ for j=i:1:N
+ if(r(i,1)==r(j,1) & i~=j)
+ disp("the relation is not a function");
+ abort;
+ end
+ end
+end
+disp("the realtion is a fucntion"); \ No newline at end of file
diff --git a/48/CH3/EX3.1/eg_1.sce b/48/CH3/EX3.1/eg_1.sce
new file mode 100755
index 000000000..d64b6503b
--- /dev/null
+++ b/48/CH3/EX3.1/eg_1.sce
@@ -0,0 +1,13 @@
+clear
+clc;
+disp("T(x,y,z)=x^y^z+yz+xz");
+disp("**Minimise the given expression**");
+disp("**Since z is common in every term taking z common**");
+disp("T(x,y,z)=z(x^y^+y+x)");
+disp("**From the property a+a^b=a+b **");
+disp("T(x,y,z)=z(x^+y+x)");
+disp("**Since we know that a+a^=1 **");
+disp("T(x,y,z)=z(1+y)");
+disp("**we know that 1+a=1 **");
+disp("T(x,y,z)=z.1");
+disp("T(x,y,z)=z"); \ No newline at end of file
diff --git a/48/CH3/EX3.10/eg_3_10.sce b/48/CH3/EX3.10/eg_3_10.sce
new file mode 100755
index 000000000..8cff8a98a
--- /dev/null
+++ b/48/CH3/EX3.10/eg_3_10.sce
@@ -0,0 +1,34 @@
+clear;
+clc;
+a1=0;a2=a1;a3=a1;
+//all combinations of 2 varible inputs
+f(:,1)=[0;0;1;1];
+f(:,2)=[0;1;0;1];
+disp("The turth table of f for all the combinations of a0,a1,a2,a3 are shown below")
+//determining the values of f for all combinations of a0,a1,a2,a3
+for a3=0:1
+ for a2=0:1
+ for a1=0:1
+ for a0=0:1
+ disp([' a3' ' a2' ' a1' ' a0']);
+ disp([a3 a2 a1 a0]);
+ i=1;
+ for x=0:1
+ for y=0:1
+ f0=bitand(a0,bitand(bitcmp(x,1),bitcmp(y,1)));
+ f1=bitand(a1,bitand(bitcmp(x,1),y));
+ f2=bitand(a2,bitand(x,bitcmp(y,1)));
+ f3=bitand(a3,bitand(x,y));
+ f4=bitor(f0,f1);
+ f5=bitor(f2,f3);
+ f(i,3)=bitor(f4,f5);
+ i=i+1;
+ end
+ end
+ disp([' x' ' y' ' f']);
+ disp(f);
+ disp('*--------------------*');
+ end
+ end
+ end
+end \ No newline at end of file
diff --git a/48/CH3/EX3.11/eg_3_11.sce b/48/CH3/EX3.11/eg_3_11.sce
new file mode 100755
index 000000000..399ff30e7
--- /dev/null
+++ b/48/CH3/EX3.11/eg_3_11.sce
@@ -0,0 +1,16 @@
+clear;
+clc;
+disp("x NOR x=(x+x)^");
+disp("NOT Gate");
+disp("x NOR x=x^x^=x^");
+disp("OR Gate");
+disp("(x NOR y) NOR (x NOR y) = (x^ NOR y^)^ = x+y");
+disp("AND Gate");
+disp("(x NOR x) NOR (y NOR y )= x^ NOR y^ = xy");
+disp("NAND Gate");
+disp(" NOT ((x NOR x) NOR (y NOR y))= NOT (x^ NOR y^) = NOT(xy) = (xy)^");
+disp("XOR Gate");
+disp("(x^ NOR y^) NOR (x NOR y) = x^y+xy^");
+disp("XNOR Gate");
+disp("(x^ NOR y) NOR (x NOR y^) = xy+x^y^");
+disp("Since every other gate can be implemented using NOR gate it is said to be functionally complete") \ No newline at end of file
diff --git a/48/CH3/EX3.12/eg_3_12.sce b/48/CH3/EX3.12/eg_3_12.sce
new file mode 100755
index 000000000..6c73ed694
--- /dev/null
+++ b/48/CH3/EX3.12/eg_3_12.sce
@@ -0,0 +1,5 @@
+clear;
+clc;
+disp("T=xy^+(x+y^)z");
+disp("from the identity a+a^b=a+b");
+disp("T=xy^+z"); \ No newline at end of file
diff --git a/48/CH3/EX3.13/eg_3_13.sce b/48/CH3/EX3.13/eg_3_13.sce
new file mode 100755
index 000000000..3ba59f36c
--- /dev/null
+++ b/48/CH3/EX3.13/eg_3_13.sce
@@ -0,0 +1,22 @@
+clear;
+clc;
+disp("Air conditioning system of a storage warehouse will be turned on if and only if it satisfies these conditions");
+disp("let W denotes weight of 100 tons or more");
+disp("H denotes relative humidity of atleast 60 percent");
+disp("T denotes temparature above 60 degrees");
+disp("P denotes barometric pressure of 30 or more");
+disp("*-first condition-*");
+disp("W<100 tons => W^ ,H>=60 => H , T>60 ");
+disp("A1=W^HT");
+disp("*-second condition-*");
+disp("W>100 tons => W , T>60 => T");
+disp("A2=WT");
+disp("*-third condition-*");
+disp("W<100 tons => W^ ,P>30 => P");
+disp("A3=W^P");
+disp("since Air condtioning system should be activated if any one of the above is satisfied so ");
+disp("A=A1+A2+A3");
+disp("A=W^HT+WT+W^P");
+disp("A=T(W^H+W)+W^P");
+disp("A=T(W+H)+W^P");
+disp("Thus a combinational system with above expression makes the air conditioning system on when required") \ No newline at end of file
diff --git a/48/CH3/EX3.14/eg_3_14.sce b/48/CH3/EX3.14/eg_3_14.sce
new file mode 100755
index 000000000..b0501f2d8
--- /dev/null
+++ b/48/CH3/EX3.14/eg_3_14.sce
@@ -0,0 +1,35 @@
+clear;
+clc;
+i=1;
+//all combinations of 2 variable inputs
+f(:,1)=[0;0;1;1];
+f(:,2)=[0;1;0;1];
+//verifying D'morgan first law
+for a=0:1
+ for b=0:1
+ f(i,3)=bitcmp(bitor(a,b),1);
+ f(i,4)=bitand(bitcmp(a,1),bitcmp(b,1));
+ i=i+1;
+ end
+end
+disp(" a b (a+b)^ a^b^");
+disp(f);
+disp("Therefore (a+b)^=a^ b^ ");
+//verfying D'morgan 2nd law
+i=1;
+for a=0:1
+ for b=0:1
+ f(i,3)=bitcmp(bitand(a,b),1);
+ f(i,4)=bitor(bitcmp(a,1),bitcmp(b,1));
+ i=i+1;
+ end
+end
+disp(" a b (ab)^ a^+b^");
+disp(f);
+//proving D'morgans laws theoritically
+disp("(a+b)^=a^.b^");
+disp("(a.b)^=a^+b^");
+disp("we have show that (a+b)(a+b)^=0 and (a+b)+a^.b^=1");
+disp("(a+b)a^b^=aa^b^+ba^b^=0+a^bb^=0+0=0");
+disp("(a+b)+a^b^=a+b+a^b^=a+b+a^=b+a+a^=b+1=1");
+disp("This proves the first Dmorgan law and in the similar way 2nd law can also be proved"); \ No newline at end of file
diff --git a/48/CH3/EX3.2/eg_3_2.sce b/48/CH3/EX3.2/eg_3_2.sce
new file mode 100755
index 000000000..a1dee0999
--- /dev/null
+++ b/48/CH3/EX3.2/eg_3_2.sce
@@ -0,0 +1,16 @@
+clear
+clc
+disp("T(x,y,z)=(x+y)[x^(y^+z^)]^+x^y^+x^z^");
+disp("From the properties 1. (ab)^=a^+b^ 2. (a+b)^=a^b^");
+disp("T(x,y,z)=((x+y)(x+yz))+x^y^+x^z^");
+disp("Multipliying the first 2 terms");
+disp("T(x,y,z)=(x+xyz+xy+yz)+x^y^+x^z^");
+disp("T(x,y,z)=(x(1+y+yz)+yz)+x^y^+x^z^");
+disp("T(x,y,z)=x+yz+x^y^+x^z^");
+disp("we know a+a^b=a+b");
+disp("T(x,y,z)=x+y^+yz+x^z^");
+disp("T(x,y,z)=x+z^+y^+yz");
+disp("T(x,y,z)=x+z^+y^+z");
+disp("since z+z^=1");
+disp("T(x,y,z)=x+1+y^");
+disp("T(x,y,z)=1")
diff --git a/48/CH3/EX3.3/eg_3_3.sce b/48/CH3/EX3.3/eg_3_3.sce
new file mode 100755
index 000000000..a12240181
--- /dev/null
+++ b/48/CH3/EX3.3/eg_3_3.sce
@@ -0,0 +1,14 @@
+clear
+clc;
+disp("L.H.S = xy+x^y^+yz");
+disp("R.H.S = xy+x^y^+x^z");
+disp("Based on consensus theorem")
+disp("we can write x^y^+yz as x^y^+yz+x^z bcoz the two expressions are equal");
+disp("(x^y^+yz+x^z(y+y^))=x^y^+yz+x^yz+x^y^z");
+disp("x^y^+yz+x^yz+x^y^z=x^y^(1+z)+yz(1+x^)");
+disp("x^y^+yz=x^y^+yz+x^z");
+disp("so L.H.S=xy+x^y^+yz=xy+x^y^+yz+x^z");
+disp("In the similar way xy+yz+x^z can be simplified as xy+x^z");
+disp("so L.H.S becomes xy+x^z+x^y^");
+disp("thus L.H.S= R.H.S");
+disp("hence proved") \ No newline at end of file
diff --git a/48/CH3/EX3.4/eg_3_4.sce b/48/CH3/EX3.4/eg_3_4.sce
new file mode 100755
index 000000000..f7d81c619
--- /dev/null
+++ b/48/CH3/EX3.4/eg_3_4.sce
@@ -0,0 +1,23 @@
+clear;
+clc;
+//function definition
+x=[0;0;0;0;1;1;1;1];
+y=[0;0;1;1;0;0;1;1];
+z=[0;1;0;1;0;1;0;1];
+f=[1;0;1;1;0;0;1;1];
+g=[0;1;0;1;1;0;1;0];
+//calculating the values of expressions given
+forg=bitor(f,g);
+fandg=bitand(f,g);
+fcmp=bitcmp(f,1);
+s(:,1)=x;
+s(:,2)=y;
+s(:,3)=z;
+s(:,4)=f;
+s(:,5)=g;
+s(:,6)=forg;
+s(:,7)=fandg;
+s(:,8)=fcmp;
+p=[' x',' y',' z',' f',' g',' f+g',' fg',' f^'];
+disp(p);
+disp(s); \ No newline at end of file
diff --git a/48/CH3/EX3.5/eg_3_5.sce b/48/CH3/EX3.5/eg_3_5.sce
new file mode 100755
index 000000000..2236bc652
--- /dev/null
+++ b/48/CH3/EX3.5/eg_3_5.sce
@@ -0,0 +1,11 @@
+clear;
+clc;
+disp("T(A,B,C,D)=A^C^+ABD+BC^D+AB^D^+ABCD^");
+disp("Assume A^=x , C^=y , BD=z");
+disp("Now from consensus theorem for the first three terms");
+disp("BC^D is the redundant term so it can be removed");
+disp("T(A,B,C,D)=A^C^+ABD+AB^D^+ABCD^");
+disp("T(A,B,C,D)=A^C^+ABD+AD^(B^+BC)");
+disp("we know that a+a^b=a+b");
+disp("T(A,B,C,D)=A^C^+ABD+AD^(B^+C)");
+disp("T(A,B,C,D)=A^C^+A(BD+D^(B^+C))"); \ No newline at end of file
diff --git a/48/CH3/EX3.6/eg_3_6.sce b/48/CH3/EX3.6/eg_3_6.sce
new file mode 100755
index 000000000..a749f31bf
--- /dev/null
+++ b/48/CH3/EX3.6/eg_3_6.sce
@@ -0,0 +1,13 @@
+clear
+clc
+disp("T(A,B,C,D)=A^B+ABD+AB^CD^+BC");
+disp("T(A,B,C,D)=B(A^+AD)+C(AD^B^+B)");
+disp("T(A,B,C,D)=B(A^+D)+C(AD^+B)");
+disp("T(A,B,C,D)=A^B+BD+ACD^+BC");
+disp("T(A,B,C,D)=A^B+BD+ACD^+BC(A+A^)");
+disp("T(A,B,C,D)=A^B+A^BC+ABC+BD+ACD^");
+disp("T(A,B,C,D)=A^B(1+C)+ABC+BD+ACD^");
+disp("T(A,B,C,D)=A^B+ABC+BD+ACD^");
+disp("**Now apply consensus theorem for 2nd 3rd and 4th terms**");
+disp("let x=D,y=B,z=AC");
+disp("T(A,B,C,D)=A^B+BD+ACD^"); \ No newline at end of file
diff --git a/48/CH3/EX3.7/eg_3_7.sce b/48/CH3/EX3.7/eg_3_7.sce
new file mode 100755
index 000000000..a1671e5f8
--- /dev/null
+++ b/48/CH3/EX3.7/eg_3_7.sce
@@ -0,0 +1,7 @@
+clear;
+clc;
+disp("T(x,y,z)=x^y+z^+xyz");
+disp("**To determine the canonical sum of products we have to check for a product which is not a min term and then multiply with the missing variable such that the expression value doesnt change**");
+disp("T(x,y,z)=x^y(z+z^)+(x+x^)(y+y^)z^+xyz");
+disp("T(x,y,z)=x^yz+x^yz^+xyz^+xy^z^+x^yz^+x^y^z^+xyz");
+disp("T(x,y,z)=x^yz+x^yz^+xyz^+xy^z^+x^y^z^+xyz"); \ No newline at end of file
diff --git a/48/CH3/EX3.8/eg_3_8.sce b/48/CH3/EX3.8/eg_3_8.sce
new file mode 100755
index 000000000..c97b4a049
--- /dev/null
+++ b/48/CH3/EX3.8/eg_3_8.sce
@@ -0,0 +1,10 @@
+clear;
+clc;
+disp("T(x,y,z)=x^(y^+z)");
+disp("**To determine the canonical product of sums form you need to check for a product which is not a max term and then add it with the missing terms such that the expression value is not altered**");
+disp("T(x,y,z)=(x^+yy^+zz^)(xx^+y^+z)");
+disp("a+b+cc^ can be written as product of 2 max terms (a+b+c)(a+b+c^)");
+disp("a+bb^+cc^ can be written as (a+b+c)(a+b+c^)(a+b^+c)(a+b^+c^)");
+disp("from the above two properties we can write the T(x,y,z) as");
+disp("T(x,y,z)=(x^+y+z)(x^+y+z^)(x^+y^+z)(x^+y^+z^)(x+y^+z)(x^+y^+z)");
+disp("T(x,y,z)=(x^+y+z)(x^+y+z^)(x^+y^+z)(x^+y^+z^)(x+y^+z)"); \ No newline at end of file
diff --git a/48/CH3/EX3.9/eg_3_9.sce b/48/CH3/EX3.9/eg_3_9.sce
new file mode 100755
index 000000000..dff2dbf37
--- /dev/null
+++ b/48/CH3/EX3.9/eg_3_9.sce
@@ -0,0 +1,6 @@
+clear;
+clc;
+disp("T(x,y,z)=x^y^z^+x^y^z+x^yz+xyz+xy^z+xy^z^");
+disp("the complement T^ consists of those minterms which are not contained in the expression for T");
+disp("T=[x^yz^+xyz^]^");
+disp("(x+y^+z)(x^+y^+z)");
diff --git a/48/CH4/EX4.1/eg_4_1.sce b/48/CH4/EX4.1/eg_4_1.sce
new file mode 100755
index 000000000..7ede8c617
--- /dev/null
+++ b/48/CH4/EX4.1/eg_4_1.sce
@@ -0,0 +1,286 @@
+clc;
+n=4; //four variable kmap
+k=[1 1 0 1;
+ 0 1 1 1;
+ 0 1 1 0;
+ 0 0 0 0];
+k(:,:,2)=zeros(n,n); //temporary matrix to know whether a element is paired or not
+//declaring notations to display output
+var=['y' 'z' 'w' 'x'];
+p1=['y''z''' 'y''z' 'yz' 'yz'''];
+p2=['w''x''';'w''x';'wx';'wx'''];
+//minimum redundant elements accepted while pairing
+cmn4=4;
+cmn2=2;
+temp=1;
+disp("The minimal ecpression of the given Kmap ");
+disp(k(:,:,1));
+disp("is :");
+disp(" ")
+//16 cells
+for i=1:n
+ for j=1:n
+ if(k(i,j)~=1)
+ temp=0;
+ break;
+ end
+ end
+end
+printf('f=');
+if(temp==1)
+ printf("1");
+ abort;
+end
+//8 cells
+z1=ones(2,4);
+temp1=['00' '01' '11' '10'];
+temp2=temp1';
+for i=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,:,1);k(t,:,1)];
+ if(z==z1)
+ k(i,:,2)=[1 1 1 1];
+ k(t,:,2)=[1 1 1 1];
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ printf('+');
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ printf('+');
+ break;
+ end
+ end
+ end
+ end
+end
+z2=ones(4,2);
+for j=1:n
+ if(j==4)
+ t=1;
+ else
+ t=j+1;
+ end
+ z=[k(:,j,1) k(:,t,1)];
+ if(z==z2)
+ k(:,j,2)=[1;1;1;1];
+ k(:,t,2)=[1;1;1;1];
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ printf('+');
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ printf('+');
+ break;
+ end
+ end
+ end
+ end
+end
+//4 cells
+z1=ones(1,4);
+z2=ones(4,1);
+z3=ones(2,2);
+temp1=['00' '01' '11' '10'];
+temp2=temp1';
+for t=1:n
+ z=k(t,:,1);
+ no=number_of(k(t,:,2),1);
+ if(z==z1 & no<cmn4)
+ k(t,:,2)=z1;
+ a=strsplit(temp1(1,t));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(a(in)=='1')
+ printf(var(in));
+ end
+ end
+ printf("+");
+ end
+end
+for t=1:n
+ z=k(:,t,1);
+ no=number_of(k(:,t,2),1);
+ if(z==z2 & no<cmn4)
+ k(:,t,2)=z2;
+ a=strsplit(temp2(t,1));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ printf("+");
+ end
+end
+for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z4=[k(i,j,1) k(i,t2,1);k(t1,j,1) k(t1,t2,1)];
+ z5=[k(i,j,2) k(i,t2,2);k(t1,j,2) k(t1,t2,2)];
+ no=number_of(z5,1);
+ if(z4==z3 & no<cmn4)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ k(t1,j,2)=1;
+ k(t1,t2,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ printf("+");
+ end
+ end
+end
+//2 cells
+z6=[1 1];
+z7=z6';
+for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z8=[k(i,j,1) k(i,t2,1)];
+ z9=[k(i,j,2) k(i,t2,2)];
+ no1=number_of(z9,1);
+ if(z8==z6 & no1<cmn2 & i+j~=2)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p1(1,i));
+ printf('%s''',var(2+in));
+ printf("+");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p1(1,i));
+ printf(var(2+in));
+ printf("+");
+ end
+ end
+ end
+ end
+end
+for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z10=[k(i,j,1);k(t1,j,1)];
+ z11=[k(i,j,2);k(t1,j,2)];
+ no2=number_of(z11,1);
+ if(z10==z7 & no2<cmn2)
+ k(i,j,2)=1;
+ k(t1,j,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p2(j,1));
+ printf('%s''',var(in));
+ printf("+");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p2(j,1));
+ printf(var(in));
+ printf("+");
+ end
+ end
+ end
+ end
+end
+//single cell
+for i=1:n
+ for j=1:n
+ if(k(i,j,2)==0 & k(i,j,1)==1)
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp2(i,1));
+ for in=1:max(size(a(:,1)))
+ if(a(in,1)=='1')
+ printf(var(in+2));
+ else
+ if(a(in,1)=='0')
+ printf('%s''',var(2+in));
+ end
+ end
+ end
+ for in=1:max(size(b(:,1)))
+ if(b(in,1)=='1')
+ printf(var(in));
+ else
+ if(b(in,1)=='0')
+ printf('%s''',var(in));
+ end
+ end
+ end
+ if(i~=4 & j~=4)
+ printf("+");
+ end
+ end
+ end
+end
+printf("0"); \ No newline at end of file
diff --git a/48/CH4/EX4.10/eg_4_10.sce b/48/CH4/EX4.10/eg_4_10.sce
new file mode 100755
index 000000000..dd61d9c74
--- /dev/null
+++ b/48/CH4/EX4.10/eg_4_10.sce
@@ -0,0 +1,4 @@
+clc;
+k=[1 1 0 1;
+ 0 1 1 1];
+karmap3(k); \ No newline at end of file
diff --git a/48/CH4/EX4.2/eg_4_2.sce b/48/CH4/EX4.2/eg_4_2.sce
new file mode 100755
index 000000000..85681de34
--- /dev/null
+++ b/48/CH4/EX4.2/eg_4_2.sce
@@ -0,0 +1,284 @@
+clc;
+n=4; //four variable kmap
+k=[1 1 0 1;
+ 0 1 1 1;
+ 0 1 1 0;
+ 0 0 0 0];
+k(:,:,2)=zeros(n,n); //temporary matrix to know whether a element is paired or not
+//declaring notations to display output
+var=['y' 'z' 'w' 'x'];
+p1=['y^z^' 'y''z' 'yz' 'yz'''];
+p2=['w^x^';'w''x';'wx';'wx'''];
+//minimum redundant elements accepted while pairing
+cmn4=1;
+cmn2=1;
+temp=1;
+disp("The minimal ecpression of the given Kmap ");
+disp(k(:,:,1));
+disp("is :");
+disp(" ")
+//16 cells
+for i=1:n
+ for j=1:n
+ if(k(i,j)~=1)
+ temp=0;
+ break;
+ end
+ end
+end
+printf('f=');
+if(temp==1)
+ printf("1");
+ abort;
+end
+//8 cells
+z1=ones(2,4);
+z2=ones(4,2);
+temp1=['00' '01' '11' '10'];
+temp2=temp1';
+for i=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,:,1);k(t,:,1)];
+ if(z==z1)
+ k(i,:,2)=[1 1 1 1];
+ k(t,:,2)=[1 1 1 1];
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ printf('+');
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ printf('+');
+ break;
+ end
+ end
+ end
+ end
+end
+for j=1:n
+ if(j==4)
+ t=1;
+ else
+ t=j+1;
+ end
+ z=[k(:,j,1) k(:,t,1)];
+ if(z==z2)
+ k(:,j,2)=[1;1;1;1];
+ k(:,t,2)=[1;1;1;1];
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ printf('+');
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ printf('+');
+ break;
+ end
+ end
+ end
+ end
+end
+//4 cells
+z1=ones(1,4);
+z2=ones(4,1);
+z3=ones(2,2);
+temp1=['00' '01' '11' '10'];
+temp2=temp1';
+for t=1:n
+ z=k(t,:,1);
+ no=number_of(k(t,:,2),1);
+ if(z==z1 & no<cmn4)
+ k(t,:,2)=z1;
+ a=strsplit(temp1(1,t));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(a(in)=='1')
+ printf(var(in));
+ end
+ end
+ printf("+");
+ end
+end
+for t=1:n
+ z=k(:,t,1);
+ no=number_of(k(:,t,2),1);
+ if(z==z2 & no<cmn4)
+ k(:,t,2)=z2;
+ a=strsplit(temp2(t,1));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ printf("+");
+ end
+end
+for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z4=[k(i,j,1) k(i,t2,1);k(t1,j,1) k(t1,t2,1)];
+ z5=[k(i,j,2) k(i,t2,2);k(t1,j,2) k(t1,t2,2)];
+ no=number_of(z5,1);
+ if(z4==z3 & no<cmn4)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ k(t1,j,2)=1;
+ k(t1,t2,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ printf("+");
+ end
+ end
+end
+//2 cells
+z6=[1 1];
+z7=z6';
+for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z8=[k(i,j,1) k(i,t2,1)];
+ z9=[k(i,j,2) k(i,t2,2)];
+ no1=number_of(z9,1);
+ if(z8==z6 & no1<cmn2)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p1(1,i));
+ printf('%s''',var(2+in));
+ printf("+");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p1(1,i));
+ printf(var(2+in));
+ printf("+");
+ end
+ end
+ end
+ end
+end
+for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z10=[k(i,j,1);k(t1,j,1)];
+ z11=[k(i,j,2);k(t1,j,2)];
+ no2=number_of(z11,1);
+ if(z10==z7 & no2<cmn2)
+ k(i,j,2)=1;
+ k(t1,j,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p2(j,1));
+ printf('%s''',var(in));
+ printf("+");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p2(j,1));
+ printf(var(in));
+ printf("+");
+ end
+ end
+ end
+ end
+end
+//single cell
+for i=1:n
+ for j=1:n
+ if(k(i,j,2)==0 & k(i,j,1)==1)
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp2(i,1));
+ for in=1:max(size(a(:,1)))
+ if(a(in,1)=='1')
+ printf(var(in+2));
+ else
+ if(a(in,1)=='0')
+ printf('%s''',var(2+in));
+ end
+ end
+ end
+ for in=1:max(size(b(:,1)))
+ if(b(in,1)=='1')
+ printf(var(in));
+ else
+ if(b(in,1)=='0')
+ printf('%s''',var(in));
+ end
+ end
+ end
+ printf("+");
+ end
+ end
+end
+printf("0"); \ No newline at end of file
diff --git a/48/CH4/EX4.3/eg_4_3.sce b/48/CH4/EX4.3/eg_4_3.sce
new file mode 100755
index 000000000..df5c48f06
--- /dev/null
+++ b/48/CH4/EX4.3/eg_4_3.sce
@@ -0,0 +1,288 @@
+clc;
+n=4; //four variable kmap
+k=[0 0 1 0;
+ 1 1 1 0;
+ 0 1 1 1;
+ 0 1 0 0];
+k(:,:,2)=zeros(n,n); //temporary matrix to know whether a element is paired or not
+//declaring notations to display output
+var=['y' 'z' 'w' 'x'];
+p1=['y^z^' 'y''z' 'yz' 'yz'''];
+p2=['w^x^';'w''x';'wx';'wx'''];
+//minimum redundant elements accepted while pairing
+cmn4=1;
+cmn2=1;
+temp=1;
+disp("The minimal ecpression of the given Kmap ");
+disp(k(:,:,1));
+disp("is :");
+disp(" ")
+//16 cells
+for i=1:n
+ for j=1:n
+ if(k(i,j)~=1)
+ temp=0;
+ break;
+ end
+ end
+end
+printf('f=');
+if(temp==1)
+ printf("1");
+ abort;
+end
+//8 cells
+z1=ones(2,4);
+z2=ones(4,2);
+temp1=['00' '01' '11' '10'];
+temp2=temp1';
+for i=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,:,1);k(t,:,1)];
+ if(z==z1)
+ k(i,:,2)=[1 1 1 1];
+ k(t,:,2)=[1 1 1 1];
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ printf('+');
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ printf('+');
+ break;
+ end
+ end
+ end
+ end
+end
+for j=1:n
+ if(j==4)
+ t=1;
+ else
+ t=j+1;
+ end
+ z=[k(:,j,1) k(:,t,1)];
+ if(z==z2)
+ k(:,j,2)=[1;1;1;1];
+ k(:,t,2)=[1;1;1;1];
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ printf('+');
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ printf('+');
+ break;
+ end
+ end
+ end
+ end
+end
+//2 cells
+z6=[1 1];
+z7=z6';
+for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z8=[k(i,j,1) k(i,t2,1)];
+ z9=[k(i,j,2) k(i,t2,2)];
+ no1=number_of(z9,1);
+ if(z8==z6 & no1<cmn2)
+ if(i==3 & i+j==5)
+ ;
+ else
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p1(1,i));
+ printf('%s''',var(2+in));
+ printf("+");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p1(1,i));
+ printf(var(2+in));
+ printf("+");
+ end
+ end
+ end
+ end
+ end
+end
+for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z10=[k(i,j,1);k(t1,j,1)];
+ z11=[k(i,j,2);k(t1,j,2)];
+ no2=number_of(z11,1);
+ if(z10==z7 & no2<cmn2)
+ k(i,j,2)=1;
+ k(t1,j,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p2(j,1));
+ printf('%s''',var(in));
+ printf("+");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p2(j,1));
+ printf(var(in));
+ printf("+");
+ end
+ end
+ end
+ end
+end
+//4 cells
+z1=ones(1,4);
+z2=ones(4,1);
+z3=ones(2,2);
+temp1=['00' '01' '11' '10'];
+temp2=temp1';
+for t=1:n
+ z=k(t,:,1);
+ no=number_of(k(t,:,2),1);
+ if(z==z1 & no<cmn4)
+ k(t,:,2)=z1;
+ a=strsplit(temp1(1,t));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(a(in)=='1')
+ printf(var(in));
+ end
+ end
+ printf("+");
+ end
+end
+for t=1:n
+ z=k(:,t,1);
+ no=number_of(k(:,t,2),1);
+ if(z==z2 & no<cmn4)
+ k(:,t,2)=z2;
+ a=strsplit(temp2(t,1));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ printf("+");
+ end
+end
+for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z4=[k(i,j,1) k(i,t2,1);k(t1,j,1) k(t1,t2,1)];
+ z5=[k(i,j,2) k(i,t2,2);k(t1,j,2) k(t1,t2,2)];
+ no=number_of(z5,1);
+ if(z4==z3 & no<cmn4)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ k(t1,j,2)=1;
+ k(t1,t2,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ printf("+");
+ end
+ end
+end
+//single cell
+for i=1:n
+ for j=1:n
+ if(k(i,j,2)==0 & k(i,j,1)==1)
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp2(i,1));
+ for in=1:max(size(a(:,1)))
+ if(a(in,1)=='1')
+ printf(var(in+2));
+ else
+ if(a(in,1)=='0')
+ printf('%s''',var(2+in));
+ end
+ end
+ end
+ for in=1:max(size(b(:,1)))
+ if(b(in,1)=='1')
+ printf(var(in));
+ else
+ if(b(in,1)=='0')
+ printf('%s''',var(in));
+ end
+ end
+ end
+ printf("+");
+ end
+ end
+end
+printf("0"); \ No newline at end of file
diff --git a/48/CH4/EX4.4/eg_4_4.sce b/48/CH4/EX4.4/eg_4_4.sce
new file mode 100755
index 000000000..72151f2aa
--- /dev/null
+++ b/48/CH4/EX4.4/eg_4_4.sce
@@ -0,0 +1,34 @@
+clc;
+n=10;
+//coverting decimal numbers into excess 3 values
+for i=0:n-1
+ c(i+1,1)=dec21bin(i+3);
+end
+a=c;
+b=zeros(10,4);
+//placing excess 3 outputs in matrix for convenience
+for i=1:n
+ j=4;
+ while(a(i,1)>=1)
+ b(i,j)=round(modulo(a(i,1),10));
+ a(i,1)=a(i,1)/10;
+ j=j-1;
+ end
+end
+//dont care is represented by a 2 since scilab doesnt allow a matrix to contain string and a number.
+for i=n+1:16
+ b(i,:)=[2 2 2 2];
+end
+//map of each output variable
+z=[b(1,1) b(5,1) b(13,1) b(9,1);b(2,1) b(6,1) b(14,1) b(10,1);
+ b(3,1) b(7,1) b(15,1) b(11,1);b(4,1) b(8,1) b(16,1) b(12,1)];
+y=[b(1,2) b(5,2) b(13,2) b(9,2);b(2,2) b(6,2) b(14,2) b(10,2);
+ b(3,2) b(7,2) b(15,2) b(11,2);b(4,2) b(8,2) b(16,2) b(12,2)];
+w=[b(1,3) b(5,3) b(13,3) b(9,3);b(2,3) b(6,3) b(14,3) b(10,3);
+ b(3,3) b(7,3) b(15,3) b(11,3);b(4,3) b(8,3) b(16,3) b(12,3)];
+x=[b(1,4) b(5,4) b(13,4) b(9,4);b(2,4) b(6,4) b(14,4) b(10,4);
+ b(3,4) b(7,4) b(15,4) b(11,4);b(4,4) b(8,4) b(16,4) b(12,4)];
+donkmap(w,1);
+donkmap(x,2);
+donkmap(y,3);
+donkmap(z,4); \ No newline at end of file
diff --git a/48/CH4/EX4.5/eg_4_5.sce b/48/CH4/EX4.5/eg_4_5.sce
new file mode 100755
index 000000000..82073dc80
--- /dev/null
+++ b/48/CH4/EX4.5/eg_4_5.sce
@@ -0,0 +1,608 @@
+//f=x^y^z+wxz+xy+v^w^yz^
+clc;
+n=4;
+k=[0 0 0 0;
+ 1 0 1 1;
+ 0 1 1 0;
+ 1 1 1 0];
+k(:,:,2)=[0 0 0 0;
+ 1 0 1 1;
+ 0 1 1 0;
+ 0 1 1 0];
+//k=[1 0 0 0;
+// 0 0 0 0;
+// 0 0 0 0;
+// 0 0 1 0];
+//k(:,:,2)=[1 0 0 0;
+// 0 0 0 0;
+// 0 0 0 0;
+// 1 0 0 0];
+k(:,:,3)=zeros(n,n);
+k(:,:,4)=zeros(n,n);
+var=['y' 'z' 'v' 'w' 'x'];
+p1=['y''z''' 'y''z' 'yz' 'yz'''];
+p2=['v''w''x''';'v''w''x';'v''wx';'v''wx''';
+'vw''x''';'vw''x';'vwx';'vwx'''];
+cmn16=9;
+cmn8=5;
+cmn4=3;
+cmn2=2;
+temp=1;
+ printf('The minimal ecpression of the given Kmap ');
+ disp(k(:,:,1));
+ disp(k(:,:,2));
+ disp("is :");
+printf('f');
+printf("=");
+//32 cells
+for i=1:n
+ for j=1:n
+ for l=1:2
+ if(k(i,j,l)~=1 & k(i,j,l)~=2)
+ temp=0;
+ break;
+ end
+ end
+ end
+end
+if(temp==1)
+ printf("1");
+ abort;
+end
+//16 cells
+//8+8 row cells
+z1=ones(2,4,2);
+z2=ones(4,2,2);
+temp1=['00' '01' '11' '10'];
+temp2=['000' '001' '011' '010' '100' '101' '111' '110'];
+for i=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,:,1:2);k(t,:,1:2)];
+ z1=[k(i,:,3:4);k(t,:,3:4)];
+ if(noof3(z,0)==0 & noof3(z1,1)<cmn16)
+ k(i,:,3:4)=ones(4,2);
+ k(t,:,3:4)=ones(4,2);
+ a=strsplit(temp1(1,i));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ end
+ k(i,:,3:4)=ones(1,4,2);
+ k(t,:,3:4)=ones(1,4,2);
+ end
+end
+//8+8 column cells
+for j=1:n
+ if(j==4)
+ t=1;
+ else
+ t=j+1;
+ end
+ z=[k(:,j,1:2) k(:,t,1:2)];
+ z1=[k(:,j,3:4) k(:,t,3:4)];
+ if(noof3(z,0)==0 & noof3(z1,1)<cmn16)
+ k(:,j,3:4)=ones(4,2);
+ k(:,t,3:4)=ones(4,2);
+ a=strsplit(temp2(1,j));
+ b=strsplit(temp2(1,t));
+ c=strsplit(temp2(1,j+4));
+ d=strsplit(temp2(1,t+4));
+ c1=check(a,b,c,d);
+ for in=1:max(size(c1))
+ if(c1(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ else
+ if(c1(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ end
+ printf("+");
+ k(:,j,3:4)=ones(1,4,2);
+ k(:,t,3:4)=ones(1,4,2);
+ end
+end
+//4x4 front matrix
+if(number_of(k(:,:,1),0)==0 & number_of(k(:,:,3),1)<cmn16)
+ printf(var(3));
+ printf('''');
+ k(:,:,3)=ones(4,4);
+end
+//4x4 rear matrix
+if(number_of(k(:,:,2),0)==0 & number_of(k(:,:,4),1)<cmn16)
+ printf(var(3));
+ k(:,:,4)=ones(4,4);
+end
+//8 cells
+//2x2 front and rear cells
+for i=1:n
+ for j=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ if(j==4)
+ u=1;
+ else
+ u=j+1;
+ end
+ z=k(i,j,1:2);
+ z(1,2,:)=k(i,u,1:2);
+ z(2,1,:)=k(t,j,1:2);
+ z(2,2,:)=k(t,u,1:2);
+ z1=k(i,j,3:4);
+ z1(1,2,:)=k(i,u,3:4);
+ z1(2,1,:)=k(t,j,3:4);
+ z1(2,2,:)=k(t,u,3:4);
+ if(noof3(z,0)==0 & noof3(z1,1)<cmn8)
+ a=strsplit(temp1(1,i));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ end
+ a=strsplit(temp2(1,j));
+ b=strsplit(temp2(1,u));
+ c=strsplit(temp2(1,4+j));
+ d=strsplit(temp2(1,4+u));
+ c1=check(a,b,c,d);
+ for in=1:max(size(c1))
+ if(c1(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ else
+ if(c1(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ end
+ k(i,j,3:4)=ones(1,1,2);
+ k(i,u,3:4)=ones(1,1,2);
+ k(t,j,3:4)=ones(1,1,2);
+ k(t,u,3:4)=ones(1,1,2);
+ printf("+");
+ end
+ end
+end
+//1x4 front and rear cells
+for i=1:n
+ z=k(i,:,1:2);
+ z1=k(i,:,3:4);
+ if(noof3(z,0)==0 & noof3(z1,1)<cmn8)
+ printf(p1(i));
+ printf("+");
+ k(i,:,3:4)=ones(1,4,2);
+ end
+end
+//4x1 front and rear cells
+for j=1:n
+ z=k(:,j,1:2);
+ z1=k(:,j,3:4);
+ if(noof3(z,0)==0 & noof3(z1,1)<cmn8)
+ a=strsplit(temp2(1,j));
+ b=strsplit(temp2(1,u));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ end
+ printf("+");
+ k(:,j,3:4)=ones(1,2,4);
+ end
+end
+//2x4 front cells
+for i=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=k(i,:,1);
+ z(2,:,1)=k(t,:,1);
+ z1=k(i,:,3);
+ z1(2,:,1)=k(t,:,3);
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn8)
+ a=strsplit(temp1(1,i));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ end
+ printf('%s''',var(3));
+ printf("+");
+ k(i,:,3)=ones(1,4);
+ k(t,:,3)=ones(1,4);
+ end
+end
+//2x4 rear cells
+for i=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=k(i,:,2);
+ z(2,:,1)=k(t,:,2);
+ z1=k(i,:,4);
+ z1(2,:,1)=k(t,:,4);
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn8)
+ a=strsplit(temp1(1,i));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ end
+ printf(var(3));
+ printf("+");
+ k(i,:,4)=ones(1,4);
+ k(t,:,4)=ones(1,4);
+ end
+end
+//4x2 front cells
+for j=1:n
+ if(j==4)
+ u=1;
+ else
+ u=j+1;
+ end
+ z=k(:,j,1);
+ z(:,2,1)=k(:,u,1);
+ z1=k(:,j,3);
+ z1(:,2,1)=k(:,u,3);
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn8)
+ a=strsplit(temp2(1,i));
+ b=strsplit(temp2(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ end
+ printf('%s''',var(3));
+ printf("+");
+ k(:,j,3)=ones(4,1);
+ k(:,u,3)=ones(4,1);
+ end
+end
+//4x2 rear cells
+for j=1:n
+ if(j==4)
+ u=1;
+ else
+ u=j+1;
+ end
+ z=k(:,j,2);
+ z(:,2,1)=k(:,u,2);
+ z1=k(:,j,4);
+ z1(:,2,1)=k(:,u,4);
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn8)
+ a=strsplit(temp2(1,i));
+ b=strsplit(temp2(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(4+in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(4+in));
+ end
+ end
+ end
+ printf(var(3));
+ printf("+");
+ k(:,j,4)=ones(4,1);
+ k(:,u,4)=ones(4,1);
+ end
+end
+//4 cells
+//1x4 front cells
+for i=1:n
+ z=k(i,:,1);
+ z1=k(i,:,3);
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn4)
+ printf(p1(1,i));
+ printf('%s''',var(3));
+ printf("+");
+ k(i,:,3)=ones(1,4);
+ end
+end
+//1x4 rear cells
+for i=1:n
+ z=k(i,:,2);
+ z1=k(i,:,4);
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn4)
+ printf(p1(1,i));
+ printf(var(3));
+ printf("+");
+ k(i,:,4)=ones(1,4);
+ end
+end
+//4x1 front cells
+for j=1:n
+ z=k(:,j,1);
+ z1=k(:,j,3);
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn4)
+ printf(p2(j,1));
+ printf("+");
+ k(:,j,3)=ones(4,1);
+ end
+end
+//4x1 rear cells
+for j=1:n
+ z=k(:,j,2);
+ z1=k(:,j,4);
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn4)
+ printf(p2(4+j,1));
+ printf("+");
+ k(:,j,4)=ones(4,1);
+ end
+end
+//2x1 front and rear matrix
+for i=1:n
+ for j=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,j,1);k(t,j,1)];
+ z(:,:,2)=[k(i,j,2) k(t,j,2)];
+ z1=[k(i,j,3);k(t,j,3)];
+ z1(:,:,2)=[k(i,j,4) k(t,j,4)];
+ if(noof3(z,0)==0 & noof3(z1,1)<cmn4)
+ a=strsplit(temp1(1,i));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ end
+ a=strsplit(temp2(1,j));
+ b=strsplit(temp2(1,4+j));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ end
+ printf('+');
+ k(i,j,3)=1;k(t,j,3)=1;
+ k(i,j,4)=1; k(t,j,4)=1;
+ end
+ end
+end
+//1x2 front and rear matrix
+for i=1:n
+ for j=1:n
+ if(j==4)
+ u=1;
+ else
+ u=j+1;
+ end
+ z=[k(i,j,1) k(i,u,1)];
+ z(:,:,2)=[k(i,j,2) k(i,u,2)];
+ z1=[k(i,j,3) k(i,u,3)];
+ z1(:,:,2)=[k(i,j,4) k(i,u,4)];
+ if(noof3(z,0)==0 & noof3(z1,1)<1)
+ printf(p1(i));
+ a=strsplit(temp2(1,j));
+ b=strsplit(temp2(1,u));
+ c=strsplit(temp2(1,4+j));
+ d=strsplit(temp2(1,4+j));
+ c1=check(a,b,c,d);
+ for in=1:max(size(c1))
+ if(c1(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ else
+ if(c1(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ end
+ printf('+');
+ k(i,j,3)=1; k(i,u,3)=1;
+ k(i,j,4)=1; k(i,u,4)=1;
+ end
+ end
+end
+//2 cells
+//1x2 front cells
+for i=1:n
+ for j=1:n
+ if(j==4)
+ u=1;
+ else
+ u=j+1;
+ end
+ z=[k(i,j,1) k(i,u,1)];
+ z1=[k(i,j,3) k(i,u,3)];
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn2)
+ printf(p1(1,i));
+ a=strsplit(temp2(1,j));
+ b=strsplit(temp2(1,u));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ end
+ printf('+');
+ k(i,j,3)=1; k(i,u,3)=1;
+ end
+ end
+end
+//1x2 rear cells
+for i=1:n
+ for j=1:n
+ if(j==4)
+ u=1;
+ else
+ u=j+1;
+ end
+ z=[k(i,j,2) k(i,u,2)];
+ z1=[k(i,j,4) k(i,u,4)];
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn2)
+ printf(p1(1,i));
+ a=strsplit(temp2(1,4+j));
+ b=strsplit(temp2(1,4+u));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ end
+ printf('+');
+ k(i,j,4)=1; k(i,u,4)=1;
+ end
+ end
+end
+//2x1 front cells
+for i=1:n
+ for j=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,j,1);k(t,j,1)];
+ z1=[k(i,j,3) k(t,j,3)];
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn2)
+ a=strsplit(temp1(1,i));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ end
+ printf(p2(j,1))
+ printf('+');
+ k(i,j,3)=1; k(i,u,3)=1;
+ end
+ end
+end
+//2x1 rear cells
+for i=1:n
+ for j=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,j,2);k(t,j,2)];
+ z1=[k(i,j,4) k(t,j,4)];
+ if(number_of(z,0)==0 & number_of(z1,1)<cmn2)
+ a=strsplit(temp1(1,i));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ end
+ printf(p2(4+j,1))
+ printf('+');
+ k(i,j,4)=1; k(i,u,4)=1;
+ end
+ end
+end
+//1 cell front and rear matrix
+for i=1:n
+ for j=1:n
+ z=k(i,j,1:2);
+ z1=k(i,j,3:4);
+ if(noof3(z,0)==0 & noof3(z1,1)<cmn2)
+ printf(p1(1,i));
+ a=strsplit(temp2(1,j));
+ b=strsplit(temp2(1,4+j));
+ c=strcmp(a,b);
+ for in=2:max(size(c))
+ if(a(in)=='0' & c(in)==0)
+ printf('%s''',var(2+in));
+ else
+ if(a(in)=='1' & c(in)==0)
+ printf(var(2+in));
+ end
+ end
+ end
+ printf('+');
+ k(i,j,3:4)=ones(1,1,2);
+ end
+ end
+end
+//single cell
+for i=1:n
+ for j=1:n
+ for z=1:2
+ if(k(i,j,z)==1 & k(i,j,z+2)==0)
+ printf(p2(j,1));
+ printf(p1(1,i));
+ printf('+');
+ end
+ end
+ end
+end
+printf('0'); \ No newline at end of file
diff --git a/48/CH4/EX4.6/eg_4_6.sce b/48/CH4/EX4.6/eg_4_6.sce
new file mode 100755
index 000000000..bc7dbd007
--- /dev/null
+++ b/48/CH4/EX4.6/eg_4_6.sce
@@ -0,0 +1,38 @@
+clc;
+clear;
+z=1;
+//evaluating first expression
+for i=0:1
+ for j=0:1
+ for k=0:1
+ for l=0:1
+ f1(z,1)=bitor(bitand(i,j),bitand(k,l));
+ z=z+1;
+ end
+ end
+ end
+end
+z=1;
+//evaluating 2nd expression
+for i=0:1
+ for j=0:1
+ for k=0:1
+ for l=0:1
+ f2(z,1)=bitand(bitand(i,j),bitcmp(k,1));
+ z=z+1;
+ end
+ end
+ end
+end
+//determining whether f covers h or not.
+for i=1:16
+ if(f2(i,1)==1)
+ if(f2(i,1)==f1(i,1))
+ ;
+ else
+ disp("f doesnt cover h");
+ abort;
+ end
+ end
+end
+disp("f covers h and h implies f"); \ No newline at end of file
diff --git a/48/CH4/EX4.7/eg_4_7.sce b/48/CH4/EX4.7/eg_4_7.sce
new file mode 100755
index 000000000..c650c5577
--- /dev/null
+++ b/48/CH4/EX4.7/eg_4_7.sce
@@ -0,0 +1,5 @@
+clc;
+clear;
+disp("f=x^y+xz+y^z^");
+disp("since x^y is a prime implicant neither x^ nor y alone implies f");
+disp("only x^y are covered by f"); \ No newline at end of file
diff --git a/48/CH4/EX4.8/eg_4_8.sce b/48/CH4/EX4.8/eg_4_8.sce
new file mode 100755
index 000000000..58ba03cff
--- /dev/null
+++ b/48/CH4/EX4.8/eg_4_8.sce
@@ -0,0 +1,8 @@
+clc;
+k=[1 1 0 1;
+ 0 1 1 1;
+ 0 1 1 0;
+ 0 0 0 0];
+disp("The prime implicants of function f");
+karmap(k);
+karmap1(k); \ No newline at end of file
diff --git a/48/CH4/EX4.9/eg_4_9.sce b/48/CH4/EX4.9/eg_4_9.sce
new file mode 100755
index 000000000..e0b020658
--- /dev/null
+++ b/48/CH4/EX4.9/eg_4_9.sce
@@ -0,0 +1,7 @@
+clc;
+k=[0 1 1 1;
+ 0 1 1 0;
+ 0 0 1 0;
+ 0 0 1 0];
+disp("The prime implicants of the function f");
+karmap(k); \ No newline at end of file
diff --git a/48/CH5/EX5.1/eg_5_1.sce b/48/CH5/EX5.1/eg_5_1.sce
new file mode 100755
index 000000000..d7bee4eef
--- /dev/null
+++ b/48/CH5/EX5.1/eg_5_1.sce
@@ -0,0 +1,27 @@
+clc;
+clear;
+//Takes x input and check whether it is valid logic level or not.
+x=input("x = ");
+while(x~=0 & x~=1)
+ disp("enter a valid logical level");
+ x=input("x = ");
+end
+//Takes y input and check whether it is valid logic level or not.
+y=input("y = ");
+while(y~=0 & y~=1)
+ disp("enter a valid logical level");
+ y=input("y = ");
+end
+//Takes z input and check whether it is valid logic level or not.
+z=input("z = ");
+while(z~=0 & z~=1)
+ disp("enter a valid logical level");
+ z=input("z = ");
+end
+p1=bitand(bitand(bitcmp(x,1),bitcmp(y,1)),z);
+p2=bitand(bitand(bitcmp(x,1),y),bitcmp(z,1));
+p3=bitand(bitand(bitcmp(y,1),x),bitcmp(z,1));
+p4=bitand(bitand(x,y),z);
+p=bitor(bitor(p1,p2),bitor(p3,p4));
+disp(p,"The output of the odd parity generator circuit is");
+disp("p= x^y^z+x^yz^+xy^z^+xyz"); \ No newline at end of file
diff --git a/48/CH5/EX5.2/eg_5_2.sce b/48/CH5/EX5.2/eg_5_2.sce
new file mode 100755
index 000000000..2b351d6de
--- /dev/null
+++ b/48/CH5/EX5.2/eg_5_2.sce
@@ -0,0 +1,30 @@
+clc;
+clear;
+//Takes x input and check whether it is valid logic level or not.
+disp("enter the vaLue of input Line & controL signaLs C1 and C2");
+x=input("x = ");
+while(x~=0 & x~=1)
+ disp("enter a vaLid LogicaL LeveL");
+ x=input("x = ");1
+end
+//Takes C1 input and check whether it is valid logic level or not.
+C1=input("C1 = ");
+while(C1~=0 & C1~=1)
+ disp("enter a vaLid LogicaL LeveL");
+ C1=input("C1 = ");
+end
+//Takes C2 input and check whether it is valid logic level or not.
+C2=input("C2 = ");
+while(C2~=0 & C2~=1)
+ disp("enter a vaLid LogicaL LeveL");
+ C2=input("C2 = ");
+end
+disp("-------OUTPUT-------");
+disp(L1=bitand(bitand(bitcmp(C1,1),bitcmp(C2,1)),x),"L1 = ");
+disp(L2=bitand(bitand(bitcmp(C1,1),C2),x),"L2 = ");
+disp(L3=bitand(bitand(C1,bitcmp(C2,1)),x),"L3 = ");
+disp(L4=bitand(bitand(C1,C2),x),"L4 = ");
+disp("L1=xC1^C2^");
+disp("L2=xC1^C2");
+disp("L3=xC1C2^");
+disp("L4=xC1^C2^");
diff --git a/48/CH5/EX5.3/eg_5_3.sce b/48/CH5/EX5.3/eg_5_3.sce
new file mode 100755
index 000000000..d240e48da
--- /dev/null
+++ b/48/CH5/EX5.3/eg_5_3.sce
@@ -0,0 +1,32 @@
+clc;
+clear;
+//Takes input and check whether it is valid logic level or not.
+w=input("w = ");
+while(w~=0 & w~=1)
+ disp("enter a valid logical level");
+ w=input("w = ");
+end
+x=input("x = ");
+while(x~=0 & x~=1)
+ disp("enter a valid logical level");
+ x=input("x = ");
+end
+y=input("y = ");
+while(y~=0 & y~=1)
+ disp("enter a valid logical level");
+ y=input("y = ");
+end
+z=input("z = ");
+while(z~=0 & z~=1)
+ disp("enter a valid logical level");
+ z=input("z = ");
+end
+disp("original network x^[((y^z+z^y)w^)+w+y^+x^z^]");
+disp("x^[w^y^z+w^yz^+w+y^+x^z^]");
+disp("x^[y^(w^z+1)+w^yz^+w+x^z^]");
+disp("x^[y^+w+yz^+x^z^]");
+disp("x^[y^+yz^+w+x^z^]");
+disp("x^[y^+z^+x^z^+w]");
+disp("x^[y^+z^+w]");
+//output of the relay network for the inputs given
+disp(p=bitand(bitcmp(x,1),bitor(bitor(bitcmp(y,1),bitcmp(z,1)),w)),"output = "); \ No newline at end of file
diff --git a/48/CH5/EX5.4/eg_5_4.sce b/48/CH5/EX5.4/eg_5_4.sce
new file mode 100755
index 000000000..c40a7602e
--- /dev/null
+++ b/48/CH5/EX5.4/eg_5_4.sce
@@ -0,0 +1,33 @@
+clc;
+clear;
+//Takes input and check whether it is valid logic level or not.
+w=input("w = ");
+while(w~=0 & w~=1)
+ disp("enter a valid logical level");
+ w=input("w = ");
+end
+x=input("x = ");
+while(x~=0 & x~=1)
+ disp("enter a valid logical level");
+ x=input("x = ");
+end
+y=input("y = ");
+while(y~=0 & y~=1)
+ disp("enter a valid logical level");
+ y=input("y = ");
+end
+z=input("z = ");
+while(z~=0 & z~=1)
+ disp("enter a valid logical level");
+ z=input("z = ");
+end
+disp("We have 4 relays W,X,Y,Z which takes BCD number as input");
+disp("so the max value value we can get is 1001");
+disp("By drawing the Karnaugh map(consider all terms above 1001 as dont cares ) the minimised expression is");
+disp("T(w,x,y,z)=wz+xyz^+x^yz");
+disp("T(w,x,y,z)=xyz^+x^yz");
+disp("Draw the series parallel realization of T");
+disp("We can identify the redundancy of y contact at the right end");
+disp("which can be removed");
+disp("The cutset realisation of the above minimized series parallel network is");
+disp("T(w,x,y,z)=(w+y)(x+z)(x^+z^)"); \ No newline at end of file
diff --git a/48/CH5/EX5.5/eg_5_5.sce b/48/CH5/EX5.5/eg_5_5.sce
new file mode 100755
index 000000000..906a18998
--- /dev/null
+++ b/48/CH5/EX5.5/eg_5_5.sce
@@ -0,0 +1,9 @@
+clc;
+clear;
+disp("Given minimal contact network is T(w,x,y,z)=wxy+wxz+w^x^y^z^+w^x^yz");
+disp("T(w,x,y,z)=wx(y+z)+w^x^(y^z^+yz)");
+disp("Draw the equivalent series parallel circuit of T");
+disp("Interchange the locations of contacts of w^ and x^ and connect the nodes");
+disp("By connecting in the above manner there is no logical effect since the connection path is not at all used");
+disp("now the lower branch of yz+y^z^ can be written as (y+z^)(y^+z) so transfer contacts can be used");
+disp("This parallel connection enables us to combine two parallel z contacts and thus the minimum spring connection is obtained"); \ No newline at end of file
diff --git a/48/CH6/EX6.1/eg_6_1.sce b/48/CH6/EX6.1/eg_6_1.sce
new file mode 100755
index 000000000..c17fbad3b
--- /dev/null
+++ b/48/CH6/EX6.1/eg_6_1.sce
@@ -0,0 +1,8 @@
+clc;
+clear;
+disp("Given function f(w,x,y,z) can be written as follows");
+disp("f(w,x,y,z)=w^x^z^+wx^z+w^yz+wyz^");
+disp("f(w,x,y,z)=((w^z^+wz)x^+(w^z+wz^)y)");
+disp("let Q=w^z^+wz");
+disp("then we can rewrite f as f(w,x,y,z)=Qx^+Q^y");
+disp("f(w,x,y,z)=Qx^+Q^y=F[Q(w,z),x,y]");
diff --git a/48/CH6/EX6.3/eg_6_3.sce b/48/CH6/EX6.3/eg_6_3.sce
new file mode 100755
index 000000000..4bcfc1ff6
--- /dev/null
+++ b/48/CH6/EX6.3/eg_6_3.sce
@@ -0,0 +1,50 @@
+clc;
+clear;
+//determines the row and column multiplicity of a mtraix
+//m=input("enter the number of variables in the function=");
+m=4;
+for i=1:m
+ for j=1:m
+ x(i,j)=0;
+ end
+end
+//k='y';
+//disp("Enter the cells index whose values are 1 in the matrix representing your function");
+//while(k~='n')
+// i=input("x index =");
+// j=input("y index =");
+// x(i,j)=1;
+// k=input("If you want to enter more enter y(in quotes) else n(in quotes) :");
+//end
+x=[1 0 1 1;
+ 0 0 1 0;
+ 0 1 1 1;
+ 1 1 0 1];
+l=0;
+//checks every row and find the max no of ones in a row.
+for i=1:m
+ k=0;
+ for j=1:m
+ if(x(i,j)==1)
+ k=k+1;
+ end
+ end
+ if(k>l)
+ l=k;
+ end
+end
+disp(l,"Row multiplicity =");
+l=0;
+//checks every column and find the max no of ones in a column.
+for j=1:m
+ k=0;
+ for i=1:m
+ if(x(i,j)==1)
+ k=k+1;
+ end
+ end
+ if(k>l)
+ l=k;
+ end
+end
+disp(l,"Column multiplicity ="); \ No newline at end of file
diff --git a/48/CH6/EX6.6/eg_6_6.sce b/48/CH6/EX6.6/eg_6_6.sce
new file mode 100755
index 000000000..128b2ff9b
--- /dev/null
+++ b/48/CH6/EX6.6/eg_6_6.sce
@@ -0,0 +1,8 @@
+clc;
+clear;
+disp("f(x,y,z)=x^y^z+xy^z^+x^yz^");
+disp("since interchanging any two variables gives us the same equation");
+disp("for example interchange x and y");
+disp("f(y,x,z)=y^x^z+yx^z^+y^xz^");
+disp("f(x,y,z)=f(y,x,z)");
+disp("So the function f(x,y,z) is symmetric"); \ No newline at end of file
diff --git a/48/CH6/EX6.7/eg_6_7.sce b/48/CH6/EX6.7/eg_6_7.sce
new file mode 100755
index 000000000..c22019989
--- /dev/null
+++ b/48/CH6/EX6.7/eg_6_7.sce
@@ -0,0 +1,8 @@
+clc;
+clear;
+disp("f(x1,x2,x3)=x1^x2^x3^+x1x2^x3+x1^x2x3");
+disp("you can check that above equatioin is not symmetric in x1,x2,x3");
+disp("But it is symmetric in x1,x2,x3^");
+disp("let us verify it with interchanging x1 and x3^");
+disp("f(x3^,x2,x1)=x3x2^x1+x3^x2^x1^+x3x2x1^");
+disp("you can identify that f(x1,x2,x3)=f(x3^,x2,x1)"); \ No newline at end of file
diff --git a/48/CH7/EX7.1/eg_7_1.sce b/48/CH7/EX7.1/eg_7_1.sce
new file mode 100755
index 000000000..e647740e4
--- /dev/null
+++ b/48/CH7/EX7.1/eg_7_1.sce
@@ -0,0 +1,45 @@
+clc;
+clear;
+//takes the input and check whether it is valid or not
+x1=input("x1 = ");
+while(x1~=0 & x1~=1)
+ disp("enter a valid logical level");
+ x1=input("x1 = ");
+end
+x2=input("x2 = ");
+while(x2~=0 & x2~=1)
+ disp("enter a valid logical level");
+ x2=input("x = ");
+end
+x3=input("x3 = ");
+while(x3~=0 & x3~=1)
+ disp("enter a valid logical level");
+ x3=input("x3 = ");
+end
+f=-x1+(2*x2)+x3;
+if(f>0.5) then
+ f=1;
+else
+ f=0;
+end
+disp(f,"output y is");
+m=1;
+//displays the output of the above expression for all the combinations of inputs.
+for x=0:1
+ for y=0:1
+ for z=0:1
+ f1(m,1)=x;
+ f1(m,2)=y;
+ f2(m,3)=z;
+ f1(m,4)=-x+(2*y)+z;
+ if(f1(m,4)>0.5) then
+ f1(m,5)=1;
+ else
+ f1(m,5)=0;
+ end
+ m=m+1;
+ end
+ end
+end
+disp(" x1 x2 x3 sum y");
+disp(f1)
diff --git a/48/CH7/EX7.2/eg_7_2.sce b/48/CH7/EX7.2/eg_7_2.sce
new file mode 100755
index 000000000..dde6168a1
--- /dev/null
+++ b/48/CH7/EX7.2/eg_7_2.sce
@@ -0,0 +1,53 @@
+clc;
+clear;
+y='y';
+i=1;
+//Takes the equivalent decimal value of the min terms for eg: x^yz=011=3
+while(y=='y')
+ disp("enter the minterm of a 3 variable function");
+ x(i)=input(": ");
+ while(x(i)>7)
+ disp("enter a valid minterm");
+ end
+ disp("press y if you want to enter more min terms else n :");
+ y=input("");
+ i=i+1;
+end
+a=1;
+//Generating truth table for determining the inequalities
+for i=0:1
+ for j=0:1
+ for k=0:1
+ for z=1:length(x)
+ if(x(z)==a-1);
+ f(a,4)=1;
+ end
+ end
+ f(a,1)=i;
+ f(a,2)=j;
+ f(a,3)=k;
+ a=a+1;
+ end
+ end
+end
+//displaying the truth table
+disp(" x1 x2 x3 f");
+disp(f);
+disp("");
+a=1;
+//generating inequalities
+for i=0:1
+ for j=0:1
+ for k=0:1
+ if(f(a,4)==1)
+ printf('%3d * w1 + %3d * w2 + %3d * w3>=T',f(a,1),f(a,2),f(a,3))
+ disp("")
+ else
+ printf('%3d * w1 + %3d * w2 + %3d * w3<T',f(a,1),f(a,2),f(a,3))
+ disp("")
+ end
+ a=a+1;
+ end
+ end
+end
+disp("By solving the above inequalities we can get the values of weights and T"); \ No newline at end of file
diff --git a/48/CH7/EX7.3/eg_7_3.sce b/48/CH7/EX7.3/eg_7_3.sce
new file mode 100755
index 000000000..146ba1a76
--- /dev/null
+++ b/48/CH7/EX7.3/eg_7_3.sce
@@ -0,0 +1,6 @@
+clc;
+clear;
+disp("Given function is f=x1x2^+x2x3^");
+disp("Since x1 has no complemented form in the above function f,f is positive in x1");
+disp("x2 has both complemented and uncomplemented forms in f so f is not unate in x2");
+disp("x3 is only in complemented form so f is negative in x3"); \ No newline at end of file
diff --git a/48/CH7/EX7.4/eg_7_4.sce b/48/CH7/EX7.4/eg_7_4.sce
new file mode 100755
index 000000000..0d06792bf
--- /dev/null
+++ b/48/CH7/EX7.4/eg_7_4.sce
@@ -0,0 +1,5 @@
+clc;
+clear;
+disp("given function is f=x1^x2+x2x3^");
+disp("Since the varibles x1 and x3 are only in their complemented form f is negative and unate in x1 and x3");
+disp("even x2 is only in its uncomplemented form so f is positive in x2"); \ No newline at end of file
diff --git a/48/CH7/EX7.5/eg_7_5.sce b/48/CH7/EX7.5/eg_7_5.sce
new file mode 100755
index 000000000..55fc00da7
--- /dev/null
+++ b/48/CH7/EX7.5/eg_7_5.sce
@@ -0,0 +1,22 @@
+clc;
+clear;
+n=input("Enter the no of input variables :");
+//Input the true minimal vertices
+v=input("Enter the no of minimal true vertices :");
+disp("vertex will be in the form of 101 if it is 3 variable");
+for i=1:v
+ printf('Vertex %3d :',i)
+ s(i)=input(" ");
+end
+tv=input("enter a vertex which you want find whether true vertex or not");
+//determines whether the vertex is a true or not by comparing it with the true minimal vertices
+for i=1:v
+ if(tv>s(i))
+ disp("It is a true vertex");
+ break;
+ else
+ if(i==v)
+ disp("It is not a true vertex since it is not > than any of the min vertices");
+ end
+ end
+end \ No newline at end of file
diff --git a/48/CH8/EX8.1/eg_8_1.sce b/48/CH8/EX8.1/eg_8_1.sce
new file mode 100755
index 000000000..ffb05f54a
--- /dev/null
+++ b/48/CH8/EX8.1/eg_8_1.sce
@@ -0,0 +1,17 @@
+clc;
+clear;
+disp("To find whether h is s-a-0 or not");
+disp("First we have to express f as function of h and x1,x2,x3,x4");
+disp("Simplifying the given logical circuit we obtain the expression of output as");
+disp("f(X,h) = x1x2x3x4 + h(x2x3 + x1^x2^x3^x4^))");
+disp("Here h = x2^x3^");
+disp("let G = x1x2x3x4 & H = h(x2x3 + x1^x2^x3^x4^)");
+disp("Taking derivative on both sides");
+disp("df/dh=G^dH/dh");
+disp("Appllying the formula d[f(X)+g(X)]/dx=f^(X)dg(X)/dx exor g^(X)df(X)/dx exor df(X)/dx.dg(X)/dx");
+disp("df/dh=G^dH/dh=(x1^+x2^+x3^+x4^)(x2x3+x1^x2^x3^x4^)");
+disp("df/dh=x1^x2x3+x2x3x4^+x1^x2^x3^x4^");
+disp("To find tests for h s-a-0 we compute the values for which h(df/dh)=1");
+disp("hdf/dh=x2^x3^(x1^x2x3+x2x3x4^+x1^x2^x3^x4^)");
+disp("hdf/dh=x1^x2^x3^x4^");
+disp("Thus the test set for h s-a-0 is X(0,0,0,0)"); \ No newline at end of file
diff --git a/48/CH8/EX8.2/eg_8_2.sce b/48/CH8/EX8.2/eg_8_2.sce
new file mode 100755
index 000000000..5f046e58a
--- /dev/null
+++ b/48/CH8/EX8.2/eg_8_2.sce
@@ -0,0 +1,11 @@
+clc;
+clear;
+disp("To prove whether there possibiliy of identifing the fault by sensitising just a single path");
+disp("Let us sensitize the path G3 G6 G9");
+disp("This requires G6=1 , G10=0 , G11=0 ,G8=0 ");
+disp("Which inturn requires x2=0 and x3=0 (since G6=1)");
+disp("G10=0 impiles that x4=1 regardless of whether there is a fault or not");
+disp("G11=0 implies G7=1(since x3=0) which in turn implies x4=0");
+disp("Evidently to satisfy both G10=0 and G11=0 we must set conflicting requirements on x4 and thus have a contradiction");
+disp("By symmetry of the circuit it is obvious that an attempt to sensitize the path through G10 will also fail");
+disp("Hence the method of one dimensional path sensitizing fails to generate the test inputs to detect the fault");
diff --git a/48/CH8/EX8.3/eg_8_3.sce b/48/CH8/EX8.3/eg_8_3.sce
new file mode 100755
index 000000000..1eb965299
--- /dev/null
+++ b/48/CH8/EX8.3/eg_8_3.sce
@@ -0,0 +1,8 @@
+clc;
+clear;
+disp("BY following the procedure discussed in Section 8.6");
+disp("we find that {a}={0 or 2 or 3,9,15}");
+disp("and {b}={7,8.11.13.14}");
+disp("Thus the minimal sets of tests for the above network are ");
+disp("{T}={0 or 2 or 3,7,8,9,11,13,14,15}");
+disp("In this case the s-tests and b-tests correspond to s-a-0 and s-a-1 respectively"); \ No newline at end of file
diff --git a/48/CH8/EX8.4/eg_8_4.sce b/48/CH8/EX8.4/eg_8_4.sce
new file mode 100755
index 000000000..4c9adb28d
--- /dev/null
+++ b/48/CH8/EX8.4/eg_8_4.sce
@@ -0,0 +1,9 @@
+clc;
+clear;
+disp("Various errors associated with some commonly used gates are summarised below");
+disp("A 0-to-1 error in an AND gate with R identical inputs is subcritical");
+disp("since the output depends on the other input so it is subcritical");
+disp("If the same 0-to-1 error is in a OR gate with R identical inputs then it is critical error");
+disp("since an error input struck at 1 will make the output of OR gate to 1 all the time");
+disp("Similarly the critical error of AND gate is subcritical error of OR gate");
+disp("Similarly the error classicfication in various gates is mentioned in Table 8-2") \ No newline at end of file
diff --git a/48/DEPENDENCIES/bin21dec.sci b/48/DEPENDENCIES/bin21dec.sci
new file mode 100755
index 000000000..439803002
--- /dev/null
+++ b/48/DEPENDENCIES/bin21dec.sci
@@ -0,0 +1,46 @@
+//bin21dec is a function whcih converts any binary number given to it will output its equivalent decimal number
+//pass the binary number as an argument to the function
+// For eg:bin21decimal(1010)
+//Will give an output of 10
+
+function [temp]=bin21dec(bin)
+ i=1;w=1;
+
+ temp1=floor(bin); //separating integer part from the given number
+ temp2=modulo(bin,1); //separating decimal part from the given number
+ temp2=temp2*10^3; //converting decimal value to interger for convenience
+
+ while(temp1>0) //storing each integer digit in vector for convenience
+ p(i)=modulo(temp1,10);
+ temp1=floor(temp1/10);
+ i=i+1;
+ end
+
+ while(temp2>0) //storing each integer digit in vector for convenience
+ q(w)=modulo(temp2,2);
+ temp2=(temp2/10);
+ temp2=floor(temp2);
+ w=w+1;
+ end
+
+ temp1=0; //clearing the temporary variable 'temp2'
+
+ for i=1:length(p) //checking whether it is binary or not.
+ if(p(i)>1) then
+ disp('not a binary number');
+ abort;
+ end
+ end
+
+ for i=1:length(p) //multipliying the bits of integer part with their position values and adding
+ temp1=temp1+(p(i)*2^(i-1));
+ end
+
+ temp2=0; //clearing the temporary variable 'temp2'
+
+ for z=1:w-1 //multipliying the bits of decimal part with their position values and adding
+ temp2=temp2+(q(z)*2^(-1*(4-z)));
+ end
+
+ temp=temp1+temp2; //finally adding both the integer and decimal parts to get total output.
+endfunction \ No newline at end of file
diff --git a/48/DEPENDENCIES/check.sci b/48/DEPENDENCIES/check.sci
new file mode 100755
index 000000000..cbe43cb5e
--- /dev/null
+++ b/48/DEPENDENCIES/check.sci
@@ -0,0 +1,9 @@
+function out= check(a,b,c,d)
+ for i=1:max(size(a));
+ if(a(i,1)==b(i,1) & b(i,1)==c(i,1) & c(i,1)==d(i,1))
+ out(i)=0;
+ else
+ out(i)=1;
+ end
+ end
+endfunction \ No newline at end of file
diff --git a/48/DEPENDENCIES/dec21bin.sci b/48/DEPENDENCIES/dec21bin.sci
new file mode 100755
index 000000000..103675c5d
--- /dev/null
+++ b/48/DEPENDENCIES/dec21bin.sci
@@ -0,0 +1,40 @@
+//dec21bin is a function whcih converts any decimal number given to it will output its equivalent binary number
+//pass the decimal number as an argument to the function
+// For eg:dec21bin(10)
+//Will give an output of 1010
+
+function [temp]=dec21bin(dec)
+ temp2=floor(dec); //separating integer part from the given number
+ temp4=modulo(dec,1); //separating decimal part from the given number
+
+ format('v',18); //changing the default precision to 18
+
+ i=1;p=0;x=1; //flag bits
+
+ while(temp2>0) //storing each integer digit in vector for convenience
+ p(i)=(modulo(floor(temp2),2))
+ temp2=floor(temp2)/2;
+ i=i+1;
+ end
+
+ temp2=0; //clearing the temporary variable 'temp2'
+
+ for j=1:length(p) //multipliying the bits of integer part with their position values and adding
+ temp2=temp2+(p(j)*10^(j-1));
+ end
+
+ while(temp4~=0) //storing each integer digit in vector for convenience
+ temp4=temp4*2;
+ d(x)=floor(temp4);
+ x=x+1;
+ temp4=modulo(temp4,1);
+ end
+
+ temp5=0; //clearing the temporary variable 'temp2'
+
+ for j=1:x-1 //multipliying the bits of decimal part with their position values and adding
+ temp5=temp5+(10^(-1*j)*d(j))
+ end
+
+ temp=temp2+temp5; //finally adding both the integer and decimal parts to get total output.
+endfunction \ No newline at end of file
diff --git a/48/DEPENDENCIES/donkmap.sci b/48/DEPENDENCIES/donkmap.sci
new file mode 100755
index 000000000..a743021b5
--- /dev/null
+++ b/48/DEPENDENCIES/donkmap.sci
@@ -0,0 +1,282 @@
+function []=donkmap(k,l)
+ n=4; //four variable kmap
+ k(:,:,2)=zeros(n,n); //temporary matrix to know whether a element is paired or not
+ //declaring notations to display output
+ var=['y' 'z' 'w' 'x'];
+ p1=['y''z''' 'y''z' 'yz' 'yz'''];
+ p2=['w''x''';'w''x';'wx';'wx'''];
+ //minimum redundant elements accepted while pairing
+ cmn4=4;
+ cmn2=2;
+ temp=1;
+ printf('f');
+ printf('%1d',l);
+ printf("=");
+ //16 cells
+ for i=1:n
+ for j=1:n
+ if(k(i,j)~=1 | k(i,j)~=2)
+ temp=0;
+ break;
+ end
+ end
+ end
+ if(temp==1)
+ printf("1");
+ abort;
+ end
+ //8 cells
+ z1=ones(2,4);
+ z2=ones(4,2);
+ temp1=['00' '01' '11' '10'];
+ temp2=temp1';
+ for i=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,:,1);k(t,:,1)];
+ if(number_of(z,0)==0 & number_of(z,1)>1)
+ k(i,:,2)=[1 1 1 1];
+ k(t,:,2)=[1 1 1 1];
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ printf('+');
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ printf('+');
+ break;
+ end
+ end
+ end
+ end
+ end
+ for j=1:n
+ if(j==4)
+ t=1;
+ else
+ t=j+1;
+ end
+ z=[k(:,j,1) k(:,t,1)];
+ if(number_of(z,0)==0 & number_of(z,1)>0)
+ k(:,j,2)=[1;1;1;1];
+ k(:,t,2)=[1;1;1;1];
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ printf('+');
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ printf('+');
+ break;
+ end
+ end
+ end
+ end
+ end
+ //4 cells
+ z1=ones(1,4);
+ z2=ones(4,1);
+ z3=ones(2,2);
+ temp1=['00' '01' '11' '10'];
+ temp2=temp1';
+ for t=1:n
+ z=k(t,:,1);
+ no=number_of(k(t,:,2),1);
+ if(number_of(z,0)==0 & no<cmn4 & number_of(z,1)>0)
+ k(t,:,2)=z1;
+ a=strsplit(temp1(1,t));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(a(in)=='1')
+ printf(var(in));
+ end
+ end
+ printf("+");
+ end
+ end
+ for t=1:n
+ z=k(:,t,1);
+ no=number_of(k(:,t,2),1);
+ if(number_of(z,0)==0 & no<cmn4 & number_of(z,1)>0)
+ k(:,t,2)=z2;
+ a=strsplit(temp2(t,1));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ printf("+");
+ end
+ end
+ for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z4=[k(i,j,1) k(i,t2,1);k(t1,j,1) k(t1,t2,1)];
+ z5=[k(i,j,2) k(i,t2,2);k(t1,j,2) k(t1,t2,2)];
+ no=number_of(z5,1);
+ if(number_of(z4,0)==0 & no<cmn4 & number_of(z4,1)>0)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ k(t1,j,2)=1;
+ k(t1,t2,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ printf("+");
+ end
+ end
+ end
+ //2 cells
+ z6=[1 1];
+ z7=z6';
+ for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z8=[k(i,j,1) k(i,t2,1)];
+ z9=[k(i,j,2) k(i,t2,2)];
+ no1=number_of(z9,1);
+ if(number_of(z8,0)==0 & no1<cmn2 & number_of(z8,1)>0)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p1(1,i));
+ printf('%s''',var(2+in));
+ printf("+");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p1(1,i));
+ printf(var(2+in));
+ printf("+");
+ end
+ end
+ end
+ end
+ end
+ for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z10=[k(i,j,1);k(t1,j,1)];
+ z11=[k(i,j,2);k(t1,j,2)];
+ no2=number_of(z11,1);
+ if(number_of(z10,0)==0 & no2<cmn2 & number_of(z10,1)>0)
+ k(i,j,2)=1;
+ k(t1,j,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p2(j,1));
+ printf('%s''',var(in));
+ printf("+");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p2(j,1));
+ printf(var(in));
+ printf("+");
+ end
+ end
+ end
+ end
+ end
+ //single cell
+ for i=1:n
+ for j=1:n
+ if(k(i,j,2)==0 & k(i,j,1)==1)
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp2(i,1));
+ for in=1:max(size(a(:,1)))
+ if(a(in,1)=='1')
+ printf(var(in+2));
+ else
+ if(a(in,1)=='0')
+ printf('%s''',var(2+in));
+ end
+ end
+ end
+ for in=1:max(size(b(:,1)))
+ if(b(in,1)=='1')
+ printf(var(in));
+ else
+ if(b(in,1)=='0')
+ printf('%s''',var(in));
+ end
+ end
+ end
+ if(i~=4 & j~=4)
+ printf("+");
+ end
+ end
+ end
+ end
+ printf("0");
+ disp(" ")
+endfunction \ No newline at end of file
diff --git a/48/DEPENDENCIES/karmap.sci b/48/DEPENDENCIES/karmap.sci
new file mode 100755
index 000000000..4447dd62b
--- /dev/null
+++ b/48/DEPENDENCIES/karmap.sci
@@ -0,0 +1,276 @@
+function []=karmap(k)
+ n=4;
+ k(:,:,2)=zeros(n,n);
+ var=['y' 'z' 'w' 'x'];
+ //var=['w' 'x' 'y' 'z'];
+ p1=['y''z''' 'y''z' 'yz' 'yz'''];
+ p2=['w''x''';'w''x';'wx';'wx'''];
+ cmn4=4;
+ cmn2=2;
+ temp=1;
+ //16 cells
+ for i=1:n
+ for j=1:n
+ if(k(i,j)~=1)
+ temp=0;
+ break;
+ end
+ end
+ end
+ if(temp==1)
+ printf("1");
+ abort;
+ end
+ //8 cells
+ z1=ones(2,4);
+ z2=ones(4,2);
+ temp1=['00' '01' '11' '10'];
+ temp2=temp1';
+ for i=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,:,1);k(t,:,1)];
+ if(z==z1)
+ k(i,:,2)=[1 1 1 1];
+ k(t,:,2)=[1 1 1 1];
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ disp("");
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ disp("");
+ break;
+ end
+ end
+ end
+ end
+ end
+ for j=1:n
+ if(j==4)
+ t=1;
+ else
+ t=j+1;
+ end
+ z=[k(:,j,1) k(:,t,1)];
+ if(z==z2)
+ k(:,j,2)=[1;1;1;1];
+ k(:,t,2)=[1;1;1;1];
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ disp("");
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ disp("");
+ break;
+ end
+ end
+ end
+ end
+ end
+ //4 cells
+ z1=ones(1,4);
+ z2=ones(4,1);
+ z3=ones(2,2);
+ temp1=['00' '01' '11' '10'];
+ temp2=temp1';
+ for t=1:n
+ z=k(t,:,1);
+ no=number_of(k(t,:,2),1);
+ if(z==z1 & no<cmn4)
+ k(t,:,2)=z1;
+ a=strsplit(temp1(1,t));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(a(in)=='1')
+ printf(var(in));
+ end
+ end
+ disp("");
+ end
+ end
+ for t=1:n
+ z=k(:,t,1);
+ no=number_of(k(:,t,2),1);
+ if(z==z2 & no<cmn4)
+ k(:,t,2)=z2;
+ a=strsplit(temp2(t,1));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ disp("");
+ end
+ end
+ for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z4=[k(i,j,1) k(i,t2,1);k(t1,j,1) k(t1,t2,1)];
+ z5=[k(i,j,2) k(i,t2,2);k(t1,j,2) k(t1,t2,2)];
+ no=number_of(z5,1);
+ if(z4==z3 & no<cmn4)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ k(t1,j,2)=1;
+ k(t1,t2,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ disp("");
+ end
+ end
+ end
+ //2 cells
+ z6=[1 1];
+ z7=z6';
+ for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z8=[k(i,j,1) k(i,t2,1)];
+ z9=[k(i,j,2) k(i,t2,2)];
+ no1=number_of(z9,1);
+ if(z8==z6 & no1<cmn2 & i+j~=2)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p1(1,i));
+ printf('%s''',var(2+in));
+ disp("");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p1(1,i));
+ printf(var(2+in));
+ disp("");
+ end
+ end
+ end
+ end
+ end
+ for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z10=[k(i,j,1);k(t1,j,1)];
+ z11=[k(i,j,2);k(t1,j,2)];
+ no2=number_of(z11,1);
+ if(z10==z7 & no2<cmn2)
+ k(i,j,2)=1;
+ k(t1,j,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p2(j,1));
+ printf('%s''',var(in));
+ disp("");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p2(j,1));
+ printf(var(in));
+ disp("");
+ end
+ end
+ end
+ end
+ end
+ //single cell
+ for i=1:n
+ for j=1:n
+ if(k(i,j,2)==0 & k(i,j,1)==1)
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp2(i,1));
+ for in=1:max(size(a(:,1)))
+ if(a(in,1)=='1')
+ printf(var(in+2));
+ else
+ if(a(in,1)=='0')
+ printf('%s''',var(2+in));
+ end
+ end
+ end
+ for in=1:max(size(b(:,1)))
+ if(b(in,1)=='1')
+ printf(var(in));
+ else
+ if(b(in,1)=='0')
+ printf('%s''',var(in));
+ end
+ end
+ end
+ if(i~=4 & j~=4)
+ disp("");
+ end
+ end
+ end
+ end
+endfunction \ No newline at end of file
diff --git a/48/DEPENDENCIES/karmap1.sci b/48/DEPENDENCIES/karmap1.sci
new file mode 100755
index 000000000..d8c327600
--- /dev/null
+++ b/48/DEPENDENCIES/karmap1.sci
@@ -0,0 +1,275 @@
+function []=karmap1(k)
+ n=4;
+ k(:,:,2)=zeros(n,n);
+ var=['y' 'z' 'w' 'x'];
+ p1=['y''z''' 'y''z' 'yz' 'yz'''];
+ p2=['w''x''';'w''x';'wx';'wx'''];
+ cmn4=1;
+ cmn2=1;
+ temp=1;
+ //16 cells
+ for i=1:n
+ for j=1:n
+ if(k(i,j)~=1)
+ temp=0;
+ break;
+ end
+ end
+ end
+ if(temp==1)
+ printf("1");
+ abort;
+ end
+ //8 cells
+ z1=ones(2,4);
+ z2=ones(4,2);
+ temp1=['00' '01' '11' '10'];
+ temp2=temp1';
+ for i=1:n
+ if(i==4)
+ t=1;
+ else
+ t=i+1;
+ end
+ z=[k(i,:,1);k(t,:,1)];
+ if(z==z1)
+ k(i,:,2)=[1 1 1 1];
+ k(t,:,2)=[1 1 1 1];
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ disp("");
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ disp("");
+ break;
+ end
+ end
+ end
+ end
+ end
+ for j=1:n
+ if(j==4)
+ t=1;
+ else
+ t=j+1;
+ end
+ z=[k(:,j,1) k(:,t,1)];
+ if(z==z2)
+ k(:,j,2)=[1;1;1;1];
+ k(:,t,2)=[1;1;1;1];
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ disp("");
+ break;
+ else
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ disp("");
+ break;
+ end
+ end
+ end
+ end
+ end
+ //4 cells
+ z1=ones(1,4);
+ z2=ones(4,1);
+ z3=ones(2,2);
+ temp1=['00' '01' '11' '10'];
+ temp2=temp1';
+ for t=1:n
+ z=k(t,:,1);
+ no=number_of(k(t,:,2),1);
+ if(z==z1 & no<cmn4)
+ k(t,:,2)=z1;
+ a=strsplit(temp1(1,t));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(a(in)=='1')
+ printf(var(in));
+ end
+ end
+ disp("");
+ end
+ end
+ for t=1:n
+ z=k(:,t,1);
+ no=number_of(k(:,t,2),1);
+ if(z==z2 & no<cmn4)
+ k(:,t,2)=z2;
+ a=strsplit(temp2(t,1));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ disp("");
+ end
+ end
+ for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z4=[k(i,j,1) k(i,t2,1);k(t1,j,1) k(t1,t2,1)];
+ z5=[k(i,j,2) k(i,t2,2);k(t1,j,2) k(t1,t2,2)];
+ no=number_of(z5,1);
+ if(z4==z3 & no<cmn4)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ k(t1,j,2)=1;
+ k(t1,t2,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(in));
+ end
+ end
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(2+in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(2+in));
+ end
+ end
+ disp("");
+ end
+ end
+ end
+ //2 cells
+ z6=[1 1];
+ z7=z6';
+ for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z8=[k(i,j,1) k(i,t2,1)];
+ z9=[k(i,j,2) k(i,t2,2)];
+ no1=number_of(z9,1);
+ if(z8==z6 & no1<cmn2)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp1(1,t2));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p1(1,i));
+ printf('%s''',var(2+in));
+ disp("");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p1(1,i));
+ printf(var(2+in));
+ disp("");
+ end
+ end
+ end
+ end
+ end
+ for i=1:n
+ for j=1:n
+ if(i==n)
+ t1=1;
+ else
+ t1=i+1;
+ end
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z10=[k(i,j,1);k(t1,j,1)];
+ z11=[k(i,j,2);k(t1,j,2)];
+ no2=number_of(z11);
+ if(z10==z7 & no2<cmn2)
+ k(i,j,2)=1;
+ k(t1,j,2)=1;
+ a=strsplit(temp2(i,1));
+ b=strsplit(temp2(t1,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf(p2(j,1));
+ printf('%s''',var(in));
+ disp("");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(p2(j,1));
+ printf(var(in));
+ disp("");
+ end
+ end
+ end
+ end
+ end
+ //single cell
+ for i=1:n
+ for j=1:n
+ if(k(i,j,2)==0 & k(i,j,1)==1)
+ a=strsplit(temp1(1,j));
+ b=strsplit(temp2(i,1));
+ for in=1:max(size(a(:,1)))
+ if(a(in,1)=='1')
+ printf(var(in+2));
+ else
+ if(a(in,1)=='0')
+ printf('%s''',var(2+in));
+ end
+ end
+ end
+ for in=1:max(size(b(:,1)))
+ if(b(in,1)=='1')
+ printf(var(in));
+ else
+ if(b(in,1)=='0')
+ printf('%s''',var(in));
+ end
+ end
+ end
+ if(i~=4 & j~=4)
+ disp("");
+ end
+ end
+ end
+ end
+endfunction \ No newline at end of file
diff --git a/48/DEPENDENCIES/karmap3.sci b/48/DEPENDENCIES/karmap3.sci
new file mode 100755
index 000000000..356f07f5b
--- /dev/null
+++ b/48/DEPENDENCIES/karmap3.sci
@@ -0,0 +1,148 @@
+function []=karmap3(k)
+ n=4; //three variable kmap
+ m=2
+ k(:,:,2)=zeros(m,n);
+ var=['z' 'x' 'y'];
+ p1=['z''' 'z'];
+ p2=['x''y''';'x''y';'xy';'xy'''];
+ cmn4=4;
+ cmn2=3;
+ temp=1;
+ printf('The minimal ecpression of the given Kmap ');
+ disp(k(:,:,1));
+ disp("is :");
+ printf('f');
+ printf("=");
+ //8 cells
+ for i=1:m
+ for j=1:n
+ if(k(i,j)~=1 & k(i,j)~=2)
+ temp=0;
+ break;
+ end
+ end
+ end
+ if(temp==1)
+ printf("1");
+ abort;
+ end
+ //4 cells
+ z1=ones(1,4);
+ z2=ones(4,1);
+ z3=ones(2,2);
+ temp1=['0' '1'];
+ temp2=['00';'01';'11';'10'];
+ for t=1:m
+ z=k(t,:,1);
+ no=number_of(k(t,:,2),1);
+ if(number_of(z,0)==0 & no<cmn4 & number_of(z,1)>0)
+ k(t,:,2)=z1;
+ a=strsplit(temp1(1,t));
+ for in=1:max(size(a))
+ if(a(in)=='0')
+ printf('%s''',var(in));
+ end
+ if(a(in)=='1')
+ printf(var(in));
+ end
+ end
+ printf("+");
+ end
+ end
+ for i=1:m-1
+ for j=1:n
+ t1=i+1;
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z4=[k(i,j,1) k(i,t2,1);k(t1,j,1) k(t1,t2,1)];
+ z5=[k(i,j,2) k(i,t2,2);k(t1,j,2) k(t1,t2,2)];
+ no=number_of(z5);
+ if(number_of(z4,0)==0 & no<cmn4 & number_of(z4,1)>0)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ k(t1,j,2)=1;
+ k(t1,t2,2)=1;
+ a=strsplit(temp2(j,1));
+ b=strsplit(temp2(t2,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(1+in));
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(1+in));
+ end
+ end
+ printf("+");
+ end
+ end
+ end
+ //2 cells
+ z6=[1 1];
+ z7=z6';
+ for i=1:m
+ for j=1:n
+ t1=i+1;
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z8=[k(i,j,1) k(i,t2,1)];
+ z9=[k(i,j,2) k(i,t2,2)];
+ no1=number_of(z9,1);
+ if(number_of(z8,0)==0 & no1<cmn2 & number_of(z8,1)>0)
+ k(i,j,2)=1;
+ k(i,t2,2)=1;
+ printf(p1(1,i));
+ a=strsplit(temp2(j,1));
+ b=strsplit(temp2(t2,1));
+ c=strcmp(a,b);
+ for in=1:max(size(c))
+ if(c(in)==0 & a(in)=='0')
+ printf('%s''',var(1+in));
+ printf("+");
+ end
+ if(c(in)==0 & a(in)=='1')
+ printf(var(1+in));
+ printf("+");
+ end
+ end
+ end
+ end
+ end
+ for i=1:m-1
+ for j=1:n
+ t1=i+1;
+ if(j==n)
+ t2=1;
+ else
+ t2=j+1;
+ end
+ z10=[k(i,j,1);k(t1,j,1)];
+ z11=[k(i,j,2);k(t1,j,2)];
+ no2=number_of(z11,1);
+ if(number_of(z10,0)==0 & no2<cmn2 & number_of(z10,1)>0)
+ k(i,j,2)=1;
+ k(t1,j,2)=1;
+ printf(p2(j,1));
+ printf("+");
+ end
+ end
+ end
+ //single cell
+ for i=1:m
+ for j=1:n
+ if(k(i,j,2)==0 & k(i,j,1)==1)
+ printf(p1(1,i));
+ printf(p2(j,1));
+ printf("+");
+ end
+ end
+ end
+ printf("0");
+ disp(" ")
+endfunction \ No newline at end of file
diff --git a/48/DEPENDENCIES/noof3.sci b/48/DEPENDENCIES/noof3.sci
new file mode 100755
index 000000000..d41b0b49a
--- /dev/null
+++ b/48/DEPENDENCIES/noof3.sci
@@ -0,0 +1,13 @@
+//finds the number of z's in the 3 dimensional matrix A
+function res=noof3(a,z)
+ res=0;
+ for i=1:max(size(a(:,1,1)))
+ for j=1:max(size(a(1,:,1)))
+ for l=1:2
+ if(a(i,j,l)==z)
+ res=res+1;
+ end
+ end
+ end
+ end
+endfunction \ No newline at end of file
diff --git a/48/DEPENDENCIES/number_of.sci b/48/DEPENDENCIES/number_of.sci
new file mode 100755
index 000000000..04545d348
--- /dev/null
+++ b/48/DEPENDENCIES/number_of.sci
@@ -0,0 +1,11 @@
+//finds the number of z's in the matrix A
+function res=number_of(a,z)
+ res=0;
+ for i=1:max(size(a(:,1)))
+ for j=1:max(size(a(1,:)))
+ if(a(i,j)==z)
+ res=res+1;
+ end
+ end
+ end
+endfunction \ No newline at end of file