



"""simple docstring"""
def       _snake_case						(						UpperCamelCase						:		Tuple			,		UpperCamelCase						:		Optional[int]						):
 UpperCAmelCase	:					Tuple	=	0
 UpperCAmelCase	:					str	=	len(UpperCamelCase						) - 1

 while left <= right:
  # avoid divided by 0 during interpolation
  if sorted_collection[left] == sorted_collection[right]:
   if sorted_collection[left] == item:
    return left
   else:
    return None

  UpperCAmelCase	:					List[Any]	=	left + ((item - sorted_collection[left]) * (right - left)) // (
      sorted_collection[right] - sorted_collection[left]
  )

  # out of range check
  if point < 0 or point >= len(UpperCamelCase						):
   return None

  UpperCAmelCase	:					Tuple	=	sorted_collection[point]
  if current_item == item:
   return point
  else:
   if point < left:
    UpperCAmelCase	:					List[str]	=	left
    UpperCAmelCase	:					Union[str, Any]	=	point
   elif point > right:
    UpperCAmelCase	:					Union[str, Any]	=	right
    UpperCAmelCase	:					List[str]	=	point
   else:
    if item < current_item:
     UpperCAmelCase	:					Tuple	=	point - 1
    else:
     UpperCAmelCase	:					Any	=	point + 1
 return None

def       _snake_case						(						UpperCamelCase						:		int			,		UpperCamelCase						:		Tuple			,		UpperCamelCase						:		int			,		UpperCamelCase						:		Dict						):

 # avoid divided by 0 during interpolation
 if sorted_collection[left] == sorted_collection[right]:
  if sorted_collection[left] == item:
   return left
  else:
   return None

 UpperCAmelCase	:					Optional[int]	=	left + ((item - sorted_collection[left]) * (right - left)) // (
     sorted_collection[right] - sorted_collection[left]
 )

 # out of range check
 if point < 0 or point >= len(UpperCamelCase						):
  return None

 if sorted_collection[point] == item:
  return point
 elif point < left:
  return interpolation_search_by_recursion(UpperCamelCase			,		UpperCamelCase			,		UpperCamelCase			,		UpperCamelCase						)
 elif point > right:
  return interpolation_search_by_recursion(UpperCamelCase			,		UpperCamelCase			,		UpperCamelCase			,		UpperCamelCase						)
 else:
  if sorted_collection[point] > item:
   return interpolation_search_by_recursion(
       UpperCamelCase			,		UpperCamelCase			,		UpperCamelCase			,		point - 1						)
  else:
   return interpolation_search_by_recursion(
       UpperCamelCase			,		UpperCamelCase			,		point + 1			,		UpperCamelCase						)

def       _snake_case						(						UpperCamelCase						:		Optional[Any]						):
 if collection != sorted(UpperCamelCase						):
  raise ValueError("""Collection must be ascending sorted"""						)
 return True


if __name__ == "__main__":
      import sys
      A:   Any								=		0
      if debug == 1:
            A:   Optional[int]								=		[1_0, 3_0, 4_0, 4_5, 5_0, 6_6, 7_7, 9_3]
            try:
                  __assert_sorted(collection)
            except ValueError:
                  sys.exit("Sequence must be ascending sorted to apply interpolation search")
            A:   str								=		6_7

      A:   List[Any]								=		interpolation_search(collection, target)
      if result is not None:
            print(f"""{target} found at positions: {result}""")
      else:
            print("Not found")





"""simple docstring"""
from collections.abc import Callable

import numpy as np

def       _snake_case						(						UpperCamelCase						:		Callable			,		UpperCamelCase						:		float			,		UpperCamelCase						:		float			,		UpperCamelCase						:		float			,		UpperCamelCase						:		float						):
 UpperCAmelCase	:					Any	=	int(np.ceil((x_end - xa) / step_size						)						)
 UpperCAmelCase	:					Optional[Any]	=	np.zeros((n + 1,)						)
 UpperCAmelCase	:					Optional[int]	=	ya
 UpperCAmelCase	:					int	=	xa

 for k in range(UpperCamelCase						):
  UpperCAmelCase	:					Optional[int]	=	y[k] + step_size * ode_func(UpperCamelCase			,		y[k]						)
  UpperCAmelCase	:					Optional[int]	=	y[k] + (
      (step_size / 2) * (ode_func(UpperCamelCase			,		y[k]						) + ode_func(x + step_size			,		UpperCamelCase						))
  )
  x += step_size

 return y


if __name__ == "__main__":
      import doctest

      doctest.testmod()
