

from .imports import is_tqdm_available


if is_tqdm_available():
       from tqdm.auto import tqdm as _tqdm

from ..state import PartialState



def      snake_case__      (   SCREAMING_SNAKE_CASE_		:   Tuple = True     ,					*SCREAMING_SNAKE_CASE_		:   Any     ,					**SCREAMING_SNAKE_CASE_		:   Any      ):



     '''simple docstring'''





     if not is_tqdm_available():
          raise ImportError('Accelerate\'s `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`.'      )
     lowercase__   :       int				=	False
     if main_process_only:
          lowercase__   :       str				=	PartialState().local_process_index == 0
     return _tqdm(*__snake_case     ,					**__snake_case     ,					disable=__snake_case      )




import numpy as np

def      snake_case__      (   SCREAMING_SNAKE_CASE_		:   str     ,					SCREAMING_SNAKE_CASE_		:   Optional[int]     ,					SCREAMING_SNAKE_CASE_		:   Optional[int]     ,					SCREAMING_SNAKE_CASE_		:   Union[str, Any]     ,					SCREAMING_SNAKE_CASE_		:   List[Any]      ):



     '''simple docstring'''





     lowercase__   :       List[Any]				=	int(np.ceil((x_end - xa) / h      )      )
     lowercase__   :       Dict				=	np.zeros((n + 1,)      )
     lowercase__   :       Dict				=	ya
     lowercase__   :       Union[str, Any]				=	xa

     for k in range(SCREAMING_SNAKE_CASE_      ):
          lowercase__   :       Optional[int]				=	f(SCREAMING_SNAKE_CASE_     ,					y[k]      )
          lowercase__   :       Dict				=	f(x + 0.5 * h     ,					y[k] + 0.5 * h * ka      )
          lowercase__   :       Any				=	f(x + 0.5 * h     ,					y[k] + 0.5 * h * ka      )
          lowercase__   :       List[Any]				=	f(x + h     ,					y[k] + h * ka      )
          lowercase__   :       Tuple				=	y[k] + (1 / 6) * h * (ka + 2 * ka + 2 * ka + ka)
          x += h

     return y


if __name__ == "__main__":
       import doctest

       doctest.testmod()

