19
Diskrete Mathe 1 1 2 3 4 5 6 7 8 9 10 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Embed Size (px)

Citation preview

Page 1: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 10

Diskrete Mathematik

Einführendes Beispiel

Vorlesung 1

Page 2: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 101

• Flurstück– Flächeninhalt eines Polygons– Gaußsche Flächenformel

• Programmierung: Iteration, For-Schleife– Pascal– Java

– Speicherung der Punktkoordinaten• Flurstücke eines Gebietes

– Speicherung der Punktkoordinaten– Redundanz– Vermeidung der Redundanz

• Tabellen• Objekte

– siehe Vorlesung „Geoinformation"

Übersicht

Page 3: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 102

Flächeninhalt eine Polygons

F

(x1,y1)

(x4,y4)

(x5,y5)(x2,y2)

(x3,y3)

A 1x

Page 4: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 103

Gaußsche Flächenformel

k = 1

5

(xk - xk+1)(yk + yk+1)F =1

2

Page 5: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 104

Iteration, For-Schleife

(x4,y4)

(x1,y1)(x5,y5)

(x2,y2)

(x3,y3)

BEGIN{

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

A 18x

Page 6: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 104

Iteration, For-Schleife

(x4,y4)

(x1,y1)(x5,y5)

(x2,y2)

(x3,y3)

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

A 18x

f := 0;{f = 0;

Page 7: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 10

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

4

Iteration, For-Schleife

(x4,y4)

(x1,y1)(x5,y5)

(x2,y2)

(x3,y3)

A 18x

FOR k:=1 TO 5 DO

{f = 0;for(k = 1; k <= 5; k++)

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

Page 8: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 104

Iteration, For-Schleife

(x4,y4)

(x1,y1)(x5,y5)

(x2,y2)

(x3,y3)

A 18x

BEGIN

{f = 0;for(k = 1; k <= 5; k++){

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

Page 9: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 104

Iteration, For-Schleife

(x4,y4)

(x1,y1)(x5,y5)

(x2,y2)

(x3,y3)

A 18x

(x6,y6)

f := f + ((x[k] - x[k+1])*(y[k] + y[k+1]));

{

f = f + ((x[k] - x[k+1])*(y[k] + y[k+1]));

f = 0;for(k = 1; k <= 5; k++){

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

Page 10: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 104

Iteration, For-Schleife

(x4,y4)

(x1,y1)(x5,y5)

(x2,y2)

(x3,y3)

A 18x

END

{

f = f + ((x[k] - x[k+1])*(y[k] + y[k+1]));

f = 0;for(k = 1; k <= 5; k++){

}

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

Page 11: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 104

Iteration, For-Schleife

(x4,y4)

(x1,y1)(x5,y5)

(x2,y2)

(x3,y3)

A 18x

flaeche := f/2;

{

f = f + ((x[k] - x[k+1])*(y[k] + y[k+1]));

f = 0;for(k = 1; k <= 5; k++){

}flaeche = f/2;

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

Page 12: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 104

Iteration, For-Schleife

(x4,y4)

(x1,y1)(x5,y5)

(x2,y2)

(x3,y3)

A 18x

{

f = f + ((x[k] - x[k+1])*(y[k] + y[k+1]));

f = 0;for(k = 1; k <= 5; k++){

}flaeche = f/2;

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

END}

Page 13: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 104

Iteration, For-Schleife

(x4,y4)

(x1,y1)(x5,y5)

(x2,y2)

(x3,y3)

A 18x

{

f = f + ((x[k] - x[k+1])*(y[k] + y[k+1]));

f = 0;for(k = 1; k <= 5; k++){

}flaeche = f/2;

}

2k = 1

5(xk - xk+1)(yk + yk+1)F = 1

Page 14: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 10

Speicherung der Punktkoordinaten

(x1,y1)

(x4,y4)

(x5,y5)(x2,y2)

(x3,y3)

A

A = [(x1,y1), ( x2,y2), ( x3,y3),

(x4,y4), (x5,y5), (x6,y6)]

5

Page 15: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 10

Speicherung der Punktkoordinaten

P1

P5

P4

P3

P2

P6P7

P8P9

P10

P11

B

CD

A = [(x1,y1), ( x2,y2), ( x3,y3), (x4,y4), (x5,y5)]

D = [(x2,y2), ( x11,y11), ( x10,y10), (x9,y9), (x3,y3)]

A

6

Page 16: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 10

Redundanz

• Die Repräsentation von Polygonen durch Punktlisten A = [(x1,y1), ( x2,y2), ( x3,y3), (x4,y4), (x5,y5)] D = [(x2,y2), ( x11,y11), (x10,y10), ( x9,y9), (x3,y3)] – eignet sich direkt für die Berechnung von Flächen– speichert Punktkoordinaten redundant ab

• Nachteil:– Platzbedarf (kleines Problem)– fehleranfällig, denn die Koordinaten des gleichen Punktes treten an

verschiedenen Stellen auf und können verschiedene Werte annehmen (großes Problem)

– Änderungen sind schwierig– Alternative: eigene Punktetabelle und Verweis auf diese Tabelle

7

Page 17: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 10

Vermeidung der Redundanz: Tabellen PunktlisteP1 2.0 0.0P2 1.0 1.0P3 7.0 3.0P4 5.0 4.0P5 5.0 1.0P6 7.0 6.0P7 5.0 6.0P8 5.0 7.0P9 3.0 7.0P10 3.0 6.0P11 0.0 3.0

GrundstückslisteA 1 2 3 4 5B 3 9 8 7C 4 3 7 6D 2 11 10 9 3P1

P5

P4

P3

P2

P6P7

P8P9

P10

P11

B

CD

A

8

Page 18: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 10

Vermeidung der Redundanz: Punkte als Objekte -> Vorlesung „Geoinformation“

Punkt

+transform(Bezugssystem : Text)

+Länge : Grad+Breite : Grad+X : Zahl+Y : Zahl+Projektion : Text+Erfassung : Text = GPS+Erfassungsdatum : Datum

9

Page 19: Diskrete Mathe1 12345678910 Diskrete Mathematik Einführendes Beispiel Vorlesung 1

Diskrete Mathe11 2 3 4 5 6 7 8 9 10

„Objektorientierung“ im 1. Semester

• Vorlesung „Diskrete Mathematik“– Modellierung von Objekten– UML

• „Programmierung“– Implementierung von Objekten– Java

• Diskrete Mathematik– Verwendung von Objekten in Algorithmen

10