



from __future__ import annotations

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

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






def        A       (      _lowerCamelCase       ,				_lowerCamelCase						):





							'''simple docstring'''




							_lowerCAmelCase  :							Dict				     =					initial_vectors
							for _ in range(_lowerCamelCase						):
														_lowerCAmelCase  :							Optional[Any]				     =					iteration_step(_lowerCamelCase						)
							return vectors






def        A       (      _lowerCamelCase						):





							'''simple docstring'''




							_lowerCAmelCase  :							Optional[int]				     =					[]
							for i, start_vector in enumerate(vectors[:-1]						):
														_lowerCAmelCase  :							Optional[Any]				     =					vectors[i + 1]
														new_vectors.append(_lowerCamelCase						)
														_lowerCAmelCase  :							Tuple				     =					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       (      _lowerCamelCase       ,				_lowerCamelCase						):





							'''simple docstring'''




							_lowerCAmelCase  :							Tuple				     =					numpy.radians(_lowerCamelCase						)
							_lowerCAmelCase     ,					_lowerCAmelCase  :							List[Any]				     =					numpy.cos(_lowerCamelCase						), numpy.sin(_lowerCamelCase						)
							_lowerCAmelCase  :							str				     =					numpy.array(((c, -s), (s, c))						)
							return numpy.dot(_lowerCamelCase       ,				_lowerCamelCase						)






def        A       (      _lowerCamelCase						):





							'''simple docstring'''




							_lowerCAmelCase  :							Optional[Any]				     =					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()
							_lowerCAmelCase     ,					_lowerCAmelCase  :							Dict				     =					zip(*_lowerCamelCase						)
							plt.plot(_lowerCamelCase       ,				_lowerCamelCase						)
							plt.show()


if __name__ == "__main__":
						import doctest

						doctest.testmod()

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





def        A       (      _lowerCamelCase						):





							'''simple docstring'''




							if length <= 0 or not isinstance(_lowerCamelCase       ,				_lowerCamelCase						):
														raise ValueError("Length must be a positive integer."						)
							return [n * (2 * n - 1) for n in range(_lowerCamelCase						)]


if __name__ == "__main__":
						print(hexagonal_numbers(length=5))
						print(hexagonal_numbers(length=10))
