


"""simple docstring"""





def   _snake_case    (    _snake_case					:      list      ):
      lowerCAmelCase       :						str							= len(_snake_case      )

      # Set the gap value to be decreased by a factor of 1.3
      # after each iteration
      lowerCAmelCase       :						Any							= 1.3

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

            # Sort the elements using insertion sort
            for i in range(_snake_case			, len(_snake_case      )      ):
                  lowerCAmelCase       :						str							= collection[i]
                  lowerCAmelCase       :						Union[str, Any]							= i
                  while j >= gap and collection[j - gap] > temp:
                        lowerCAmelCase       :						Optional[Any]							= collection[j - gap]
                        j -= gap
                  lowerCAmelCase       :						Dict							= temp

      return collection


if __name__ == "__main__":
 import doctest

 doctest.testmod()






"""simple docstring"""





from collections.abc import Callable

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


def   _snake_case    (    _snake_case					:      RealFunc			, _snake_case					:      RealFunc			, _snake_case					:      int			, ):
      lowerCAmelCase       :						Dict							= float(_snake_case      )
      while True:
            try:
                  lowerCAmelCase       :						Optional[Any]							= prev_guess - function(_snake_case      ) / derivative(_snake_case      )
            except ZeroDivisionError:
                  raise ZeroDivisionError('''Could not find root'''      ) from None
            if abs(prev_guess - next_guess      ) < 10**-5:
                  return next_guess
            lowerCAmelCase       :						Optional[int]							= next_guess


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


def   _snake_case    (    _snake_case					:      float      ):
      return 3 * (x**2) - 2


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


