






"""simple docstring"""






from __future__ import annotations

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

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



def       _A    (__a					,       __a							)				-> list[numpy.ndarray]:
				"""simple docstring"""






				SCREAMING_SNAKE_CASE_   :						int							=	initial_vectors
				for _ in range(__a							):
								SCREAMING_SNAKE_CASE_   :						str							=	iteration_step(__a							)
				return vectors



def       _A    (__a							)				-> list[numpy.ndarray]:
				"""simple docstring"""






				SCREAMING_SNAKE_CASE_   :						Any							=	[]
				for i, start_vector in enumerate(vectors[:-1]							):
								SCREAMING_SNAKE_CASE_   :						List[str]							=	vectors[i + 1]
								new_vectors.append(__a							)
								SCREAMING_SNAKE_CASE_   :						Union[str, 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       _A    (__a					,       __a							)				-> numpy.ndarray:
				"""simple docstring"""






				SCREAMING_SNAKE_CASE_   :						List[Any]							=	numpy.radians(__a							)
				SCREAMING_SNAKE_CASE_   :						int							=	numpy.cos(__a							), numpy.sin(__a							)
				SCREAMING_SNAKE_CASE_   :						Union[str, Any]							=	numpy.array(((c, -s), (s, c))							)
				return numpy.dot(__a					,       __a							)



def       _A    (__a							)				-> None:
				"""simple docstring"""






				SCREAMING_SNAKE_CASE_   :						Dict							=	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()
				SCREAMING_SNAKE_CASE_   :						List[str]							=	zip(*__a							)
				plt.plot(__a					,       __a							)
				plt.show()


if __name__ == "__main__":
		import doctest

		doctest.testmod()

		UpperCAmelCase_     :				int         =				iterate(INITIAL_VECTORS, 5)
		plot(processed_vectors)










"""simple docstring"""






from __future__ import annotations



def       _A    (__a					,       __a					,       __a							)				-> int | float:
    """simple docstring"""






    if len(__a							) == 0:
        raise ValueError('''find_max() arg is an empty sequence'''							)
    if (
        left >= len(__a							)
        or left < -len(__a							)
        or right >= len(__a							)
        or right < -len(__a							)
    ):
        raise IndexError('''list index out of range'''							)
    if left == right:
        return nums[left]
    SCREAMING_SNAKE_CASE_   :						str							=	(left + right) >> 1  # the middle
    SCREAMING_SNAKE_CASE_   :						int							=	find_max(__a					,       __a					,       __a							)  # find max in range[left, mid]
    SCREAMING_SNAKE_CASE_   :						str							=	find_max(__a					,       mid + 1					,       __a							)  # find max in range[mid + 1, right]

    return left_max if left_max >= right_max else right_max


if __name__ == "__main__":
  import doctest

  doctest.testmod(verbose=True)


