
def  UpperCAmelCase_   (_lowerCAmelCase :		list		):
			__UpperCamelCase    :    Union[str, Any]								=      len(_lowerCAmelCase		)

			# Set the gap value to be decreased by a factor of 1.3
			# after each iteration
			__UpperCamelCase    :    Optional[int]								=      1.3

			# Continue sorting until the gap is 1
			while gap > 1:
						# Decrease the gap value
						__UpperCamelCase    :    List[str]								=      int(gap / shrink		)

						# Sort the elements using insertion sort
						for i in range(_lowerCAmelCase     ,			len(_lowerCAmelCase		)		):
									__UpperCamelCase    :    int								=      collection[i]
									__UpperCamelCase    :    Dict								=      i
									while j >= gap and collection[j - gap] > temp:
												__UpperCamelCase    :    Dict								=      collection[j - gap]
												j -= gap
									__UpperCamelCase    :    List[str]								=      temp

			return collection


if __name__ == "__main__":
					import doctest

					doctest.testmod()


from collections.abc import Callable

lowercase     :       Optional[Any]        =       Callable[[float], float]  # type alias for a real -> real function







def  UpperCAmelCase_   (_lowerCAmelCase :		RealFunc     ,			_lowerCAmelCase :		RealFunc     ,			_lowerCAmelCase :		int     ,			):
			__UpperCamelCase    :    Any								=      float(_lowerCAmelCase		)
			while True:
						try:
									__UpperCamelCase    :    List[Any]								=      prev_guess - function(_lowerCAmelCase		) / derivative(_lowerCAmelCase		)
						except ZeroDivisionError:
									raise ZeroDivisionError("Could not find root"		) from None
						if abs(prev_guess - next_guess		) < 10**-5:
									return next_guess
						__UpperCamelCase    :    Tuple								=      next_guess







def  UpperCAmelCase_   (_lowerCAmelCase :		float		):
			return (x**3) - (2 * x) - 5







def  UpperCAmelCase_   (_lowerCAmelCase :		float		):
			return 3 * (x**2) - 2


if __name__ == "__main__":
					print(newton(f, fa, 3))