


"""simple docstring"""





import math


def   _snake_case    (    _snake_case					:      int      ):
      if not isinstance(_snake_case			, _snake_case      ):
            lowerCAmelCase       :						Tuple							= f'''Input value of [number={number}] must be an integer'''
            raise TypeError(_snake_case      )
      if number < 1:
            lowerCAmelCase       :						Union[str, Any]							= f'''Input value of [number={number}] must be a positive integer'''
            raise ValueError(_snake_case      )
      lowerCAmelCase       :						int							= [number]
      while number != 1:
            if number % 2 == 0:
                  lowerCAmelCase       :						str							= math.floor(math.sqrt(_snake_case      )      )
            else:
                  lowerCAmelCase       :						Optional[int]							= math.floor(
                      math.sqrt(_snake_case      ) * math.sqrt(_snake_case      ) * math.sqrt(_snake_case      )      )
            sequence.append(_snake_case      )
      return sequence


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))


