





_UpperCamelCase   :							str     =	1_0_0_0
def 				__UpperCamelCase  (		snake_case     )  ->						float:


   '''simple docstring'''







   return x * x
def 				__UpperCamelCase  (		snake_case    ,	snake_case    ,	snake_case    ,	snake_case = 4     )  ->						float:


   '''simple docstring'''







   assert callable(
       snake_case     ), F"the function(object) passed should be callable your input : {function}"
   assert isinstance(snake_case    ,	(float, int)     ), F"a should be float or integer your input : {a}"
   assert isinstance(function(snake_case     )    ,	(float, int)     ), (
       "the function should return integer or float return type of your function, "
       F"{type(snake_case     )}"
   )
   assert isinstance(snake_case    ,	(float, int)     ), F"b should be float or integer your input : {b}"
   assert (
       isinstance(snake_case    ,	snake_case     ) and precision > 0
   ), F"precision should be positive integer your input : {precision}"

   # just applying the formula of simpson for approximate integration written in
   # mentioned article in first comment of this file and above this function

   __A				 =       (b - a) / N_STEPS
   __A				 =       function(snake_case     ) + function(snake_case     )

   for i in range(1    ,	snake_case     ):
      __A				 =       a + h * i
      result += function(snake_case     ) * (4 if i % 2 else 2)

   result *= h / 3
   return round(snake_case    ,	snake_case     )


if __name__ == "__main__":
    import doctest

    doctest.testmod()








from __future__ import annotations
def 				__UpperCamelCase  (		snake_case    ,	snake_case     )  ->						list:


   '''simple docstring'''







   __A				 =       [None] * (len(snake_case     ) + len(snake_case     ))

   __A				 =       0  # pointer to current index for left Half
   __A				 =       0  # pointer to current index for the right Half
   __A				 =       0  # pointer to current index for the sorted array Half

   while pointera < len(snake_case     ) and pointera < len(snake_case     ):
      if left_half[pointera] < right_half[pointera]:
         __A				 =       left_half[pointera]
         pointera += 1
         index += 1
      else:
         __A				 =       right_half[pointera]
         pointera += 1
         index += 1
   while pointera < len(snake_case     ):
      __A				 =       left_half[pointera]
      pointera += 1
      index += 1

   while pointera < len(snake_case     ):
      __A				 =       right_half[pointera]
      pointera += 1
      index += 1

   return sorted_array
def 				__UpperCamelCase  (		snake_case     )  ->						list:


   '''simple docstring'''







   if len(snake_case     ) <= 1:
      return array
   # the actual formula to calculate the middle element = left + (right - left) // 2
   # this avoids integer overflow in case of large N
   __A				 =       0 + (len(snake_case     ) - 0) // 2

   # Split the array into halves till the array length becomes equal to One
   # merge the arrays of single length returned by mergeSort function and
   # pass them into the merge arrays function which merges the array
   __A				 =       array[:middle]
   __A				 =       array[middle:]

   return merge(merge_sort(snake_case     )    ,	merge_sort(snake_case     )     )


if __name__ == "__main__":
    import doctest

    doctest.testmod()

