Student[NumericalAnalysis]
InitialValueProblem
numerically approximate the solution to a first-order initial-value problem
Calling Sequence
Parameters
Options
Description
Notes
Examples
InitialValueProblem(ODE, IC, t=b, opts)
InitialValueProblem(ODE, IC, b, opts)
ODE
-
equation; first order ordinary differential equation of the form ⅆⅆty⁡t=f⁡t,y
IC
equation; initial condition of the form y(a)=c, where a is the left endpoint of the initial-value problem
t
name; the independent variable
b
algebraic; the point for which to solve; the right endpoint of this initial-value problem
opts
(optional) equations of the form keyword=value, where keyword is one of method, submethod, numsteps, output, comparewith, digits, order, or plotoptions; options for numerically solving the initial-value problem
comparewith = [list]
A list of method-submethod pairs; the method specified in the method option will be compared graphically with these methods. This option may only be used if output is set to either plot or information.
It must be of the form
comparewith = [[method_1, submethod_1], [method_2, submethod_2]]
If either method lacks applicable submethods, the corresponding submethod_n entry should be omitted.
Lists of all supported methods and their submethods are found under the descriptions for the method and submethod options, respectively.
digits = posint
The number of digits to which the returned values will be rounded (using evalf). The default value is 4.
method = euler, taylor, rungekutta, adamsbashforth, adamsmoulton, or adamsbashforthmoulton
The method used to solve this initial-value problem.
euler = Euler's Method
taylor = Taylor's Method
rungekutta = Runge-Kutta Method
adamsbashforth = Adams-Bashforth Explicit Method
adamsmoulton = Adams-Moulton Implicit Method
adamsbashforthmoulton = Adams-Bashforth-Moulton Predictor-Corrector Method
If no method is specified, the Euler Method is used.
numsteps = posint
The number of steps used for the chosen numerical method. This option determines the static step size for each iteration in the algorithm. The default value is 5.
order = posint
The order of the Taylor approximation. This option may only be used if method = taylor is specified. The default value is 3.
output = solution, Error, plot, information
Controls what information is returned by this procedure. The default value is solution:
output = solution returns the computed value of y⁡t at t = b;
output = Error returns the absolute error of y⁡t at t = b;
output = plot returns a plot of the approximate solution and the solution from one of Maple's best numeric DE solvers; and
output = information returns an array of the values of t, Maple's numeric solution, the approximations of y⁡t as computed using this method and the absolute error between these at each iteration.
plotoptions = list
The plot options. This option is used only when output = plot is specified.
submethod = midpoint, rk3, rk4, rkf, heun, meuler, step4, step2, step3, step5
The submethod used to solve this initial-value problem.
midpoint = Midpoint Method
rk3 = Runge-Kutta 3rd Order
rk4 = Runge-Kutta 4th Order
rkf = Runge-Kutta-Fehlberg Method
heun = Heun's Method (also known as the improved Euler method)
meuler = Modified Euler Method
step2 = Two-Step Method
step3 = Three-Step Method
step4 = Four-Step Method
step5 = Five-Step Method
The following describes the possible submethods for each method. If no submethod is specified, the first item in the list is used.
euler : None (no submethods apply).
taylor : If a Taylor method is specified in the comparewith option (see above), then the order of the Taylor polynomial can be specified as a positive integer, as the second item in the list; see the Examples section.
rungekutta: midpoint, rk3, rk4, rkf, heun, and meuler.
adamsbashforth: step4, step2, step3, and step5.
adamsmoulton: step4, step2, and step3.
adamsbashforthmoulton: step4, step2, step3, and step5
Given an initial-value problem consisting of an ordinary differential equation ODE, a range a <= t <= b, and an initial condition y(a) = c, the InitialValueProblem command computes an approximate value of y(b).
If the second calling sequence is used, the independent variable t will be inferred from ODE.
The InitialValueProblem command computes its numeric solution using the specified method and submethod (if applicable). Options given in opts are also observed.
The endpoints a and b must be expressions that can be evaluated to floating-point numbers. The initial condition IC must be of the form y(a)=c, where c can be evaluated to a floating-point number.
The methods for numerically solving initial-value problems can be explored interactively with the InitialValueProblem tutor.
By their very nature, multi-step methods (such as the Adams methods) impose a minimum on the number of steps allowed. If numsteps is lower than this minimum, then the minimum will be used instead to determine the step size. In general, if k previous function values are required to perform the multi-step method, then numsteps must be at least k−1.
This procedure operates using floating-point numerics; that is, inputs are first evaluated to floating-point numbers before computations proceed, and numbers appearing in the output will be in floating-point format.
with⁡StudentNumericalAnalysis:
DE1≔diff⁡y⁡t,t=y⁡t−t2+1:
InitialValueProblem⁡DE1,y⁡0=0.5,t=3
5.066
InitialValueProblem⁡DE1,y⁡0=0.5,t=3,output=Error
0.8916
DE2≔diff⁡y⁡t,t=1−cos⁡t:
DE3≔diff⁡y⁡t,t=y⁡t−t2+t39:
the order of the Taylor polynomial used by a Taylor method in the comparewith option can be specified as the second item in the list:
InitialValueProblem⁡DE2,y⁡1=3.10,t=5,method=rungekutta,submethod=rkf,comparewith=taylor,2,output=information,digits=3
tMaple's numeric solutionR-K-FError2nd-Ord. TaylorError1.3.103.100.3.100.1.803.773.770.002383.740.032.605.035.030.004035.030.3.406.606.600.002996.680.084.208.018.010.003058.170.165.8.908.900.0003959.090.19
InitialValueProblem⁡DE2,y⁡1=3.10,t=5,method=rungekutta,submethod=rkf,comparewith=taylor,1,taylor,2,output=plot
InitialValueProblem⁡DE3,y⁡0=1,t=3,method=taylor,order=2,comparewith=taylor,3,adamsmoulton,step3,output=plot
See Also
Student[NumericalAnalysis][AdamsBashforth]
Student[NumericalAnalysis][AdamsBashforthMoulton]
Student[NumericalAnalysis][AdamsMoulton]
Student[NumericalAnalysis][Euler]
Student[NumericalAnalysis][RungeKutta]
Student[NumericalAnalysis][Taylor]
Student[NumericalAnalysis][VisualizationOverview]
Download Help Document