Mageia Bugzilla – Attachment 798 Details for
Bug 2752
python-numpy needs an update to solve upgrade problems from Mandriva 2010.2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Sample used to test python-numpy
mandelbrot.py (text/plain), 733 bytes, created by
Dave Hodgins
on 2011-09-16 23:47:30 CEST
(
hide
)
Description:
Sample used to test python-numpy
Filename:
MIME Type:
Creator:
Dave Hodgins
Created:
2011-09-16 23:47:30 CEST
Size:
733 bytes
patch
obsolete
>#!/usr/bin/python >from numpy import * >import pylab > >def mandelbrot( h,w, maxit=20 ): > '''Returns an image of the Mandelbrot fractal of size (h,w). > ''' > y,x = ogrid[ -1.4:1.4:h*1j, -2:0.8:w*1j ] > c = x+y*1j > z = c > divtime = maxit + zeros(z.shape, dtype=int) > > for i in xrange(maxit): > z = z**2 + c > diverge = z*conj(z) > 2**2 # who is diverging > div_now = diverge & (divtime==maxit) # who is diverging now > divtime[div_now] = i # note when > z[diverge] = 2 # avoid diverging too much > > return divtime > >pylab.imshow(mandelbrot(400,400)) >pylab.show()
#!/usr/bin/python from numpy import * import pylab def mandelbrot( h,w, maxit=20 ): '''Returns an image of the Mandelbrot fractal of size (h,w). ''' y,x = ogrid[ -1.4:1.4:h*1j, -2:0.8:w*1j ] c = x+y*1j z = c divtime = maxit + zeros(z.shape, dtype=int) for i in xrange(maxit): z = z**2 + c diverge = z*conj(z) > 2**2 # who is diverging div_now = diverge & (divtime==maxit) # who is diverging now divtime[div_now] = i # note when z[diverge] = 2 # avoid diverging too much return divtime pylab.imshow(mandelbrot(400,400)) pylab.show()
View Attachment As Raw
Actions:
View
Attachments on
bug 2752
: 798