"""simple docstring"""


import warnings
from collections.abc import Callable
from typing import Any

import numpy
from matplotlib import pyplot

__UpperCamelCase       :    Dict         =		0.25 + 0.0J
__UpperCamelCase       :    Optional[Any]         =		-0.4 + 0.6J
__UpperCamelCase       :    Optional[Any]         =		-0.1 + 0.651J
__UpperCamelCase       :    Optional[int]         =		-2.0
__UpperCamelCase       :    List[Any]         =		5_6
__UpperCamelCase       :    Tuple         =		2.0
__UpperCamelCase       :    Union[str, Any]         =		6_6_6


def   __UpperCAmelCase     (	_snake_case		:       complex,				_snake_case		:       numpy.ndarray       ):
   return numpy.exp(_snake_case       ) + c_parameter


def   __UpperCAmelCase     (	_snake_case		:       complex,				_snake_case		:       numpy.ndarray       ):
   return z_values * z_values + c_parameter


def   __UpperCAmelCase     (	_snake_case		:       float,				_snake_case		:       int       ):
   _lowercase							     =       numpy.linspace(-window_size,				_snake_case,				_snake_case       )
   _lowercase							     =       x.reshape((nb_pixels, 1)       )
   _lowercase							     =       numpy.linspace(-window_size,				_snake_case,				_snake_case       )
   _lowercase							     =       y.reshape((1, nb_pixels)       )
   return x + 1.0j * y


def   __UpperCAmelCase     (	_snake_case		:       Callable[[Any, numpy.ndarray], numpy.ndarray],				_snake_case		:       Any,				_snake_case		:       int,				_snake_case		:       numpy.ndarray,				_snake_case		:       float | None = None,				):
   _lowercase							     =       z_a.astype("complex64"       )
   for _ in range(_snake_case       ):
      _lowercase							     =       eval_function(_snake_case,				_snake_case       )
      if infinity is not None:
         numpy.nan_to_num(_snake_case,				copy=_snake_case,				nan=_snake_case       )
         _lowercase							     =       infinity
   return z_n


def   __UpperCAmelCase     (	_snake_case		:       str,				_snake_case		:       Any,				_snake_case		:       float,				_snake_case		:       numpy.ndarray,				):
   _lowercase							     =       (abs(_snake_case       )).transpose()
   _lowercase							     =       abs_z_final[::-1, :]
   pyplot.matshow(abs_z_final < escape_radius       )
   pyplot.title(f"""Julia set of ${function_label}$, $c={function_params}$"""       )
   pyplot.show()


def   __UpperCAmelCase     (	):
   warnings.filterwarnings(
       "ignore",				category=_snake_case,				message="overflow encountered in multiply"       )
   warnings.filterwarnings(
       "ignore",				category=_snake_case,				message="invalid value encountered in multiply",				)
   warnings.filterwarnings(
       "ignore",				category=_snake_case,				message="overflow encountered in absolute"       )
   warnings.filterwarnings(
       "ignore",				category=_snake_case,				message="overflow encountered in exp"       )


if __name__ == "__main__":
  __UpperCamelCase       :    Optional[int]         =		prepare_grid(window_size, nb_pixels)

  ignore_overflow_warnings()  # See file header for explanations

  __UpperCamelCase       :    str         =		2_4
  __UpperCamelCase       :    int         =		2 * abs(c_cauliflower) + 1
  __UpperCamelCase       :    Union[str, Any]         =		iterate_function(
      eval_quadratic_polynomial,
      c_cauliflower,
      nb_iterations,
      z_a,
      infinity=1.1 * escape_radius,
  )
  show_results("z^2+c", c_cauliflower, escape_radius, z_final)

  __UpperCamelCase       :    str         =		6_4
  __UpperCamelCase       :    Dict         =		2 * abs(c_polynomial_a) + 1
  __UpperCamelCase       :    str         =		iterate_function(
      eval_quadratic_polynomial,
      c_polynomial_a,
      nb_iterations,
      z_a,
      infinity=1.1 * escape_radius,
  )
  show_results("z^2+c", c_polynomial_a, escape_radius, z_final)

  __UpperCamelCase       :    Optional[int]         =		1_6_1
  __UpperCamelCase       :    Dict         =		2 * abs(c_polynomial_a) + 1
  __UpperCamelCase       :    Optional[Any]         =		iterate_function(
      eval_quadratic_polynomial,
      c_polynomial_a,
      nb_iterations,
      z_a,
      infinity=1.1 * escape_radius,
  )
  show_results("z^2+c", c_polynomial_a, escape_radius, z_final)

  __UpperCamelCase       :    Optional[int]         =		1_2
  __UpperCamelCase       :    Optional[Any]         =		10_000.0
  __UpperCamelCase       :    str         =		iterate_function(
      eval_exponential,
      c_exponential,
      nb_iterations,
      z_a + 2,
      infinity=1.0E10,
  )
  show_results("e^z+c", c_exponential, escape_radius, z_final)
"""simple docstring"""


__UpperCamelCase       :    List[Any]         =		"\n# Diffusers installation\n! pip install diffusers transformers datasets accelerate\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/diffusers.git\n"

__UpperCamelCase       :    Any         =		[{"type": "code", "content": INSTALL_CONTENT}]