fractals.julia_sets¶
Author Alexandre De Zotti
- Draws Julia sets of quadratic polynomials and exponential maps.
More specifically, this iterates the function a fixed number of times then plots whether the absolute value of the last iterate is greater than a fixed threshold (named “escape radius”). For the exponential map this is not really an escape radius but rather a convenient way to approximate the Julia set with bounded orbits.
The examples presented here are: - The Cauliflower Julia set, see e.g. https://en.wikipedia.org/wiki/File:Julia_z2%2B0,25.png - Other examples from https://en.wikipedia.org/wiki/Julia_set - An exponential map Julia set, ambiantly homeomorphic to the examples in https://www.math.univ-toulouse.fr/~cheritat/GalII/galery.html
and
https://ddd.uab.cat/pub/pubmat/02141493v43n1/02141493v43n1p27.pdf
- Remark: Some overflow runtime warnings are suppressed. This is because of the
way the iteration loop is implemented, using numpy’s efficient computations. Overflows and infinites are replaced after each step by a large number.
Attributes¶
Functions¶
|
Evaluate $e^z + c$. |
|
|
|
Ignore some overflow and invalid value warnings. |
|
Iterate the function "eval_function" exactly nb_iterations times. |
|
Create a grid of complex values of size nb_pixels*nb_pixels with real and |
|
Plots of whether the absolute value of z_final is greater than |
Module Contents¶
- fractals.julia_sets.eval_exponential(c_parameter: complex, z_values: numpy.ndarray) numpy.ndarray ¶
Evaluate $e^z + c$. >>> float(eval_exponential(0, 0)) 1.0 >>> bool(abs(eval_exponential(1, np.pi*1.j)) < 1e-15) True >>> bool(abs(eval_exponential(1.j, 0)-1-1.j) < 1e-15) True
- fractals.julia_sets.eval_quadratic_polynomial(c_parameter: complex, z_values: numpy.ndarray) numpy.ndarray ¶
>>> eval_quadratic_polynomial(0, 2) 4 >>> eval_quadratic_polynomial(-1, 1) 0 >>> round(eval_quadratic_polynomial(1.j, 0).imag) 1 >>> round(eval_quadratic_polynomial(1.j, 0).real) 0
- fractals.julia_sets.ignore_overflow_warnings() None ¶
Ignore some overflow and invalid value warnings.
>>> ignore_overflow_warnings()
- fractals.julia_sets.iterate_function(eval_function: collections.abc.Callable[[Any, numpy.ndarray], numpy.ndarray], function_params: Any, nb_iterations: int, z_0: numpy.ndarray, infinity: float | None = None) numpy.ndarray ¶
Iterate the function “eval_function” exactly nb_iterations times. The first argument of the function is a parameter which is contained in function_params. The variable z_0 is an array that contains the initial values to iterate from. This function returns the final iterates.
>>> iterate_function(eval_quadratic_polynomial, 0, 3, np.array([0,1,2])).shape (3,) >>> complex(np.round(iterate_function(eval_quadratic_polynomial, ... 0, ... 3, ... np.array([0,1,2]))[0])) 0j >>> complex(np.round(iterate_function(eval_quadratic_polynomial, ... 0, ... 3, ... np.array([0,1,2]))[1])) (1+0j) >>> complex(np.round(iterate_function(eval_quadratic_polynomial, ... 0, ... 3, ... np.array([0,1,2]))[2])) (256+0j)
- fractals.julia_sets.prepare_grid(window_size: float, nb_pixels: int) numpy.ndarray ¶
- Create a grid of complex values of size nb_pixels*nb_pixels with real and
imaginary parts ranging from -window_size to window_size (inclusive).
Returns a numpy array.
>>> prepare_grid(1,3) array([[-1.-1.j, -1.+0.j, -1.+1.j], [ 0.-1.j, 0.+0.j, 0.+1.j], [ 1.-1.j, 1.+0.j, 1.+1.j]])
- fractals.julia_sets.show_results(function_label: str, function_params: Any, escape_radius: float, z_final: numpy.ndarray) None ¶
Plots of whether the absolute value of z_final is greater than the value of escape_radius. Adds the function_label and function_params to the title.
>>> show_results('80', 0, 1, np.array([[0,1,.5],[.4,2,1.1],[.2,1,1.3]]))
- fractals.julia_sets.c_cauliflower¶
- fractals.julia_sets.c_exponential¶
- fractals.julia_sets.c_polynomial_1¶
- fractals.julia_sets.c_polynomial_2¶
- fractals.julia_sets.nb_iterations = 56¶
- fractals.julia_sets.nb_pixels = 666¶
- fractals.julia_sets.window_size = 2.0¶
- fractals.julia_sets.z_0¶