File:Douady rabbit, plotted with Matplotlb.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 900 × 900 pixels, file size: 923 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: The Douady rabbit with seed value (-.123, .745) and 1,000 iterations
    Date
    Source Own work
    Author Morn
    SVG development
    InfoField
     The SVG code is valid.
     This plot was created with Matplotlib.
    Source code
    InfoField

    Python code

    Source code
    from pylab import *
    from numpy import NaN
    from matplotlib.colors import LogNorm
    
    s = -.123, .745
    
    res = .001    # grid resolution
    max_it = 1000 # maximum number of iterations
    
    figure(figsize = (10, 10))
    
    def jul(a):
    	z = a
    	for n in range(1, max_it + 1):
    		z = z**2 + s[0] + 1j * s[1]
    		if abs(z) > 2:
    			return n
    	return NaN
    
    X = arange(-2, 2 + res, res)
    Y = arange(-1.5,  1.5 + res, res)
    Z = zeros((len(Y), len(X)))
    
    for iy, y in enumerate(Y):
    	print (iy + 1, "of", len(Y))
    	for ix, x in enumerate(X):
    		Z[-iy - 1, ix] = jul(x + 1j * y)
    
    save("douady", Z)	# save array to file
    
    imshow(Z, cmap = plt.cm.viridis, interpolation = 'none', norm = LogNorm(),
      extent = (X.min(), X.max(), Y.min(), Y.max()))
    xlabel("Re(z)")
    ylabel("Im(z)")
    axis((-1.5, 1.5, -1.5, 1.5))
    savefig("douady_rabbit_python.svg")
    show()
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    21 January 2019

    944,937 byte

    image/svg+xml

    bf1220e2ef8bf72b83079fb3cf749f84f23337c4

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current13:40, 21 January 2019Thumbnail for version as of 13:40, 21 January 2019900 × 900 (923 KB)wikimediacommons>MornUser created page with UploadWizard

    There are no pages that use this file.