'''simple docstring'''





from __future__ import annotations

from decimal import Decimal
from math import *  # noqa: F403

from sympy import diff





def 	lowerCAmelCase_				(					snake_case_       : str					,    snake_case_       : float | Decimal					,    snake_case_       : float = 10**-10			)    ->      Tuple:


     '''simple docstring'''




     UpperCAmelCase_           =   a
     while True:
          UpperCAmelCase_           =   Decimal(__lowerCamelCase			) - (
              Decimal(eval(__lowerCamelCase			)			) / Decimal(eval(str(diff(__lowerCamelCase			)			)			)			)  # noqa: S307
          )
          # This number dictates the accuracy of the answer
          if abs(eval(__lowerCamelCase			)			) < precision:  # noqa: S307
               return float(__lowerCamelCase			)


# 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
    print(f"The root of x**2 - 5*x + 2 = 0 is {newton_raphson('x**2 - 5*x + 2', 0.4)}")
    # Find Square Root of 5
    print(f"The root of log(x) - 1 = 0 is {newton_raphson('log(x) - 1', 2)}")
    # Exponential Roots
    print(f"The root of exp(x) - 1 = 0 is {newton_raphson('exp(x) - 1', 0)}")






__lowerCamelCase							=       {
    "joule": 1.0,
    "kilojoule": 10_00,
    "megajoule": 1_00_00_00,
    "gigajoule": 10_00_00_00_00,
    "wattsecond": 1.0,
    "watthour": 36_00,
    "kilowatthour": 3_60_00_00,
    "newtonmeter": 1.0,
    "calorie_nutr": 41_86.8,
    "kilocalorie_nutr": 4_18_68_00.00,
    "electronvolt": 1.602_176_634e-19,
    "britishthermalunit_it": 10_55.0_55_85,
    "footpound": 1.35_5818,
}


def 			UpperCamelCase					(    __lowerCamelCase     : str				,					__lowerCamelCase     : str				,					__lowerCamelCase     : float    ):
       if to_type not in ENERGY_CONVERSION or from_type not in ENERGY_CONVERSION:
              snake_case       :   List[Any]							=      (
                  f"""Incorrect 'from_type' or 'to_type' value: {from_type!r}, {to_type!r}\n"""
                  f"""Valid values are: {', '.join(__lowerCamelCase    )}"""
              )
              raise ValueError(__lowerCamelCase    )
       return value * ENERGY_CONVERSION[from_type] / ENERGY_CONVERSION[to_type]


if __name__ == "__main__":
   import doctest

   doctest.testmod()





