






'''simple docstring'''







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

import numpy
from matplotlib import pyplot

__lowerCAmelCase					   =       0.25 + 0.0J
__lowerCAmelCase					   =       -0.4 + 0.6J
__lowerCAmelCase					   =       -0.1 + 0.651J
__lowerCAmelCase					   =       -2.0
__lowerCAmelCase					   =       56
__lowerCAmelCase					   =       2.0
__lowerCAmelCase					   =       6_66


def 			__UpperCamelCase				(			lowercase_					:     complex      ,					lowercase_					:     numpy.ndarray      ):
       """simple docstring"""




       return numpy.exp(lowercase_      ) + c_parameter


def 			__UpperCamelCase				(			lowercase_					:     complex      ,					lowercase_					:     numpy.ndarray      ):
       """simple docstring"""




       return z_values * z_values + c_parameter


def 			__UpperCamelCase				(			lowercase_					:     float      ,					lowercase_					:     int      ):
       """simple docstring"""




       a_	    = numpy.linspace(-window_size      ,					lowercase_      ,					lowercase_      )
       a_	    = x.reshape((nb_pixels, 1)      )
       a_	    = numpy.linspace(-window_size      ,					lowercase_      ,					lowercase_      )
       a_	    = y.reshape((1, nb_pixels)      )
       return x + 1.0J * y


def 			__UpperCamelCase				(			lowercase_					:     Callable[[Any, numpy.ndarray], numpy.ndarray]      ,					lowercase_					:     Any      ,					lowercase_					:     int      ,					lowercase_					:     numpy.ndarray      ,					lowercase_					:     float | None = None      ,					):
       """simple docstring"""




       a_	    = z_a.astype('complex64'      )
       for _ in range(lowercase_      ):
              a_	    = eval_function(lowercase_      ,					lowercase_      )
              if infinity is not None:
                     numpy.nan_to_num(lowercase_      ,					copy=lowercase_      ,					nan=lowercase_      )
                     a_	    = infinity
       return z_n


def 			__UpperCamelCase				(			lowercase_					:     str      ,					lowercase_					:     Any      ,					lowercase_					:     float      ,					lowercase_					:     numpy.ndarray      ,					):
       """simple docstring"""




       a_	    = (abs(lowercase_      )).transpose()
       a_	    = 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				(			):
       """simple docstring"""




       warnings.filterwarnings(
           'ignore'      ,					category=lowercase_      ,					message='overflow encountered in multiply'      )
       warnings.filterwarnings(
           'ignore'      ,					category=lowercase_      ,					message='invalid value encountered in multiply'      ,					)
       warnings.filterwarnings(
           'ignore'      ,					category=lowercase_      ,					message='overflow encountered in absolute'      )
       warnings.filterwarnings(
           'ignore'      ,					category=lowercase_      ,					message='overflow encountered in exp'      )


if __name__ == "__main__":
  __lowerCAmelCase					   =       prepare_grid(window_size, nb_pixels)

  ignore_overflow_warnings()  # See file header for explanations

  __lowerCAmelCase					   =       24
  __lowerCAmelCase					   =       2 * abs(c_cauliflower) + 1
  __lowerCAmelCase					   =       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)

  __lowerCAmelCase					   =       64
  __lowerCAmelCase					   =       2 * abs(c_polynomial_a) + 1
  __lowerCAmelCase					   =       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)

  __lowerCAmelCase					   =       1_61
  __lowerCAmelCase					   =       2 * abs(c_polynomial_a) + 1
  __lowerCAmelCase					   =       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)

  __lowerCAmelCase					   =       12
  __lowerCAmelCase					   =       1_00_00.0
  __lowerCAmelCase					   =       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'''







def 			__UpperCamelCase				(			lowercase_					:     int      ,					lowercase_					:     int      ):
       """simple docstring"""




       return (input_a, input_a).count(0      ) % 2


def 			__UpperCamelCase				(			):
       """simple docstring"""




       assert xor_gate(0      ,					0      ) == 0
       assert xor_gate(0      ,					1      ) == 1
       assert xor_gate(1      ,					0      ) == 1
       assert xor_gate(1      ,					1      ) == 0


if __name__ == "__main__":
  print(xor_gate(0, 0))
  print(xor_gate(0, 1))




