Julia set: Difference between revisions

Content added Content deleted
m (→‎Vectorized: added missing </lang>)
Line 1,456: Line 1,456:
Creating Fractal Images. researchgate. net, Feb. 2015.'
Creating Fractal Images. researchgate. net, Feb. 2015.'
"""
"""
import itertools
from functools import partial
from functools import partial
from numbers import Complex
from numbers import Complex
Line 1,466: Line 1,465:


def douady_hubbard_polynomial(z: Complex,
def douady_hubbard_polynomial(z: Complex,
*,
c: Complex) -> Complex:
c: Complex):
"""
"""
Monic and centered quadratic complex polynomial
Monic and centered quadratic complex polynomial
Line 1,475: Line 1,473:




def julia_set(*,
def julia_set(mapping: Callable[[Complex], Complex],
mapping: Callable[[Complex], Complex],
*,
min_coordinate: Complex,
min_coordinate: Complex,
max_coordinate: Complex,
max_coordinate: Complex,
Line 1,502: Line 1,500:
result = np.ones(complex_plane.shape)
result = np.ones(complex_plane.shape)


for _ in itertools.repeat(None, iterations_count):
for _ in range(iterations_count):
mask = np.abs(complex_plane) <= threshold
mask = np.abs(complex_plane) <= threshold
if not mask.any():
if not mask.any():
Line 1,516: Line 1,514:
c=-0.7 + 0.27015j) # type: Callable[[Complex], Complex]
c=-0.7 + 0.27015j) # type: Callable[[Complex], Complex]


image = julia_set(mapping=mapping,
image = julia_set(mapping,
min_coordinate=-1.5 - 1j,
min_coordinate=-1.5 - 1j,
max_coordinate=1.5 + 1j,
max_coordinate=1.5 + 1j,