RungeKutta

(Source code, png, hires.png, pdf)

../../_images/openturns-RungeKutta-1.png
class RungeKutta(*args)

Runge-Kutta fourth-order method.

Parameters
transitionFunctionFunction

The function defining the flow of the ordinary differential equation. Must have one parameter.

See also

ODESolver

Examples

>>> import openturns as ot
>>> f = ot.SymbolicFunction(['t', 'y0', 'y1'], ['t - y0', 'y1 + t^2'])
>>> phi = ot.ParametricFunction(f, [0], [0.0])
>>> solver = ot.RungeKutta(phi)
>>> Y0 = [1.0, -1.0]
>>> nt = 100
>>> timeGrid = [(i**2.0) / (nt - 1.0)**2.0 for i in range(nt)]
>>> result = solver.solve(Y0, timeGrid)

Methods

getClassName(self)

Accessor to the object’s name.

getId(self)

Accessor to the object’s id.

getName(self)

Accessor to the object’s name.

getShadowedId(self)

Accessor to the object’s shadowed id.

getTransitionFunction(self)

Transition function accessor.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

setName(self, name)

Accessor to the object’s name.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setTransitionFunction(self, transitionFunction)

Transition function accessor.

setVisibility(self, visible)

Accessor to the object’s visibility state.

solve(self, \*args)

Solve ODE.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getTransitionFunction(self)

Transition function accessor.

Returns
transitionFunctionFieldFunction

Transition function.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

True if the name is not empty and not the default one.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setTransitionFunction(self, transitionFunction)

Transition function accessor.

Parameters
transitionFunctionFieldFunction

Transition function.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.

solve(self, \*args)

Solve ODE.

Parameters
initialStatesequence of float

Initial value of the equation

timeGridsequence of float or Mesh of dimension 1

Time stamps, ie values of t at which the solution is computed.

Returns
valuesSample

The solution of the equation at grid points.