
"""simple docstring"""
from collections.abc import Callable

_a   :      int       =				Callable[[float], float]  # type alias for a real -> real function
def 					a__ ( a :					RealFunc							,  a :					RealFunc							,  a :					int							,  ):

  """simple docstring"""







  _snake_case  :    int            = float(a		)
  while True:
    try:
      _snake_case  :    int            = 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  :    List[str]            = next_guess
def 					a__ ( a :					float		):

  """simple docstring"""







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

  """simple docstring"""







  return 3 * (x**2) - 2


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






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase_			      =  {'''configuration_qdqbert''': ['''QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''QDQBertConfig''']}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCAmelCase_			      =  [
						    '''QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''QDQBertForMaskedLM''',
						    '''QDQBertForMultipleChoice''',
						    '''QDQBertForNextSentencePrediction''',
						    '''QDQBertForQuestionAnswering''',
						    '''QDQBertForSequenceClassification''',
						    '''QDQBertForTokenClassification''',
						    '''QDQBertLayer''',
						    '''QDQBertLMHeadModel''',
						    '''QDQBertModel''',
						    '''QDQBertPreTrainedModel''',
						    '''load_tf_weights_in_qdqbert''',
						]


if TYPE_CHECKING:
						from .configuration_qdqbert import QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, QDQBertConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_qdqbert import (
												    QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
												    QDQBertForMaskedLM,
												    QDQBertForMultipleChoice,
												    QDQBertForNextSentencePrediction,
												    QDQBertForQuestionAnswering,
												    QDQBertForSequenceClassification,
												    QDQBertForTokenClassification,
												    QDQBertLayer,
												    QDQBertLMHeadModel,
												    QDQBertModel,
												    QDQBertPreTrainedModel,
												    load_tf_weights_in_qdqbert,
												)


else:
						import sys

						UpperCAmelCase_			      =  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





