Explore
Courses
Batches
Sketches
Statistics
Code a Pookkalam
Jobs
Devsprint
People
Course Creation
Create a Course
Guidelines
Resources
Support
Blogs
My Profile
About Us
Login
Sketches
0
Mandelbrot
By
Kaustubh Patil
Run
def mandelbrot(z, c): return z ** 2 + c def complex_to_xy(cmpl): # multiply 100 for magnification return cmpl.real * 100, cmpl.imag * 100 c = 0.4 + 0.1j seed = z = 0.3 + 0.3j r = 5 fill = "rgba(255, 0, 0, 0.5)" x1, y1 = complex_to_xy(seed) show(circle(x=x1, y=y1, r=r, fill=fill)) for _ in range(10): last_z = z z = mandelbrot(z, c) x1, y1 = complex_to_xy(last_z) x2, y2 = complex_to_xy(z) show(circle(x=x2, y=y2, r=r, fill=fill)) show(line(x1=x1, y1=y1, x2=x2, y2=y2))
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login