desolve_rk4( equation
, variable
, ics=[initial_conditions]
[ , options
] )
The numerical solution in SageMath of the first-order differential equation
for dependent variable
. The argument equation
can be either the right-hand side of an equation or a complete symbolic equation. The dependent variable must be declared as a function
of the independent variable for a symbolic equation.
Equations in SageMath need to be defined with double equal (==
) signs to avoid syntax errors.
Initial conditions are given for the independent variable and the dependent variable, in that order.
Available options are:
ivar=independent_variable end_points=value|[values] step=value output='list'|'plot'|'slope_field'
The independent variable must be specified if the equation contains more than one independent variable or if the independent variable does not appear explicitly.
Examples:
y = function('y')(x) desolve_rk4( diff(y,x) == x, y, ics=[0,1] )
var('y') desolve_rk4( x, y, ics=[0,1] )
var('y') desolve_rk4( x, y, ics=[0,1], output='plot' )
Related operations: desolve
Operation category: solution operations sagemath-docs