
from collections.abc import Callable

import numpy as np



def      __lowerCAmelCase						(							UpperCAmelCase__				:      Callable			,				UpperCAmelCase__				:      float			,				UpperCAmelCase__				:      float			,				UpperCAmelCase__				:      float			,				UpperCAmelCase__				:      float       )  ->    np.array:
							lowerCamelCase_							  =					int(np.ceil((x_end - xa) / step_size       )       )
							lowerCamelCase_							  =					np.zeros((n + 1,)       )
							lowerCamelCase_							  =					ya
							lowerCamelCase_							  =					xa

							for k in range(UpperCAmelCase__       ):
														lowerCamelCase_							  =					y[k] + step_size * ode_func(UpperCAmelCase__			,				y[k]       )
														lowerCamelCase_							  =					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()







from ..utils import DummyObject, requires_backends





class       __A(				metaclass=UpperCAmelCase       ):
					SCREAMING_SNAKE_CASE			    =    ['''torch''', '''scipy''']

					def __init__(	self					:     Any   ,					*__UpperCamelCase					:     str   ,					**__UpperCamelCase					:     Any   ):
												requires_backends(self   ,					["""torch""", """scipy"""]   )

					@classmethod
					def    lowercase__      (	cls					:     Dict   ,					*__UpperCamelCase					:     str   ,					**__UpperCamelCase					:     Dict   ):
												requires_backends(cls   ,					["""torch""", """scipy"""]   )



					@classmethod
					def    lowercase__      (	cls					:     str   ,					*__UpperCamelCase					:     Optional[int]   ,					**__UpperCamelCase					:     Optional[int]   ):
												requires_backends(cls   ,					["""torch""", """scipy"""]   )





