Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 28.09.07 15:47 
Eine Frage aus der Mathematik, genauer aus der Mengenlehre.
Ich habe zwei Mengen M1 und M2. Ich möchte wissen, wie oft ein Element x1 (stammt aus M1) in M2 vorkommt.
Bsp:
M1 = {1,2,3} (x1 soll hier die 1 sein)
M2 = {1,2,1,3,1,4,6}

Die Antwort auf die Frage wäre hier 3, da die 1 dreimal in M2 enthalten ist.
Wie kann man dies mathematisch darstellen? Also wie schreibt man das auf, die Anzahl der Vorkommen eines Elements aus einer Menge?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 28.09.07 15:49 
M2 ist ja eigentlich keine Menge. Es gibt zwar sowas wie Multimengen, aber sonst... :nixweiss:

_________________
We are, we were and will not be.
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Fr 28.09.07 15:59 
user profile iconGausi hat folgendes geschrieben:
M2 ist ja eigentlich keine Menge.... :nixweiss:
:zustimm: Jooo, is so

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Fr 28.09.07 16:04 
Auszug aus der Wikipedia.de:
Zitat:
Bei der Beschreibung einer Menge geht es ausschließlich um die Frage, welche Elemente in ihr enthalten oder nicht enthalten sind. Es wird nicht danach gefragt, ob ein Element mehrmals enthalten ist, oder ob es eine Reihenfolge unter den Elementen gibt.


Was willst du denn machen? :D

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 28.09.07 16:19 
Ich will einen Suchalgorithmus mathematisch beschreiben.
K ist die Menge der Suchbegriffe. Und W die Menge der Wörter der Inhalts pro Seite. Die Frage ist nun, wie oft jedes Element aus K in W vorkommt.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Horst_H
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1654
Erhaltene Danke: 244

WIN10,PuppyLinux
FreePascal,Lazarus
BeitragVerfasst: Fr 28.09.07 18:27 
Hallo,

Wenn die Menge W (TSringlist) eine geordnete Menge wird (.Sort) kann für jedes Element aus K prüfen ob in W ist (.Find).
Falls es vorhanden ist zählt man die Nachbarn von W die gleich dem Element aus K sind.

Wie das mathematisch zu schreiben ist, keine Ahnung
Gruß Horst
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 29.09.07 00:21 
Du willst also eine Textsuche beschreiben, ja? Das Problem könnte man so definieren, wie im Anhang beschrieben. Müsste man noch auf Multipattern-Suche erweitern. Und was du suchst, ist eigentlich nur die Mächtigkeit der Menge I. Da ist zwar nicht von Wörtern die Rede, aber das macht generell nur bedingt Sinn wenn man das Problem abstrakt behandeln will.
Einloggen, um Attachments anzusehen!
_________________
We are, we were and will not be.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Sa 29.09.07 07:39 
Ein String ist aber eine geordnete 'Menge'. Hier geht es um ungeordnete Mengen. Im Übrigen kann eine Menge aus mehreren gleichnamigen Elementen bestehen.

Ich würde das so beschreiben:

Sei K eine Menge mit N Elementen K_1..K_n und W eine Menge mit M Elementen W_1..W_m.
Gesucht ist eine Funktion S(i) (i=1..N) die die Anzahl der Elemente W_j in W angibt, für die gilt: K_i = W_j.

_________________
Na denn, dann. Bis dann, denn.