




"""simple docstring"""

from __future__ import annotations

import math
from collections.abc import Callable

def 		lowercase_      (		_UpperCAmelCase  ,      _UpperCAmelCase  ,      _UpperCAmelCase  ,      _UpperCAmelCase = 100  ,      ):




	"""simple docstring"""






	A_  :				Optional[int]	   =		x_start
	A_  :				Tuple	   =		fnc(_UpperCAmelCase	)
	A_  :				int	   =		0.0

	for _ in range(_UpperCAmelCase	):
		# Approximates curve as a sequence of linear lines and sums their length
		A_  :				Any	   =		(x_end - x_start) / steps + xa
		A_  :				Any	   =		fnc(_UpperCAmelCase	)
		length += math.hypot(xa - xa  ,      fxa - fxa	)

		# Increment step
		A_  :				str	   =		xa
		A_  :				Optional[int]	   =		fxa

	return length


if __name__ == "__main__":

		def 		lowercase_      (		_UpperCAmelCase	):




			"""simple docstring"""






			return math.sin(10 * x	)

		print('f(x) = sin(10 * x)')
		print('The length of the curve from x = -10 to x = 10 is:')
		_lowerCamelCase  :			Tuple        =       10
		while i <= 100000:
				print(f'With {i} steps: {line_length(f, -10, 10, i)}')
				i *= 10











"""simple docstring"""

from typing import Any

import numpy as np

def 		lowercase_      (		_UpperCAmelCase	):




	"""simple docstring"""






	return np.array_equal(_UpperCAmelCase  ,      matrix.conjugate().T	)

def 		lowercase_      (		_UpperCAmelCase  ,      _UpperCAmelCase	):




	"""simple docstring"""






	A_  :				Tuple	   =		v.conjugate().T
	A_  :				Tuple	   =		v_star.dot(_UpperCAmelCase	)
	assert isinstance(_UpperCAmelCase  ,      np.ndarray	)
	return (v_star_dot.dot(_UpperCAmelCase	)) / (v_star.dot(_UpperCAmelCase	))

def 		lowercase_      (		):




	"""simple docstring"""






	A_  :				Optional[Any]	   =		np.array([[2, 2 + 1J, 4], [2 - 1J, 3, 1J], [4, -1J, 1]]	)
	A_  :				str	   =		np.array([[1], [2], [3]]	)
	assert is_hermitian(_UpperCAmelCase	), f"""{a} is not hermitian."""
	print(rayleigh_quotient(_UpperCAmelCase  ,      _UpperCAmelCase	)	)

	A_  :				int	   =		np.array([[1, 2, 4], [2, 3, -1], [4, -1, 1]]	)
	assert is_hermitian(_UpperCAmelCase	), f"""{a} is not hermitian."""
	assert rayleigh_quotient(_UpperCAmelCase  ,      _UpperCAmelCase	) == float(3	)


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		tests()





