




'''simple docstring'''





from __future__ import annotations


def 					UpperCamelCase_(     snake_case							:	list							,    snake_case							:	int							,    snake_case							:	int							,    snake_case							:	int					):

							'''simple docstring'''






							snake_case_      =				[]
							snake_case_ ,				snake_case_      =				input_list[low:mid], input_list[mid : high + 1]
							while left and right:
														result.append((left if left[0] <= right[0] else right).pop(0					)					)
							snake_case_      =				result + left + right
							return input_list


def 					UpperCamelCase_(     snake_case							:	list					):

							'''simple docstring'''






							if len(SCREAMING_SNAKE_CASE_					) <= 1:
														return input_list
							snake_case_      =				list(SCREAMING_SNAKE_CASE_					)

							# iteration for two-way merging
							snake_case_      =				2
							while p <= len(SCREAMING_SNAKE_CASE_					):
														# getting low, high and middle value for merge-sort of single list
														for i in range(0							,    len(SCREAMING_SNAKE_CASE_					)							,    SCREAMING_SNAKE_CASE_					):
																					snake_case_      =				i
																					snake_case_      =				i + p - 1
																					snake_case_      =				(low + high + 1) // 2
																					snake_case_      =				merge(SCREAMING_SNAKE_CASE_							,    SCREAMING_SNAKE_CASE_							,    SCREAMING_SNAKE_CASE_							,    SCREAMING_SNAKE_CASE_					)
														# final merge of last two parts
														if p * 2 >= len(SCREAMING_SNAKE_CASE_					):
																					snake_case_      =				i
																					snake_case_      =				merge(SCREAMING_SNAKE_CASE_							,    0							,    SCREAMING_SNAKE_CASE_							,    len(SCREAMING_SNAKE_CASE_					) - 1					)
																					break
														p *= 2

							return input_list


if __name__ == "__main__":
				_SCREAMING_SNAKE_CASE							:       List[str]						=			input("Enter numbers separated by a comma:\n").strip()
				if user_input == "":
								_SCREAMING_SNAKE_CASE							:       Union[str, Any]						=			[]
				else:
								_SCREAMING_SNAKE_CASE							:       Union[str, Any]						=			[int(item.strip()) for item in user_input.split(",")]
				print(iter_merge_sort(unsorted))










'''simple docstring'''





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


def 					UpperCamelCase_(     snake_case							:	str							,    snake_case							:	complex							,    snake_case							:	str = "x"							,    snake_case							:	float = 1_0**-1_0							,    snake_case							:	int = 1							,    ):

							'''simple docstring'''






							snake_case_      =				symbols(snake_case					)
							snake_case_      =				lambdify(snake_case							,    snake_case					)
							snake_case_      =				lambdify(snake_case							,    diff(snake_case							,    snake_case					)					)

							snake_case_      =				starting_point

							while True:
														if diff_function(snake_case					) != 0:
																					snake_case_      =				prev_guess - multiplicity * func(snake_case					) / diff_function(
																					    snake_case					)
														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

														snake_case_      =				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)}")




