Tuesday, May 27, 2008

Assignment 5

Assignment 5

1. Find octave commands for constructing a 256x256 matrix with entries of 0 everywhere except inside the circle with radius 50 where the values are 1.

A=zeros(256);
for x=1:256;for y=1:256;
if (x-128)^2+(y-128)^2<=2500;
A(x,y)=1;
endif;
endfor;
endfor;
Imshow(A*256)









2. Give octave commands to draw the top part of figure 6.4 in the book.

A=zeros(256);
B=zeros(256);
C=zeros(256);
for x=1:256;for y=1:256;
if (x-93)^2+(y-128)^2<=2500;
A(x,y)=1;
endif;
if (x-153)^2+(y-93)^2<=2500;
B(x,y)=1;
endif;
if (x-153)^2+(y-153)^2<=2500;
C(x,y)=1;
endif;
endfor;
endfor;
E(:,:,1)=A*255;
E(:,:,2)=B*255;
E(:,:,3)=C*255;
imshow (E)



3. Consider the black and white image from the matrix. Skew the image by a factor of s pixels. Rotate the image theta degrees

bigT=255*ones(256);
bigT(30:79,64:191)=zeros(50,128);
bigT(50:199,111:146)=zeros(150,36);

BIG T










bigT=255*ones(256);
bigT(30:79,64:191)=zeros(50,128);
bigT(50:199,111:146)=zeros(150,36);
function retval=newy(x,y,s)
retval=y+mod(x*s,256)+1;
endfunction
for x=1:256;
for y=1:256;
y1=int32(newy(x,y,1));
if(y1>256)
y1=y1-256;
endif;
bigT1(x,y1)=bigT(x,y);
endfor;
endfor;
imshow(bigT1)



Skew by a factor of 0.9 and 1














Rotation of 5pi/3

bigT=255*ones(256);
bigT(30:79,64:191)=zeros(50,128);
bigT(50:199,111:146)=zeros(150,36);
bigT2=ones(256);
for x=1:256;
for y=1:256;
xnew=int32(mod(x*cos(5*pi/3)-y*sin(5*pi/3),256)+1);
ynew=int32(mod(x*cos(5*pi/3)+y*sin(5*pi/3),256)+1);
bigT2(xnew,ynew)=bigT(x,y);
endfor
endfor; imshow(bigT2)

Sunday, May 25, 2008

Assignment 4

1. Make a matrix of 256 x 1 ones.
Answer ones(256)

2. Make a matrix of the integers 0 to 255 in a single row.
Answer [0:1:255]

3. Make a column of the integers o to 255.
Answer [0:1:255]’

4. Make a matrix 256 x 256 with the rows all the same equal to the numbers 0 to 255.
Answer ones(256)*[0:1:255]

5. Make a matrix 256 x 256 with the columns all the same equal to the numbers 0 to 255.
Answer [0:1:255]’*ones(1,6)

6. Make a matrix 256 x 256 of all zeros.
Answer zeros(256)

7. Make a matrix 256 x 256 of all ones


Answer ones(256)

8. Make a matrix 256 x 256 of the value 128.


Answer 128*ones(1,256)
9. same as # 6

10. Display the grey scale image .


Answer imshow(ones(256,1)*[0:1:255]/255)’










Display the different faces of the color cube.
11. Red - Blue
RB face of the colour cube.
RB(:,:,1)=(ones(256)*((255:-1:0)/255)’;
RB(:,:,2)=zeros(256);
RB(:,:,3)=(ones(256,1)*(0:1:255)/255);
imshow(RB)














12. Red – Green
RG face of the colour cube.
RG (:,:,1)= (ones(256,1)*(0:1:255)/255)’;
RG (:,:,2)= (ones(256,1)*((255:-1:0)/255);
RG (:,:,3)= zeros(256);
imshow(RG)

















13. Blue - Green
BG face of the colour cube.
BG (:,:,1)= zeros(256);
BG (:,:,2)= (ones(256,1)*(0:1:255)/255);
BG (:,:,3)= (ones(256,1)*((255:-1:0)/255)’;
imshow(RB)


















14. Cyan – Yellow
CY face of the colour cube.
CY(:,:,1)=[ones(256,1)*[255:-1:0]/255]';
CY(:,:,2)=ones(256);
CY(:,:,3)=[ones(256,1)*[0:1:255]/255]’;
imshow(CY)



















15. Cyan - Magenta
BW face of the colour cube.
BW (:,:,1)= zeros(256);
BW (:,:,2)= (ones(256,1)*(0:1:255)/255);
BW (:,:,3)= (ones(256,1)*((255:-1:0)/255)’;
imshow(BW)













16. Magenta – Yellow
MY(:,:,1)=ones(256);
MY(:,:,2)=(ones(256,1)*(0:1:255)/255);
MY(:,:,3)=(ones(256,1)*(255:-1:0)/255)’;
imshow(MY)


























17. Display the whole color cube in a cross with white regions where there doesen’t need to be anything.

Not exactly sure how to do this just yet.

18. Display the rainbow image that appears on the Math 5330 facebook page.

Not exactly sure how to do this just yet.


19. Shift entries of a matrix A one place left. (Wrapping)

Suppose A = [1,2,3;4,5,6;7,8,9]. To shift A left we perform the following operation.

[1,2,3;4,5,6;7,8,9]*[0,0,1;1,0,0;0,1,0] = [2,3,1;5,6,4;8,9,7]

20. Shift the entries of a matrix A one pixel down.

Suppose A = [1,2,3;4,5,6;7,8,9]. To shift A one pixel down we perform the following operation.

[0,0,0;1,0,0;0,1,0]* [1,2,3;4,5,6;7,8,9] = [0,0,0;1,2,3;4,5,6]

21. Shift entries of a matrix A one place left (drop values off left edge)

Suppose A = [1,2,3;4,5,6;7,8,9]. To shift A one place left (drop values off left edge) we perform the following operation.

[1,2,3;4,5,6;7,8,9]*[0,0,0;1,0,0;0,1,0] = [2,3,0;5,6,0;8,9,0]

22. Suppose A = [1,2,3;4,5,6;7,8,9]. To shift A one place left (drop values off bottom edge) perform the following operation.

[0,0,0;1,0,0;0,1,0]*[1,2,3;4,5,6;7,8,9] = [0,0,0;1,2,3;4,5,6]



Thursday, May 22, 2008

Mathematics 5300 Assignment 3
1. Why does color space look like a shark fin? Look at the chromaticity diagram. Make a table of wavelengths versus x, y, and z =1-x-y for each of the wavelengths. Plot wavelengths vs. x/y, y, and z/y. what do these graphs represent.

Color space looks like a shark fin because it tells us that red, green, and blue can be mixed additively to match colors. It also tells us that no 3 primary colors can reproduce the human vision.

W/ L= wavelengths
{380,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600,610,620,700}

x = {.18,.14,.12,.09,.04,.01,.015,.09,.15,.25,.32,.38,.45,.51,.57,.63,.67,.69,.73}

y = {.015,.04,.07,.13,.30,.53,.75,.89,.81,.75,.69,.62,.55,.49,.43,.37,.33,.31,.27}















































2. Consider any two colors c1 and c2 with coordinates (x1, y1), (x2, y2), in the chromaticity diagram of figure 6.5. Derive the necessary general expressions for computing the relative percentages of colors c1,c2 composing a given color that is known to lie on the straight line joining these two colors.

“The chromaticity diagram is useful for color mixing because a straight line segment joining any two points in the diagram defines all the different color variations that can be obtained by combining these two colors additively. Consider, for example, a straight line drawn from the red to the green points shown in the chromaticity diagram. If there is more red light than green light, the exact point representing the new color will be on the line segment but it will be closer to the red point than to the green point.”
(page 399 textbook)


The above statement tells us that the necessary general expression for computing percentages can be found using the distance formula. Given a line segment with endpoints c1 and c2. As well, consider a point B on the segment between the endpoints. B has coordinates (x, y)


The percentage of c1 in B is given by distance formula

{((x-x2)^2 + (y-y2)^2)^.5 / ((x1 – x2)^2 + (y1 – y2)^2)^.5} X 100%

The percentage of c2 in B is given by distance formula

{((x-x1)^2 + (y-y1)^2)^.5 / ((x1 – x2)^2 + (y1 – y2)^2)^.5} X 100%





3. Consider any three valid colors c1, c2, c3 with coordinates (x1, y1), (x2 , y2) , (x3 , y3) in the chromaticity diagram. Derive the necessary general expressions for computing the relative percentages of c1, c2, c3 composing a given color known to lie within the triangle whose vertices are at the coordinates of c1, c2, c3.


Since we are given points c1, c2, c3 in the chromaticity diagram we can connect these points to form a triangle.
















As well we can assume that there is a point c which is a point defining a given color known to lie within the triangle. Point c with coordinates (x,y) lies on a line joining c1 to the opposite side c2 c3. We can call this point c4 with coordinates (x4,y4). The same idea exists for points c5 with coordinates (x5,y5) and c6 with coordinates (x6,y6).
The distance of c from each vertex of the triangle determines the amount of each color (%) making up point c.


The percentage of c2 in c (x,y) is given by distance formula

{((x-x5)^2 + (y-y5)^2)^.5 / ((x2 – x5)^2 + (y2 – y5)^2)^.5} X 100%



The percentage of c1 in c is given by distance formula

{((x-x1)^2 + (y-y1)^2)^.5 / ((x1 – x4)^2 + (y1 – y4)^2)^.5} X 100%


The percentage of c3 in c is given by distance formula

{((x-x6)^2 + (y-y6)^2)^.5 / ((x3 – x6)^2 + (y3 – y6)^2)^.5} X 100%



4. Sketch the CMY components of the image in problem 6.6 as they would appear on a monochrome monitor.

(C,M,Y) = (1,1,1) – (R,G,B)

RGB Component CMY Component

Black (0,0,0) White (1,1,1)
Red (1,0,0) Cyan (0,1,1)
Yellow (1,1,0) Blue (0,0,1)
Green (0,1,0) Magenta (1,0,1)
Blue (0,0,1) Yellow (1,1,0)
Cyan (0,1,1) Red (1,0,0)
Magenta (1,0,1) Green (0,1,0)
White (1,1,1) Black (0,0,0)
Gray (.5,.5,.5) Gray (.5,.5,.5)

Tried the rest of the question but did not know how to proceed.

5. What is the transformation on the RGB coordinates of the image which inverts the color of the image? That is what is the transformation which sends white to black, a pixel with a lot of blue to a pixel with a little blue, a pixel with a lot of red to a pixel with a little red, etc. what effect does this transformation have on the HSI coordinates of the image?

Convert colors from to HSI to RGB first we
Multiply H x 360. The RGB components are given by the equations:

B = I(1 – S)
R = I{1 + (S cos H) / (cos(60 – H))}
G = 3I – (R + B)





To invert the color image we use the fact that (CMY) = (111) – (RGB) (page 406 textbook)
Thus
C = 1 - I{1 + (S cos H) / (cos(60 – H))}
M = 1 – (3I – (R + B))
Y = 1 – (I(1 – S))

6. Consider the transformation on color space which switches the red and blue components.
a) What does this do to the HIS coordinates of the color point?
b) Take the image of figure 6.5 and use GIMP to exchange the red and blue color channels of the image.
Tried this question but did not know how to proceed.

Pre – Amble #1

Student number mod 8 is 7
Student number mod 3 is 1
Student number mod 7 is 4

1. Show that every binary function (all 16) can be expressed as a composition of the binary operations AND / OR and NOT. Note that the function x is defined as 0011 and y is defined as 0101.( class notes)

a) X AND NOT X
Function x Not x
0 0 1
0 0 1
0 1 0
0 1 0


b)
X AND Y
Function X Y
0 0 0
0 0 1
0 1 0
1 1 1


c) X AND NOT Y
Function X Not y
0 0 1
0 0 0
1 1 1
0 1 0


d) X AND X
Function X X
0 0 0
0 0 0
1 1 1
1 1 1


e) NOT X AND Y
Function NOT X Y
0 1 0
1 1 1
0 0 0
0 0 1









f) Y AND Y
Function Y Y
0 0 0
1 1 1
0 0 0
1 1 1


g) ( X AND NOT Y) OR (Y AND NOT X)
Function X NOT X Y NOT Y
0 0 1 0 1
1 0 1 1 0
1 1 0 0 1
0 1 0 1 0


h) X OR Y
Function X Y
0 0 0
1 0 1
1 1 0
1 1 1


i) NOT(X) and NOT(Y)
Function NOT X NOT Y
1 1 1
0 1 0
0 0 1
0 0 0


j)
Function
1
0
0
1


k) NOT Y AND NOT Y
Function NOT Y NOT Y
1 1 1
0 0 0
1 1 1
0 0 0


l) X OR NOT Y
Function X NOT Y
1 0 1
0 0 0
1 1 1
1 1 0






m) NOT X AND NOT X
Function NOT X NOT X
1 1 1
1 1 1
0 0 0
0 0 0


n) NOT X OR Y
Function NOT X Y
1 1 0
1 1 1
0 0 0
1 0 1


o) NOT( X AND Y)
Function X Y
1 0 0
1 0 1
1 1 0
0 1 1


p) ((NOT X) OR Y) OR X
Function NOT X Y X
1 1 0 0
1 1 1 0
1 0 0 1
1 0 1 1

2. Which if any of the 16 binary functions (if any) cannot be represented using only compositions of (h) {NOT,IMPL}?



x y Not x Not y x impl y y impl x Not x impl y Not y impl (y impl x)
0 0 1 1 1 1 0 1
0 1 1 0 1 0 1 1
1 0 0 1 0 1 1 1
1 1 0 0 1 1 1 1






The following binary functions cannot be represented by {NOT,IMPL}
0000, 0001, 0010, 0011, 0100, 0101, 0110, 1000, 1001, 1110


3. Which of the 16 binary operations are commutative?

x y f (x,y) f (y,x)
0 0 0 0
0 1 0 0
1 0 0 0
1 1 0 0
a)
Commutative









b)
x y f (x,y) f (y,x)
0 0 0 0
0 1 0 0
1 0 0 0
1 1 1 1

Commutative





c)
x y f (x,y) f (y,x)
0 0 0 0
0 1 0 1
1 0 1 0
1 1 0 0

Not Commutative





d)
x y f (x,y) f (y,x)
0 0 0 0
0 1 0 1
1 0 1 0
1 1 1 1

Not Commutative




e)
x y f (x,y) f (y,x)
0 0 0 0
0 1 1 0
1 0 0 1
1 1 0 0

Not Commutative





f)
x y f (x,y) f (y,x)
0 0 0 0
0 1 1 0
1 0 0 1
1 1 1 1

Not Commutative





g)
x y f (x,y) f (y,x)
0 0 0 0
0 1 1 1
1 0 1 1
1 1 0 0
Commutative





h)
x y f (x,y) f (y,x)
0 0 0 0
0 1 1 1
1 0 1 1
1 1 1 1


Commutative


i)
x y f (x,y) f (y,x)
0 0 1 1
0 1 0 0
1 0 0 0
1 1 0 0

Commutative







j)
x y f (x,y) f (y,x)
0 0 1 1
0 1 0 0
1 0 0 0
1 1 1 1

Commutative





k)
x y f (x,y) f (y,x)
0 0 1 1
0 1 0 1
1 0 1 0
1 1 0 0

Not Commutative





x y f (x,y) f (y,x)
0 0 1 1
0 1 0 1
1 0 1 0
1 1 1 1
l)

Not Commutative




m)
x y f (x,y) f (y,x)
0 0 1 1
0 1 1 0
1 0 0 1
1 1 0 0

Not Commutative





n)
x y f (x,y) f (y,x)
0 0 1 1
0 1 1 0
1 0 0 1
1 1 1 1

Not Commutative





o)
x y f (x,y) f (y,x)
0 0 1 1
0 1 1 1
1 0 1 1
1 1 0 0

Commutative






x y f (x,y) f (y,x)
0 0 1 1
0 1 1 1
1 0 1 1
1 1 1 1
p)
Commutative












3. Which of the 16 binary operations are associative?

x y z f(x,y) f(f(x,y),z) f(y,z) f(x,f(y,z)
0 0 1 0 0 0 0
0 0 1 0 0 0 0
0 1 1 0 0 0 0
0 1 1 0 0 0 0
1 0 0 0 0 0 0
1 0 0 0 0 0 0
1 1 0 0 0 0 0
1 1 0 0 0 0 0












4. How do things grow / change if you are working in trinary? That is assume that there are 3 possible inputs {0,1,2}, how many possible binary ( 2 input arguments – one output) operations are there?

Inputs
0 0
0 1
0 2
1 0
1 1
1 2
2 0
2 1
2 2










Given the above inputs there are 39 possible binary operations.


5. Working with trinary inputs, how many binary operations are necessary so that compositions of these binary operations can be used to express every possible two argument function on trinary operations?

The following operations are necessary so that compositions of binary operations can be used to express every possible two argument function on trinary operations:

Negation
Disjunction
Conjunction
Implication

6. Use GIMP or Photoshop to create pictures:
a) Pic1and Pic 2



b) Pic 1or Pic 2





(e) NOT(pic1IMPL pic2)








7. Choose truth values to represent the truth values of phrase that appear in the following paragraph which cannot be decomposed in terms of the operations of AND, OR ,NOT. Join these symbols together with the 3 connectives and represent each sentence with connectives and symbols.

Poison caused the victim’s death if and only if there was a change in his blood chemistry or a residue of poison in his stomach is represented by:

a) A and (B OR C), where A = Poison caused the victim’s death if and only if, B = there was a change in his blood chemistry, C = a residue of poison in his stomach.

There was neither a change in blood chemistry nor a residue of poison in his stomach, but there were puncture marks on the body is represented by:

b) There was neither D NOT(OR) E, AND F where D = a change in blood chemistry, E = a residue of poison in his stomach, F = but there were puncture marks on the body

Poison was injected by a needle only if there were puncture marks on the body is represented by:

c) Poison was injected by a needle only if G, where G = there were puncture marks on the body.

Either poison was the cause of the victim’s death, or there are no puncture marks on the body is represented by:

d) Either H OR I where H = poison was the cause of the victim’s death, I = there are no puncture marks on the body.






Orders of magnitude

1. A commodore 64 had 64K of memory. How many times more memory does a computer with 1GB of memory have?

64 KB = 216 bytes and 1GB = 230 bytes. Therefore 1GB has 2 14 times more memory than a commodore 64. (230 / 216 = 214)

2. A double sided floppy could hold 800K of storage. How many floppy disks are equivalent to DVD’s which can store 4.75 GB of data?

( 4.75 x 230) / ( 800 x 210) = 6225.92

6225.92 floppy disks are equivalent to a DVD.


3. Estimate the processor clock rates of early computers by finding information on the internet. Estimate some typical computers on the market today and compare factors of speed.

The clock rate is the fundamental rate in cycles per second (measured in hertz) at which a computer performs its most basic operations such as adding two numbers or transferring a value from one processor register to another.
The clock rate of a computer is only useful for providing comparisons between computer chips in the same processor family. An IBM PC with an Intel 486 CPU runs at 50 MHz. ( http://en.wikipedia.org/wiki/Clock_rate)

The Atanasoff–Berry Computer (ABC) was the first electronic digital computing device.[1] Conceived in 1937, the machine was capable of solving up to 29 simultaneous linear equations.

The AC power line frequency of 60 Hz was the primary clock rate for the lowest level operations.
(http://en.wikipedia.org/wiki/Atanasoff%E2%80%93Berry_Computer)

Modern computer system designs may specify a wide range of system clock rates, e.g. from 10-MHz or less to 100-MHz or more.
(http://www.patentstorm.us/patents/5506878-description.html)

A comparision of factors of speed tells us that today’s computers are approximately 1.7 million times faster today than the first ABC computer mentioned above.

100MHZ = 100,000,000 HZ / 60 HZ which is about 1.7 million.

Wednesday, May 14, 2008

assignment #2

Pre – Amble #1

Student number mod 8 is 7
Student number mod 3 is 1
Student number mod 7 is 4

1. Show that every binary function (all 16) can be expressed as a composition of the binary operations AND / OR and NOT. Note that the function x (which will be denoted as F) is defined as 0011 and y is defined as 0101.( class notes)

a) X AND NOT X
F x Not x
0 0 1
0 0 1
0 1 0
0 1 0


b)
X AND Y
F X Y
0 0 0
0 0 1
0 1 0
1 1 1


c) X AND NOT Y
F X Not y
0 0 1
0 0 0
1 1 1
0 1 0


d) X AND X
F X X
0 0 0
0 0 0
1 1 1
1 1 1


e) NOT X AND Y
F NOT X Y
0 1 0
1 1 1
0 0 0
0 0 1









f) Y AND Y
F Y Y
0 0 0
1 1 1
0 0 0
1 1 1


g) ( X AND NOT Y) OR (Y AND NOT X)
F X NOT X Y NOT Y
0 0 1 0 1
1 0 1 1 0
1 1 0 0 1
0 1 0 1 0


h) X OR Y
F X Y
0 0 0
1 0 1
1 1 0
1 1 1


i) NOT(X) and NOT(Y)
F NOT X NOT Y
1 1 1
0 1 0
0 0 1
0 0 0


j)
F
1
0
0
1


k) NOT Y AND NOT Y
F NOT Y NOT Y
1 1 1
0 0 0
1 1 1
0 0 0


l) X OR NOT Y
F X NOT Y
1 0 1
0 0 0
1 1 1
1 1 0






m) NOT X AND NOT X
F NOT X NOT X
1 1 1
1 1 1
0 0 0
0 0 0


n) NOT X OR Y
F NOT X Y
1 1 0
1 1 1
0 0 0
1 0 1


o) NOT( X AND Y)
F X Y
1 0 0
1 0 1
1 1 0
0 1 1


p) ((NOT X) OR Y) OR X
Function NOT X Y X
1 1 0 0
1 1 1 0
1 0 0 1
1 0 1 1

2. Which if any of the 16 binary functions (if any) cannot be represented using only compositions of (h) {NOT,IMPL}?



x y Not x Not y x impl y y impl x Not x impl y Not y impl (y impl x)
0 0 1 1 1 1 0 1
0 1 1 0 1 0 1 1
1 0 0 1 0 1 1 1
1 1 0 0 1 1 1 1






The following binary functions cannot be represented by {NOT,IMPL}
0000, 0001, 0010, 0011, 0100, 0101, 0110, 1000, 1001, 1110


3. Which of the 16 binary operations are commutative?

x y f (x,y) f (y,x)
0 0 0 0
0 1 0 0
1 0 0 0
1 1 0 0
a)
Commutative









b)
x y f (x,y) f (y,x)
0 0 0 0
0 1 0 0
1 0 0 0
1 1 1 1

Commutative





c)
x y f (x,y) f (y,x)
0 0 0 0
0 1 0 1
1 0 1 0
1 1 0 0

Not Commutative





d)
x y f (x,y) f (y,x)
0 0 0 0
0 1 0 1
1 0 1 0
1 1 1 1

Not Commutative




e)
x y f (x,y) f (y,x)
0 0 0 0
0 1 1 0
1 0 0 1
1 1 0 0

Not Commutative





f)
x y f (x,y) f (y,x)
0 0 0 0
0 1 1 0
1 0 0 1
1 1 1 1

Not Commutative





g)
x y f (x,y) f (y,x)
0 0 0 0
0 1 1 1
1 0 1 1
1 1 0 0
Commutative





h)
x y f (x,y) f (y,x)
0 0 0 0
0 1 1 1
1 0 1 1
1 1 1 1


Commutative


i)
x y f (x,y) f (y,x)
0 0 1 1
0 1 0 0
1 0 0 0
1 1 0 0

Commutative







j)
x y f (x,y) f (y,x)
0 0 1 1
0 1 0 0
1 0 0 0
1 1 1 1

Commutative





k)
x y f (x,y) f (y,x)
0 0 1 1
0 1 0 1
1 0 1 0
1 1 0 0

Not Commutative





x y f (x,y) f (y,x)
0 0 1 1
0 1 0 1
1 0 1 0
1 1 1 1
l)

Not Commutative




m)
x y f (x,y) f (y,x)
0 0 1 1
0 1 1 0
1 0 0 1
1 1 0 0

Not Commutative





n)
x y f (x,y) f (y,x)
0 0 1 1
0 1 1 0
1 0 0 1
1 1 1 1

Not Commutative





o)
x y f (x,y) f (y,x)
0 0 1 1
0 1 1 1
1 0 1 1
1 1 0 0

Commutative






x y f (x,y) f (y,x)
0 0 1 1
0 1 1 1
1 0 1 1
1 1 1 1
p)
Commutative












3. Which of the 16 binary operations are associative?

x y z f(x,y) f(f(x,y),z) f(y,z) f(x,f(y,z)
0 0 1 0 0 0 0
0 0 1 0 0 0 0
0 1 1 0 0 0 0
0 1 1 0 0 0 0
1 0 0 0 0 0 0
1 0 0 0 0 0 0
1 1 0 0 0 0 0
1 1 0 0 0 0 0










Thus the operation is associative.

4. How do things grow / change if you are working in trinary? That is assume that there are 3 possible inputs {0,1,2}, how many possible binary ( 2 input arguments – one output) operations are there?

Inputs
0 0
0 1
0 2
1 0
1 1
1 2
2 0
2 1
2 2










Given the above inputs there are 3^9 possible binary operations.


5. Working with trinary inputs, how many binary operations are necessary so that compositions of these binary operations can be used to express every possible two argument function on trinary operations?

The following operations are necessary so that compositions of binary operations can be used to express every possible two argument function on trinary operations:

Negation
Disjunction
Conjunction
Implication

6. Use GIMP or Photoshop to create pictures:
a) Pic1and Pic 2



b) Pic 1or Pic 2





(e) NOT(pic1IMPL pic2)








7. Choose truth values to represent the truth values of phrase that appear in the following paragraph which cannot be decomposed in terms of the operations of AND, OR ,NOT. Join these symbols together with the 3 connectives and represent each sentence with connectives and symbols.

Poison caused the victim’s death if and only if there was a change in his blood chemistry or a residue of poison in his stomach is represented by:

a) A and (B OR C), where A = Poison caused the victim’s death if and only if, B = there was a change in his blood chemistry, C = a residue of poison in his stomach.

There was neither a change in blood chemistry nor a residue of poison in his stomach, but there were puncture marks on the body is represented by:

b) There was neither D NOT(OR) E, AND F where D = a change in blood chemistry, E = a residue of poison in his stomach, F = but there were puncture marks on the body

Poison was injected by a needle only if there were puncture marks on the body is represented by:

c) Poison was injected by a needle only if G, where G = there were puncture marks on the body.

Either poison was the cause of the victim’s death, or there are no puncture marks on the body is represented by:

d) Either H OR I where H = poison was the cause of the victim’s death, I = there are no puncture marks on the body.






Orders of magnitude

1. A commodore 64 had 64K of memory. How many times more memory does a computer with 1GB of memory have?

64 KB = 216 bytes and 1GB = 230 bytes. Therefore 1GB has 2 14 times more memory than a commodore 64. (230 / 216 = 214)

2. A double sided floppy could hold 800K of storage. How many floppy disks are equivalent to DVD’s which can store 4.75 GB of data?

( 4.75 x 230) / ( 800 x 210) = 6225.92

6225.92 floppy disks are equivalent to a DVD.


3. Estimate the processor clock rates of early computers by finding information on the internet. Estimate some typical computers on the market today and compare factors of speed.

The clock rate is the fundamental rate in cycles per second (measured in hertz) at which a computer performs its most basic operations such as adding two numbers or transferring a value from one processor register to another.
The clock rate of a computer is only useful for providing comparisons between computer chips in the same processor family. An IBM PC with an Intel 486 CPU runs at 50 MHz. ( http://en.wikipedia.org/wiki/Clock_rate)

The Atanasoff–Berry Computer (ABC) was the first electronic digital computing device.[1] Conceived in 1937, the machine was capable of solving up to 29 simultaneous linear equations.

The AC power line frequency of 60 Hz was the primary clock rate for the lowest level operations.
(http://en.wikipedia.org/wiki/Atanasoff%E2%80%93Berry_Computer)

Modern computer system designs may specify a wide range of system clock rates, e.g. from 10-MHz or less to 100-MHz or more.
(http://www.patentstorm.us/patents/5506878-description.html)

A comparision of factors of speed tells us that today’s computers are approximately 1.7 million times faster today than the first ABC computer mentioned above.

100MHZ = 100,000,000 HZ / 60 HZ which is about 1.7 million.

Sunday, May 11, 2008

Future of Computers

Twenty-five years ago was the anniversary of the original Mackintosh computer. The Mac’s were 128K machines and were sold in large part to college and university students. Apple stores were set up on campus and demonstrations were given to students and professors. The computers were sold at big discounts.

However, being a 128K machine meant they were not capable of the many things we take for granted today. Today we can sit at our computer and search the internet, do word processing and create animation. Twenty or twenty five years ago this would have been done with pencil and paper.

So what does the future hold for computers?
Quantum computers are going to change computers for individuals and society alike. As well, nano technology, which is a process of changing matter at its atomic level, is going to be a big part of future computers.

http://www.youtube.com/watch?v=iKTBlQsxmN0

Monday, May 5, 2008

First Class

Here is my first entry May 5 ,08