Versionsvergleich
Aus ProgrammingWiki
Vergleich: 2021-03-26T14:19:33+00:00 → 2021-06-21T10:15:47+00:00
<language>SchemeJS</language> | |
| − | == Hilbert Hotel == |
| − | <code id="605dd0651e5eb"> |
| − | (define stream-car car) |
| + | = Absolute Unlösbarkeit Seite 7= |
| − | (define stream-cdr |
| − | (lambda (stm) |
| − | (force (cdr stm)))) |
| + | <code id="605f350395747"> |
| + | (define f |
| + | (lambda (n) |
| + | (if (= n 1) |
| + | 1 |
| + | (if (even? n) |
| + | (+ (f (/ n 2)) 1) |
| + | (/ 1 (f (- n 1))) |
| + | ) |
| + | ) |
| + | ) |
| + | ) |
| + | </code> |
| + | <run id="605f35039582a"> |
| + | (f 1) |
| + | </run> |
| − | (define-macro (stream-cons head tail) |
| − | `(cons ,head (delay ,tail))) |
| + | f(1) = 1 |
| − | (define stream? |
| − | (lambda (stm) |
| − | (and (pair? stm) (promise? (cdr stm))))) |
| + | f(2) = 2 |
| − | (define stream-map |
| − | (lambda (proz stm) |
| − | (stream-cons (proz (stream-car stm)) (stream-map proz (stream-cdr stm))))) |
| + | f(3) = 1 / f(2) = 0.5 |
| − | (define show-stream |
| − | (lambda (stm n) |
| − | (letrec |
| − | ([show |
| − | (lambda (stm n ls) |
| − | (if (= n 0) |
| − | (apply display (append ls (list "..."))) |
| − | (show (stream-cdr stm) (- n 1) (append ls (list (stream-car stm) ", ")))))]) |
| − | (show stm n ())))) |
| + | f(4) = f(4/2) + 1 = f(2) + 1 = 3 |
| − | (define zeige-mir show-stream) |
| + | f(5) = 1 / f(4) = 1/3 |
| − | </code> |
| + | f(6) = f(3) + 1 = 1.5 |
| − | <code id="605dd0651e650"> |
| + | f(7) = 1 / f(6) = 1 * 2/3 = 2/3 |
| − | (define baue-hilberthotel |
| − | (lambda () |
| − | (stream-cons #f (baue-hilberthotel))) |
| − | ) |
| − | |
| − | (define hilberthotel (baue-hilberthotel)) |
| − | </code> |
| − | |
| − | <run id="605dd0651e6ad"> |
| − | (zeige-mir hilberthotel 11) |
| − | </run> |
| − | |
| − | <code id="605dd4de3e11c"> |
| − | (define einzelbuchung |
| − | (lambda (val stm pos) |
| − | (let ([old-pos pos]) |
| − | (letrec |
| − | ([shorten |
| − | (lambda (val stm pos) |
| − | (if (= pos 0) |
| − | (if (eq? #f (stream-car stm)) |
| − | (stream-cons val (stream-cdr stm)) |
| − | (raise (string-append (number->string old-pos) " schon belegt mit: " (stream-car stm)))) |
| − | (stream-cons (stream-car stm) (shorten val (stream-cdr stm) (- pos 1))) |
| − | )) |
| − | ]) |
| − | (shorten val stm pos) |
| + | <code id="605f3503957bb"> |
| + | (define f^- |
| + | (lambda (n) |
| + | (if (= n 1) |
| + | 1 |
| + | (if (> n 1) |
| + | (* (f^- (- n 1)) 2) |
| + | (+ (f^- (/ 1 n)) 1) |
| + | ) |
) | |
| − | ) |
) | |
) | |
</code> | |
| − | <run id="605dd4de3e1e0"> |
| − | (set! hilberthotel (einzelbuchung "Otto Grundmann" hilberthotel 3)) |
| − | (zeig-mir hilberthotel 12) |
| + | <run id="605f350395882"> |
| + | (f^- 1) |
</run> | |
| − | <code id="605ded6247d06"> |
| − | (define baue-kleinbus |
| − | (lambda (numb pers) |
| − | (list numb pers))) |
| + | = Überabzählbar unendlich Seite 11 = |
| − | (define kleinbus815 (baue-kleinbus 815 8)) |
| − | </code> |
| − | <run id="605ded74e3e0f"> |
| − | (zeig-mir kleinbus815) |
| − | </run> |
| + | z.z: $\mathbf{R}$ ist überabzählbar unendlich |
| + | |
| + | Beweis: Widerspruch mit Cantorsches Diagonalisierungsverfahren 2. Art |
| + | |
| + | Annahme: $\mathbf{R}$ ist abzahlbar unendlich |
| + | |
| + | Listen aller rellen Zahlen $r_n$: |
| + | |
| + | {| border="1" cellpadding="5" cellspacing="0" |
| + | |+ |
| + | ! || s1 || s2 || s3 || s4 || ... |
| + | |- |
| + | | r1 0. || $\textbf{1}$ || 4 || 1 || 5 || ... |
| + | |- |
| + | | r2 0. || 7 || $\textbf{1}$ || 8 || 2 || ... |
| + | |- |
| + | | r3 0. || 6 || 1 || $\textbf{8}$ || 0 || ... |
| + | |- |
| + | | r4 0. || 4 || 1 || 4 || $\textbf{2}$ || ... |
| + | |- |
| + | | ... || ... || ... || ... || ... || ... |
| + | |- |
| + | |} |
| + | |
| + | Wahl der Ziffern auf der Diagonalen und Zusammenstellen einer neuen Zahl mit den entsprechenden Stellen $s_n$ aus der Tabelle. |
| + | |
| + | $r_{comp}$ = 0.1182... |
| + | |
| + | Dabei werden die Ziffern abgeändert wobei jede 1 zu einer 2 wird und jede andere Ziffer zu einer 1. |
| + | |
| + | $r_{new}$ = 0.2211... |
| + | |
| + | Dadurch unterscheidet sich diese neue Zahl von jeder aufgelisteten, da sie sich von $r1$ an der ersten Stelle unterscheidet, von $r2$ an der 2. Stelle von $r3$ an der 3. Stelle usw.. |
| + | |
| + | |
| + | |
| + | = Kreativaufgabe Hilbert Hotel = |
| + | |
| + | * Scheme [[BuK/IIm20/Vorlesung 2 Grüning/Hilbert_Scheme]] |
| + | |
| + | * Python [[BuK/IIm20/Vorlesung 2 Grüning/Hilbert_Python]] |