






"""simple docstring"""






from sympy import diff, lambdify, symbols
from sympy.functions import *  # noqa: F403



def  __lowerCamelCase					(					lowerCAmelCase__       ,lowerCAmelCase__       ,lowerCAmelCase__ = "x"       ,lowerCAmelCase__ = 10**-10       ,lowerCAmelCase__ = 1       ,):
				A__							 =       symbols(lowerCAmelCase__				)
				A__							 =       lambdify(lowerCAmelCase__       ,lowerCAmelCase__				)
				A__							 =       lambdify(lowerCAmelCase__       ,diff(lowerCAmelCase__       ,lowerCAmelCase__				)				)

				A__							 =       starting_point

				while True:
								if diff_function(lowerCAmelCase__				) != 0:
												A__							 =       prev_guess - multiplicity * func(lowerCAmelCase__				) / diff_function(
												    lowerCAmelCase__				)
								else:
												raise ZeroDivisionError('Could not find root'				) from None

								# Precision is checked by comparing the difference of consecutive guesses
								if abs(next_guess - prev_guess				) < precision:
												return next_guess

								A__							 =       next_guess


# Let's Execute
if __name__ == "__main__":
					# Find root of trigonometric function
					# Find value of pi
					print(f'''The root of sin(x) = 0 is {newton_raphson("sin(x)", 2)}''')

					# Find root of polynomial
					# Find fourth Root of 5
					print(f'''The root of x**4 - 5 = 0 is {newton_raphson("x**4 -5", 0.4 +5J)}''')

					# Find value of e
					print(
					    '''The root of log(y) - 1 = 0 is ''',
					    f'''{newton_raphson("log(y) - 1", 2, variable="y")}''',
					)

					# Exponential Roots
					print(
					    '''The root of exp(x) - 1 = 0 is''',
					    f'''{newton_raphson("exp(x) - 1", 10, precision=0.0_0_5)}''',
					)

					# Find root of cos(x)
					print(f'''The root of cos(x) = 0 is {newton_raphson("cos(x)", 0)}''')










"""simple docstring"""






from ...configuration_utils import PretrainedConfig
from ...utils import logging


SCREAMING_SNAKE_CASE						:						Any					   =       logging.get_logger(__name__)





class       snake_case_       (    _lowerCamelCase       ):



	"""simple docstring"""

	SCREAMING_SNAKE_CASE_:							Union[str, Any]   			=					"""timm_backbone"""


	def __init__(      self  ,					__a=None  ,					__a=3  ,					__a=True  ,					__a=True  ,					__a=None  ,					**__a  ,					):


					"""simple docstring"""

					super().__init__(**__a						)
					A__							 =       backbone
					A__							 =       num_channels
					A__							 =       features_only
					A__							 =       use_pretrained_backbone
					A__							 =       True
					A__							 =       out_indices if out_indices is not None else (-1,)


