'''simple docstring'''

from __future__ import annotations

from collections.abc import Callable







def __UpperCamelCase( _A       :					Callable[[int | float], int | float]	,      _A       :					int | float	,      _A       :					int | float	,      _A       :					int = 1_00	,      ):
   '''simple docstring'''
   UpperCAmelCase__				:					Dict 					=	x_start
   UpperCAmelCase__				:					Optional[Any] 					=	fnc(_A     )
   UpperCAmelCase__				:					Union[str, Any] 					=	0.0
   for _ in range(_A     ):
      # Approximates small segments of curve as linear and solve
      # for trapezoidal area
      UpperCAmelCase__				:					Any 					=	(x_end - x_start) / steps + xa
      UpperCAmelCase__				:					Any 					=	fnc(_A     )
      area += abs(fxa + fxa     ) * (xa - xa) / 2
      # Increment step
      UpperCAmelCase__				:					Tuple 					=	xa
      UpperCAmelCase__				:					List[str] 					=	fxa
   return area


if __name__ == "__main__":







  def __UpperCamelCase( _A       :					Tuple     ):
     '''simple docstring'''
     return x**3 + x**2

  print('f(x) = x^3 + x^2')
  print('The area between the curve, x = -5, x = 5 and the x axis is:')
  UpperCamelCase__  :						Tuple					=      10
  while i <= 100_000:
    print(f"""with {i} steps: {trapezoidal_area(f, -5, 5, i)}""")
    i *= 10





'''simple docstring'''

from __future__ import annotations







def __UpperCamelCase( _A       :					list[int]	,      _A       :					int	,      _A       :					int	,      _A       :					int     ):
   '''simple docstring'''
   if (direction == 1 and array[indexa] > array[indexa]) or (
       direction == 0 and array[indexa] < array[indexa]
   ):
      UpperCAmelCase__					,   UpperCAmelCase__				:					Union[str, Any] 					=	array[indexa], array[indexa]







def __UpperCamelCase( _A       :					list[int]	,      _A       :					int	,      _A       :					int	,      _A       :					int     ):
   '''simple docstring'''
   if length > 1:
      UpperCAmelCase__				:					List[Any] 					=	int(length / 2     )
      for i in range(_A	,      low + middle     ):
         comp_and_swap(_A	,      _A	,      i + middle	,      _A     )
      bitonic_merge(_A	,      _A	,      _A	,      _A     )
      bitonic_merge(_A	,      low + middle	,      _A	,      _A     )







def __UpperCamelCase( _A       :					list[int]	,      _A       :					int	,      _A       :					int	,      _A       :					int     ):
   '''simple docstring'''
   if length > 1:
      UpperCAmelCase__				:					Optional[int] 					=	int(length / 2     )
      bitonic_sort(_A	,      _A	,      _A	,      1     )
      bitonic_sort(_A	,      low + middle	,      _A	,      0     )
      bitonic_merge(_A	,      _A	,      _A	,      _A     )


if __name__ == "__main__":
  UpperCamelCase__  :						Dict					=      input('Enter numbers separated by a comma:\n').strip()
  UpperCamelCase__  :						Tuple					=      [int(item.strip()) for item in user_input.split(',')]

  bitonic_sort(unsorted, 0, len(unsorted), 1)
  print('\nSorted array in ascending order is: ', end='')
  print(*unsorted, sep=', ')

  bitonic_merge(unsorted, 0, len(unsorted), 0)
  print('Sorted array in descending order is: ', end='')
  print(*unsorted, sep=', ')




