






"""simple docstring"""
from manim import *



class   SCREAMING_SNAKE_CASE	(					_SCREAMING_SNAKE_CASE    ):





	"""simple docstring"""




	def  lowerCamelCase(self				):
		A_		:    int						     = Rectangle(height=0.5  ,  width=0.5				)
		A_		:    List[str]						     = Rectangle(height=0.46  ,  width=0.46				).set_stroke(width=0				)

		A_		:    Optional[int]						     = [mem.copy() for i in range(6				)]
		A_		:    List[str]						     = [mem.copy() for i in range(6				)]
		A_		:    int						     = VGroup(*lowerCAmelCase_				).arrange(lowerCAmelCase_  ,  buff=0				)
		A_		:    Tuple						     = VGroup(*lowerCAmelCase_				).arrange(lowerCAmelCase_  ,  buff=0				)
		A_		:    Any						     = VGroup(lowerCAmelCase_  ,  lowerCAmelCase_				).arrange(lowerCAmelCase_  ,  buff=0				)
		A_		:    Union[str, Any]						     = Text("""CPU"""  ,  font_size=24				)
		A_		:    Optional[Any]						     = Group(lowerCAmelCase_  ,  lowerCAmelCase_				).arrange(lowerCAmelCase_  ,  buff=0.5  ,  aligned_edge=lowerCAmelCase_				)
		cpu.move_to([-2.5, -0.5, 0]				)
		self.add(lowerCAmelCase_				)

		A_		:    Optional[Any]						     = [mem.copy() for i in range(1				)]
		A_		:    Dict						     = VGroup(*lowerCAmelCase_				).arrange(lowerCAmelCase_  ,  buff=0				)
		A_		:    Optional[int]						     = Text("""GPU"""  ,  font_size=24				)
		A_		:    Optional[int]						     = Group(lowerCAmelCase_  ,  lowerCAmelCase_				).arrange(lowerCAmelCase_  ,  buff=0.5  ,  aligned_edge=lowerCAmelCase_				)
		gpu.align_to(lowerCAmelCase_  ,  lowerCAmelCase_				)
		gpu.set_x(gpu.get_x() - 1				)

		self.add(lowerCAmelCase_				)

		A_		:    Optional[Any]						     = [mem.copy() for i in range(6				)]
		A_		:    List[Any]						     = VGroup(*lowerCAmelCase_				).arrange(lowerCAmelCase_  ,  buff=0				)

		A_		:    Any						     = Text("""Model"""  ,  font_size=24				)
		A_		:    Dict						     = Group(lowerCAmelCase_  ,  lowerCAmelCase_				).arrange(lowerCAmelCase_  ,  buff=0.5  ,  aligned_edge=lowerCAmelCase_				)
		model.move_to([3, -1.0, 0]				)

		self.play(
		    Create(lowerCAmelCase_  ,  run_time=1				)  ,  Create(lowerCAmelCase_  ,  run_time=1				)  ,  Create(lowerCAmelCase_  ,  run_time=1				)  ,  )

		A_		:    Optional[int]						     = MarkupText(
		    f"""First, an empty model skeleton is loaded\ninto <span fgcolor='{YELLOW}'>memory</span> without using much RAM."""  ,  font_size=24  ,  )

		A_		:    Union[str, Any]						     = Square(side_length=2.2				)
		key.move_to([-5, 2, 0]				)

		A_		:    Tuple						     = MarkupText(
		    f"""<b>Key:</b>\n\n<span fgcolor='{YELLOW}'>●</span> Empty Model"""  ,  font_size=18  ,  )

		key_text.move_to([-5, 2.4, 0]				)

		step_a.move_to([2, 2, 0]				)
		self.play(Write(lowerCAmelCase_  ,  run_time=2.5				)  ,  Write(lowerCAmelCase_				)  ,  Write(lowerCAmelCase_				)				)

		self.add(lowerCAmelCase_				)

		A_		:    Any						     = []
		A_		:    List[str]						     = []
		A_		:    Optional[int]						     = []
		for i, rect in enumerate(lowerCAmelCase_				):
			A_		:    Optional[Any]						     = Rectangle(height=0.46  ,  width=0.46				).set_stroke(width=0.0				).set_fill(lowerCAmelCase_  ,  opacity=0.7				)
			cpu_target.move_to(lowerCAmelCase_				)
			cpu_target.generate_target()
			A_		:    List[str]						     = 0.46 / 4
			A_		:    Union[str, Any]						     = 0.46 / 3

			if i == 0:
				cpu_target.target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT				)  ,  buff=0.02  ,  direction=lowerCAmelCase_				)
				cpu_target.target.set_x(cpu_target.target.get_x() + 0.1				)
			elif i == 3:
				cpu_target.target.next_to(cpu_targs[0].target  ,  direction=lowerCAmelCase_  ,  buff=0.0				)
			else:
				cpu_target.target.next_to(cpu_targs[i - 1].target  ,  direction=lowerCAmelCase_  ,  buff=0.0				)
			cpu_targs.append(lowerCAmelCase_				)

			first_animations.append(rect.animate(run_time=0.5				).set_stroke(lowerCAmelCase_				)				)
			second_animations.append(MoveToTarget(lowerCAmelCase_  ,  run_time=1.5				)				)

		self.play(*lowerCAmelCase_				)
		self.play(*lowerCAmelCase_				)

		self.wait()









"""simple docstring"""
from __future__ import annotations

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

from sympy import diff






def       __UpperCamelCase						(		snake_case__ , snake_case__ , snake_case__ = 10**-10       ):
	A_		:    Tuple						     = a
	while True:
		A_		:    List[str]						     = Decimal(snake_case__       ) - (
		    Decimal(eval(snake_case__       )       ) / Decimal(eval(str(diff(snake_case__       )       )       )       )  # noqa: S307
		)
		# This number dictates the accuracy of the answer
		if abs(eval(snake_case__       )       ) < precision:  # noqa: S307
			return float(snake_case__       )


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

