|
Size: 7971
Comment:
|
← Revision 41 as of 2019-04-06 16:11:28 ⇥
Size: 8098
Comment: py3 print
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 32: | Line 32: |
| html("<h1>Mandelbrot's Fractal Binomial Measure</h1>") | pretty_print(html("<h1>Mandelbrot's Fractal Binomial Measure</h1>")) |
| Line 52: | Line 52: |
| def f(A = matrix([[1,1],[-1,1]]), D = '[[0,0],[1,0]]', k=(3..17)): print "Det = ", A.det() |
def f(A = matrix([[1,1],[-1,1]]), D = '[[0,0],[1,0]]', k=[3..17]): print("Det = {}".format(A.det())) |
| Line 75: | Line 75: |
| def f(A = matrix([[1,1],[-1,1]]), D = '[[0,0],[1,0]]', k=(3..17)): print "Det = ", A.det() |
def f(A = matrix([[1,1],[-1,1]]), D = '[[0,0],[1,0]]', k=[3..17]): print("Det = {}".format(A.det())) |
| Line 107: | Line 107: |
| def f(A = matrix([[0,0,2],[1,0,1],[0,1,-1]]), D = '[[0,0,0],[1,0,0]]', k=(3..15), labels=True): print "Det = ", A.det() |
def f(A = matrix([[0,0,2],[1,0,1],[0,1,-1]]), D = '[[0,0,0],[1,0,0]]', k=[3..15], labels=False): print("Det = {}".format(A.det())) |
| Line 110: | Line 110: |
| print "D:" print D |
print("D:") print(D) |
| Line 186: | Line 186: |
| time m=mandelbrot_cython(x0 ,x0 + side ,y0 ,y0 + side , N, L ) | m=mandelbrot_cython(x0 ,x0 + side ,y0 ,y0 + side , N, L ) |
| Line 193: | Line 193: |
| time pylab.savefig('mandelbrot.png') | pylab.savefig('mandelbrot.png') |
| Line 200: | Line 200: |
| published notebook: [[http://sagenb.org/pub/1299/]] | published notebook: [[https://cloud.sagemath.com/projects/19575ea0-317e-402b-be57-368d04c113db/files/pub/1201-1301/1299-Mandelbrot.sagews]] |
| Line 228: | Line 228: |
| print 'z <- z^%s + c' % expo | print('z <- z^%s + c' % expo) |
| Line 261: | Line 261: |
| print 'z <- z^%s + (%s+%s*I)' % (expo, c_real, c_imag) | print('z <- z^%s + (%s+%s*I)' % (expo, c_real, c_imag)) |
Sage Interactions - Fractal
goto interact main page
Contents
-
Sage Interactions - Fractal
- Mandelbrot's Fractal Binomial Distribution
- Fractals Generated By Digit Sets and Dilation Matrices
- Demonstrating that the Twin Dragon Matrix is likely to yield a Tiling of a Compact Interval of R^2 as k->infinity (It does!)
- Now in 3D
- Exploring Mandelbrot
- Mandelbrot & Julia Interact with variable exponent
- Sierpiński Triangle
Mandelbrot's Fractal Binomial Distribution
Fractals Generated By Digit Sets and Dilation Matrices
(Sage Days 9 - Avra Laarakker)
Attempt at Generating all integer vectors with Digits D and Matrix A (How about vector([0,-1])?)
Demonstrating that the Twin Dragon Matrix is likely to yield a Tiling of a Compact Interval of R^2 as k->infinity (It does!)
Now in 3D
Exploring Mandelbrot
Pablo Angulo
%cython
import numpy as np
cimport numpy as np
def mandelbrot_cython(float x0,float x1,float y0,float y1,
int N=200, int L=50, float R=3):
'''returns an array NxN to be plotted with matrix_plot
'''
cdef double complex c, z, I
cdef float deltax, deltay, R2 = R*R
cdef int h, j, k
cdef np.ndarray[np.uint16_t, ndim=2] m
m = np.zeros((N,N), dtype=np.uint16)
I = complex(0,1)
deltax = (x1-x0)/N
deltay = (y1-y0)/N
for j in range(N):
for k in range(N):
c = (x0+j*deltax)+ I*(y0+k*deltay)
z=0
h=0
while (h<L and
z.real**2 + z.imag**2 < R2):
z=z*z+c
h+=1
m[j,k]=h
return mimport pylab
x0_default = -2
y0_default = -1.5
side_default = 3.0
side = side_default
x0 = x0_default
y0 = y0_default
options = ['Reset','Upper Left', 'Upper Right', 'Stay', 'Lower Left', 'Lower Right']
@interact
def show_mandelbrot(option = selector(options, nrows = 2, width=8),
N = slider(100, 1000,100, 300),
L = slider(20, 300, 20, 60),
plot_size = slider(2,10,1,6),
auto_update = False):
global x0, y0, side
if option == 'Lower Right':
x0 += side/2
y0 += side/2
elif option == 'Upper Right':
y0 += side/2
elif option == 'Lower Left':
x0 += side/2
if option=='Reset':
side = side_default
x0 = x0_default
y0 = y0_default
elif option != 'Stay':
side = side/2
m=mandelbrot_cython(x0 ,x0 + side ,y0 ,y0 + side , N, L )
# p = (matrix_plot(m) +
# line2d([(N/2,0),(N/2,N)], color='red', zorder=2) +
# line2d([(0,N/2),(N,N/2)], color='red', zorder=2))
# time show(p, figsize = (plot_size, plot_size))
pylab.clf()
pylab.imshow(m, cmap = pylab.cm.gray)
pylab.savefig('mandelbrot.png')
Mandelbrot & Julia Interact with variable exponent
published notebook: https://cloud.sagemath.com/projects/19575ea0-317e-402b-be57-368d04c113db/files/pub/1201-1301/1299-Mandelbrot.sagews
Mandelbrot
by Harald Schilly
Julia
by Harald Schilly
julia_plot(-7,30,0.5,0.5,(-1.5,1.5), (-1.5,1.5))
Sierpiński Triangle
by Eviatar Bach
