Uebungsblatt 5 Name: Joe User Tutor: ???? Email: juser@icp.uni-stuttgart.de ========== AUFGABE 5.1 (Boole'sche Algebra) ========== 5.1.1 Wertetafel a | b | F --------- 0 | 0 | 0 0 | 1 | 1 1 | 0 | 1 1 | 1 | 0 ========== 5.1.2 Gesetze: 1. Assoziativität a or (b or c) = (a or b) or c a and (b and c) = (a and b) and c 2. Distributivität a or (b and c) = (a or b) and (a or c) a and (b or c) = (a and b) or (a and c) 3. Kommutativität a and b = b and a a or b = b or a 4. Absorption a or (a and b) = a a and (a or b) = a 5. Komplement a or not a = True a and not a = False 6. Neutralität a or False = a a and True = a 7. Idempotenz a and a = a a or a = a 8. Extremalgesetz a or True = True a and False = False 9. Doppelnegation not (not a) = a 10. Dualität not True = False not False = True 11. De Morgan not (a or b) = not a and not b not (a and b) = not a or not b F = not (not (not (a and b) and a) and not (not (a and b) and b)) #11*2 = not (not ((not a or not b) and a) and not((not a or not b) and b)) #2*2 = not (not ((not a and a) or (not b and a)) and not ((not a and b) or (not b and b))) #5*2 = not (not (False or (not b and a)) and not ((not a and b) or False) #6*2 = not (not (not b and a) and not (not a and b)) #11*2 = not ((b or not a) and (a or not b)) #11 = not (b or not a) or not (a or not b) #11*2 = (not b and a) or (not a and b) = (a and not b) or (not a and b) = a xor b ========== 5.1.3 Zeige: a or False = a : a or False #5r = a or (a and not a) #4 = a a or a = a: a or a #5r = a or (a and True) #4 = a ========== AUFGABE 5.2 (Zahlensysteme) ========== 5.2.1 a = 4*7^0 + 3*7^1 + 2*7^2 + 1*7^3 = 4 + 21 + 98 + 343 = 466 b = 1D2 c = 4D2 d = 2322 e = 3412 f = 11001101 g = 10111 h = 201 i = 245 j = 81 k = A5 ========== 5.2.2.1 Welchen Vorteil hat das Hexadezimalsystem gegenueber dem Dezimalsystem im Computerumfeld? Es ist einfacher, Zahlen zwischen dem Hexadezimalsystem und dem vom Computer verwendete Binärsystem hin- und herzurechnen. ========== 5.2.2.2 Welchen Vorteil hat das Hexadezimalsystem gegenueber dem Oktalsystem im Computerumfeld? Eine Stelle im Hexadezimalsystem entspricht 4 binären Stellen, im Oktalsystem 3 binären Stellen. Der Computer rechnet normalerweise in Bytes (8 bit), so daß ein Byte genau zwei Hexadezimalstellen entspricht. ========== AUFGABE 5.3 (nohtyP) ========== Skript: n = 123456 print "n = ", n nr = 0 while n > 0: ziffer = n % 10 n = n / 10 nr = nr * 10 + ziffer print "nr = ", nr