Zum Inhalt springen

Datei:Collatz-graph-20-iterations.svg

Aus MOOCsWiki Staging
Originaldatei (SVG-Datei, Basisgröße: 1.440 × 1.406 Pixel, Dateigröße: 520 KB)

Diese Datei stammt aus Wikimedia Commons und kann von anderen Projekten verwendet werden. Die Beschreibung von deren Dateibeschreibungsseite wird unten angezeigt.

Beschreibung

Beschreibung
English: This is a graph, generated in bottom-up fashion, of the orbits of all numbers under the Collatz map with an orbit length of 20 or less.

Created with Graphviz, with the help of this Python program:

 # This python script generates a graph that shows 20 levels of the Collatz Conjecture.
 
 level = [1] # The root of the tree contains only "1"
 results = {} # This will hold the relationships for the graph
 
 # Loop 20 times
 for c in range(20):
     newlevel = set() # This will be the set of numbers in the level above us
     for x in level: # We now loop through each number in our current level
 
         # There will only sometimes be an odd multiple of 3 (plus one) above us
         # When (x-1) mod 3 is 0, x is an even number half the time
         # So we check against (x-4) mod 6 because we don't want to find evens
         odd = (x-1)/3 if not (x-4)%6 else 0
         if odd > 1: # We don't want 1 (the root) or 0 (no odd found)
             newlevel.add(odd) # Put this into the next level
             results[odd] = x # Add a relationship to the graph
 
         newlevel.add(x*2); # There will always be an even number above us
         results[x*2] = x # Add a relationship to the graph
 
     # Finally, advance to the next level
     level = newlevel
 
 # Technically, 1 is odd so 1*3+1 = 4. If included though, this tends to make 2 and 1 overlap on the graph, which is ugly.
 # Uncomment to include this relationship:
 # results[1] = 4;
 
 # Now we write the graph out to a file in dot format so that graphviz can read it
 f = open('collatz.dot', 'w')
 # For aesthetic reasons we set 8 as the centre node instead of 1
 f.write('digraph G {\n    size="16,16";\n    root=8;\n    splines=true;\n')
 for x in results:
     f.write("    %d -> %d;\n" % (x, results[x]))
 f.write('}\n')
 f.close()
 print "Generated %d nodes" % len(results)
Datum 7. März 2010 (Original-Hochladedatum)
Quelle Übertragen aus en.wikipedia nach Commons durch Derlay mithilfe des CommonsHelper.
Urheber TerrorBite in der Wikipedia auf Englisch

Lizenz

Public domain Dieses Werk wurde von seinem Urheber TerrorBite in der Wikipedia auf Englisch als gemeinfrei veröffentlicht. Dies gilt weltweit.
In manchen Staaten könnte dies rechtlich nicht möglich sein. Sofern dies der Fall ist:
TerrorBite gewährt jedem das bedingungslose Recht, dieses Werk für jedweden Zweck zu nutzen, es sei denn, Bedingungen sind gesetzlich erforderlich.

Ursprüngliches Datei-Logbuch

Die ursprüngliche Dateibeschreibungsseite war hier. Alle folgenden Benutzernamen beziehen sich auf en.wikipedia.
  • 2010-03-07 16:29 TerrorBite 1440×1406× (532396 bytes) This is a graph, generated in bottom-up fashion, of the orbits of all numbers under the Collatz map with an orbit length of 20 or less. Created with [[Graphviz]], with the help of this [[Python (programming language)|Python]] program: # This python sc

Kurzbeschreibungen

Ergänze eine einzeilige Erklärung, was diese Datei darstellt.

In dieser Datei abgebildete Objekte

Motiv

image/svg+xml

e228f25d455662fa61e6e4f16b60ef24be090161

532.396 Byte

1.406 Pixel

1.440 Pixel

Dateiversionen

Klicke auf einen Zeitpunkt, um diese Version zu laden.

Version vomVorschaubildMaßeBenutzerKommentar
aktuell12:00, 25. Mai 2010Vorschaubild der Version vom 12:00, 25. Mai 20101.440 × 1.406 (520 KB)wikimediacommons>Derlay{{Information |Description={{en|This is a graph, generated in bottom-up fashion, of the orbits of all numbers under the Collatz map with an orbit length of 20 or less. Created with en:Graphviz, with the help of this [[:en:Python (programming langua

Die folgende Seite verwendet diese Datei: