pathsim.solvers.euler module

class pathsim.solvers.euler.EUF(*solver_args, **solver_kwargs)[source]

Bases: ExplicitSolver

Explicit Forward Euler (FE) integration method.

This is the simplest explicit numerical integration method. It is first-order accurate (\(O(h)\)) and generally not suitable for stiff problems due to its limited stability region.

Method:

\[x_{n+1} = x_n + dt \cdot f(x_n, t_n)\]

Characteristics:

  • Order: 1

  • Stages: 1

  • Explicit

  • Fixed timestep only

  • Not A-stable

  • Low accuracy and stability, but computationally very cheap.

Note

Use this only if the function to integrate is super smooth or multistep/multistage methods cant be used.

step(f, dt)[source]

performs the explicit forward timestep for (t+dt) based on the state and input at (t)

Parameters:
  • f (array_like) – evaluation of function

  • dt (float) – integration timestep

Returns:

  • success (bool) – timestep was successful

  • err (float) – truncation error estimate

  • scale (float) – timestep rescale from error controller

class pathsim.solvers.euler.EUB(*solver_args, **solver_kwargs)[source]

Bases: ImplicitSolver

Implicit Backward Euler (BE) integration method.

This is the simplest implicit numerical integration method. It is first-order accurate (\(O(h)\)) and is A-stable and L-stable, making it suitable for very stiff problems where stability is paramount, although its low order limits accuracy for non-stiff problems or when high precision is required.

Method:

\[x_{n+1} = x_n + dt \cdot f(x_{n+1}, t_{n+1})\]

This implicit equation is solved iteratively using the internal optimizer.

Characteristics:

  • Order: 1

  • Stages: 1 (Implicit)

  • Implicit

  • Fixed timestep only

  • A-stable, L-stable

  • Very stable, suitable for stiff problems, but low accuracy.

solve(f, J, dt)[source]

Solves the implicit update equation using the internal optimizer.

Parameters:
  • f (array_like) – evaluation of function

  • J (array_like) – evaluation of jacobian of function

  • dt (float) – integration timestep

Returns:

err – residual error of the fixed point update equation

Return type:

float