API Reference

Here you will find all the details to Python implementation.

class sde.sde_class.sde_class(T: float, N: int, M: int)[source]

Bases: object

euler_maruyama(mu_fun: Callable, sigma_fun: Callable, x0: float = 0, R: int = 1) ndarray[source]

Euler Maruyama method

Parameters:
  • mu_fun (Callable) – A drift function of x

  • sigma_fun (Callable) – A diffusion function of x

  • x0 (float, optional) – The initial value, by default 0

  • R (int, optional) – The time steps, by default 1

Returns:

An array of simulated sde values

Return type:

np.ndarray

integrate(fun: Callable, integral_type: str = 'Ito') ndarray[source]

Stochastic integration

Parameters:
  • fun (Callable) – A function of time and BMs

  • integral_type (str, optional) – The type of stochastic integration to perform Can be “Ito” or “Stratonovich”, by default “Ito”.

Returns:

An array of computed integral results

Return type:

np.ndarray

Raises:

NotImplementedError – If type not of Ito or Stratonovich, the algorithm is not implemented

milstein(mu_fun: Callable, sigma_fun: Callable, d_sigma_fun: Callable, x0: float = 0, R: int = 1) ndarray[source]

Milstein’s higher order method

Parameters:
  • mu_fun (Callable) – A drift function of x

  • sigma_fun (Callable) – A diffusion function of x

  • d_sigma_fun (Callable) – The derivative of the diffusion function of x

  • x0 (float, optional) – The initial value, by default 0

  • R (int, optional) – The time steps, by default 1

Returns:

An array of simulated sde values

Return type:

np.ndarray

transform_W(fun: Callable, W: Optional[ndarray] = None) ndarray[source]

Apply transformation to BMs

Parameters:
  • fun (Callable) – A funtion of time and brownian motions

  • W (Optional[np.ndarray], optional) – If None, we will use the stored BMs Ohterwise, we will apply the transformation to the user supplied arrays

Returns:

An array of transformed BMs

Return type:

np.ndarray