
from __future__ import annotations

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

from sympy import diff

def  __lowerCamelCase					( _lowercase						,     _lowercase						,     _lowercase = 10**-10			)       ->      float:
     UpperCamelCase						    =					a
     while True:
          UpperCamelCase						    =					Decimal(_lowercase			) - (
              Decimal(eval(_lowercase			)			) / Decimal(eval(str(diff(_lowercase			)			)			)			)  # noqa: S307
          )
          # This number dictates the accuracy of the answer
          if abs(eval(_lowercase			)			) < precision:  # noqa: S307
               return float(_lowercase			)


# 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)}")





'''simple docstring'''



import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast



@dataclass
class 				_snake_case					(   datasets.BuilderConfig			):
  SCREAMING_SNAKE_CASE			:       Optional[datasets.Features]				=     None



class 				_snake_case					(   datasets.ArrowBasedBuilder			):
  SCREAMING_SNAKE_CASE			:       Tuple				=     PandasConfig

  def   _SCREAMING_SNAKE_CASE				(				self	):





      '''simple docstring'''

      return datasets.DatasetInfo(features=self.config.features	)

  def   _SCREAMING_SNAKE_CASE				(				self      , _SCREAMING_SNAKE_CASE	):





      '''simple docstring'''

      if not self.config.data_files:
          raise ValueError(F'At least one data file must be specified, but got data_files={self.config.data_files}'	)
      lowerCAmelCase 						=							dl_manager.download_and_extract(self.config.data_files	)
      if isinstance(_SCREAMING_SNAKE_CASE      , (str, list, tuple)	):
          lowerCAmelCase 						=							data_files
          if isinstance(_SCREAMING_SNAKE_CASE      , _SCREAMING_SNAKE_CASE	):
              lowerCAmelCase 						=							[files]
          # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
          lowerCAmelCase 						=							[dl_manager.iter_files(_SCREAMING_SNAKE_CASE	) for file in files]
          return [datasets.SplitGenerator(name=datasets.Split.TRAIN      , gen_kwargs={'files': files}	)]
      lowerCAmelCase 						=							[]
      for split_name, files in data_files.items():
          if isinstance(_SCREAMING_SNAKE_CASE      , _SCREAMING_SNAKE_CASE	):
              lowerCAmelCase 						=							[files]
          # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
          lowerCAmelCase 						=							[dl_manager.iter_files(_SCREAMING_SNAKE_CASE	) for file in files]
          splits.append(datasets.SplitGenerator(name=_SCREAMING_SNAKE_CASE      , gen_kwargs={'files': files}	)	)
      return splits

  def   _SCREAMING_SNAKE_CASE				(				self      , _SCREAMING_SNAKE_CASE	):





      '''simple docstring'''

      if self.config.features is not None:
          # more expensive cast to support nested features with keys in a different order
          # allows str <-> int/float or str to Audio for example
          lowerCAmelCase 						=							table_cast(_SCREAMING_SNAKE_CASE      , self.config.features.arrow_schema	)
      return pa_table


  def   _SCREAMING_SNAKE_CASE				(				self      , _SCREAMING_SNAKE_CASE	):





      '''simple docstring'''

      for i, file in enumerate(itertools.chain.from_iterable(_SCREAMING_SNAKE_CASE	)	):
          with open(_SCREAMING_SNAKE_CASE      , 'rb'	) as f:
              lowerCAmelCase 						=							pa.Table.from_pandas(pd.read_pickle(_SCREAMING_SNAKE_CASE	)	)
              yield i, self._cast_table(_SCREAMING_SNAKE_CASE	)





