





"""simple docstring"""


from __future__ import annotations

import matplotlib.pyplot as plt  # type: ignore
import numpy

# initial triangle of Koch snowflake
lowerCamelCase__						= numpy.array([0, 0])
lowerCamelCase__						= numpy.array([0.5, 0.8_6_6_0_2_5_4])
lowerCamelCase__						= numpy.array([1, 0])
lowerCamelCase__						= [VECTOR_1, VECTOR_2, VECTOR_3, VECTOR_1]




def        lowercase__     (       lowercase_		,lowercase_      )       ->		list[numpy.ndarray]:




      """simple docstring"""

      _UpperCamelCase   :						Optional[Any]    =							initial_vectors
      for _ in range(lowercase_      ):
            _UpperCamelCase   :						Optional[Any]    =							iteration_step(lowercase_      )
      return vectors




def        lowercase__     (       lowercase_      )       ->		list[numpy.ndarray]:




      """simple docstring"""

      _UpperCamelCase   :						List[str]    =							[]
      for i, start_vector in enumerate(vectors[:-1]      ):
            _UpperCamelCase   :						List[str]    =							vectors[i + 1]
            new_vectors.append(lowercase_      )
            _UpperCamelCase   :						List[Any]    =							end_vector - start_vector
            new_vectors.append(start_vector + difference_vector / 3      )
            new_vectors.append(
                start_vector + difference_vector / 3 + rotate(difference_vector / 3		,60      )      )
            new_vectors.append(start_vector + difference_vector * 2 / 3      )
      new_vectors.append(vectors[-1]      )
      return new_vectors




def        lowercase__     (       lowercase_		,lowercase_      )       ->		numpy.ndarray:




      """simple docstring"""

      _UpperCamelCase   :						Tuple    =							numpy.radians(lowercase_      )
      _UpperCamelCase,	_UpperCamelCase   :						str    =							numpy.cos(lowercase_      ), numpy.sin(lowercase_      )
      _UpperCamelCase   :						Optional[Any]    =							numpy.array(((c, -s), (s, c))      )
      return numpy.dot(lowercase_		,lowercase_      )




def        lowercase__     (       lowercase_      )       ->		None:




      """simple docstring"""

      _UpperCamelCase   :						Tuple    =							plt.gca()
      axes.set_aspect("equal"      )

      # matplotlib.pyplot.plot takes a list of all x-coordinates and a list of all
      # y-coordinates as inputs, which are constructed from the vector-list using
      # zip()
      _UpperCamelCase,	_UpperCamelCase   :						List[Any]    =							zip(*lowercase_      )
      plt.plot(lowercase_		,lowercase_      )
      plt.show()


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  lowerCamelCase__						= iterate(INITIAL_VECTORS, 5)
  plot(processed_vectors)







"""simple docstring"""


from collections.abc import Callable

import numpy as np




def        lowercase__     (       lowercase_		,lowercase_		,lowercase_		,lowercase_		,lowercase_      )       ->		np.ndarray:




      """simple docstring"""

      _UpperCamelCase   :						List[str]    =							int(np.ceil((x_end - xa) / step_size      )      )
      _UpperCamelCase   :						Tuple    =							np.zeros((n + 1,)      )
      _UpperCamelCase   :						List[str]    =							ya
      _UpperCamelCase   :						List[Any]    =							xa

      for k in range(lowercase_      ):
            _UpperCamelCase   :						List[str]    =							y[k] + step_size * ode_func(lowercase_		,y[k]      )
            x += step_size

      return y


if __name__ == "__main__":
  import doctest

  doctest.testmod()
