
'''simple docstring'''





from collections.abc import Callable

A							     = Callable[[float], float]  # type alias for a real -> real function
def 	snake_case_							(				_a  :				RealFunc			,       _a  :				RealFunc			,       _a  :				int			,       ):
      snake_case_    							=				float(_a      )
      while True:
            try:
                  snake_case_    							=				prev_guess - function(_a      ) / derivative(_a      )
            except ZeroDivisionError:
                  raise ZeroDivisionError("Could not find root"      ) from None
            if abs(prev_guess - next_guess      ) < 10**-5:
                  return next_guess
            snake_case_    							=				next_guess
def 	snake_case_							(				_a  :				float      ):
      return (x**3) - (2 * x) - 5
def 	snake_case_							(				_a  :				float      ):
      return 3 * (x**2) - 2


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




def   UpperCamelCase(   lowercase_				)      ->							float:





  '''simple docstring'''





  return -num if num < 0 else num



def   UpperCamelCase(   lowercase_				)      ->							int:





  '''simple docstring'''





  if len(lowercase_				) == 0:
    raise ValueError("""abs_min() arg is an empty sequence"""				)
  snake_case_					= x[0]
  for i in x:
    if abs_val(lowercase_				) < abs_val(lowercase_				):
      snake_case_					= i
  return j



def   UpperCamelCase(   lowercase_				)      ->							int:





  '''simple docstring'''





  if len(lowercase_				) == 0:
    raise ValueError("""abs_max() arg is an empty sequence"""				)
  snake_case_					= x[0]
  for i in x:
    if abs(lowercase_				) > abs(lowercase_				):
      snake_case_					= i
  return j



def   UpperCamelCase(   lowercase_				)      ->							int:





  '''simple docstring'''





  if len(lowercase_				) == 0:
    raise ValueError("""abs_max_sort() arg is an empty sequence"""				)
  return sorted(lowercase_     ,   key=lowercase_				)[-1]



def   UpperCamelCase(   )      ->							List[Any]:





  '''simple docstring'''





  assert abs_val(0				) == 0
  assert abs_val(34				) == 34
  assert abs_val(-100000000000				) == 100000000000

  snake_case_					= [-3, -1, 2, -11]
  assert abs_max(lowercase_				) == -11
  assert abs_max_sort(lowercase_				) == -11
  assert abs_min(lowercase_				) == -1


if __name__ == "__main__":
    import doctest

    doctest.testmod()

    test_abs_val()
    print(abs_val(-34))  # --> 34