File:Moser–de Bruijn counts.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 540 × 432 pixels, file size: 257 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Plot of the number of values in the Moser–de Bruijn sequence up to n, normalized by dividing the vertical scale by n. The horizontal scale (n) is logarithmic, with powers of four marked.
    Date
    Source Own work
    Author David Eppstein

    Source code

    Captions added manually to a plot generated by the following source code:

    import sys
    from PADS.SVG import *
    from math import log
    
    def inmdb(n):
        return n & 0x55555555 == n
    
    def height(r):
        return 432j-(360*(r-1)+36)*1j
    
    def across(n):
        return 72*(log(n)/log(4)+0.5)
    
    svg = SVG(540+432j,sys.stdout)
    
    svg.group(stroke=colors.blue)  # 1/3 and 1 horiz, powers of 4 vertical
    for vert in [1,1.5,2]:
        svg.segment(height(vert),height(vert)+540,stroke=colors.green)
    for power in [1,4,16,64,256,1024,4096]:
        svg.segment(across(power)+432j,across(power),stroke=colors.green)
    svg.ungroup()
    
    points = []
    count = 1
    for n in range(1,4**7+1):
        if inmdb(n):
            count += 1
        points.append(height(count/(n**0.5))+across(n))
    
    svg.polyline(points,stroke=colors.red,fill="none")
    
    svg.close()
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
    The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    19 November 2016

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current12:56, 14 December 2016Thumbnail for version as of 12:56, 14 December 2016540 × 432 (257 KB)wikimediacommons>Bkellfixed labels on horizontal axis

    There are no pages that use this file.