




'''simple docstring'''






from collections.abc import Callable

_lowerCAmelCase				     = Callable[[float], float]  # type alias for a real -> real function

def       __lowerCAmelCase (   snake_case__ ,				snake_case__ ,				snake_case__ ,				):
			__UpperCamelCase				:      List[str]									=       float(snake_case__						)
			while True:
						try:
									__UpperCamelCase				:      str									=       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
						__UpperCamelCase				:      List[Any]									=       next_guess

def       __lowerCAmelCase (   snake_case__						):
			return (x**3) - (2 * x) - 5

def       __lowerCAmelCase (   snake_case__						):
			return 3 * (x**2) - 2


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









'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_lowerCAmelCase				     = {'''configuration_visual_bert''': ['''VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''VisualBertConfig''']}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_lowerCAmelCase				     = [
				    '''VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
				    '''VisualBertForMultipleChoice''',
				    '''VisualBertForPreTraining''',
				    '''VisualBertForQuestionAnswering''',
				    '''VisualBertForRegionToPhraseAlignment''',
				    '''VisualBertForVisualReasoning''',
				    '''VisualBertLayer''',
				    '''VisualBertModel''',
				    '''VisualBertPreTrainedModel''',
				]


if TYPE_CHECKING:
				from .configuration_visual_bert import VISUAL_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, VisualBertConfig

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_visual_bert import (
								    VISUAL_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
								    VisualBertForMultipleChoice,
								    VisualBertForPreTraining,
								    VisualBertForQuestionAnswering,
								    VisualBertForRegionToPhraseAlignment,
								    VisualBertForVisualReasoning,
								    VisualBertLayer,
								    VisualBertModel,
								    VisualBertPreTrainedModel,
								)


else:
				import sys

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



