Student[NumericalAnalysis]
FixedPointIteration
numerically approximate the real roots of an expression using the fixed point iteration method
Calling Sequence
Parameters
Options
Description
Notes
Examples
FixedPointIteration(f, x=a, opts)
FixedPointIteration(f, a, opts)
f
-
algebraic; expression in the variable x representing a continuous function
x
name; the independent variable of f
a
numeric; the initial approximate root
opts
(optional) equation(s) of the form keyword=value, where keyword is one of fixedpointiterator, functionoptions, lineoptions, maxiterations, output, pointoptions, showfunction, showlines, showpoints, stoppingcriterion, tickmarks, caption, tolerance, verticallineoptions, view; the options for approximating the roots of f
fixedpointiterator = algebraic (optional)
The expression on the right-hand side will be used to generate the fixed-point iteration sequence. If this option is specified, the first argument, f, must be omitted. See the Notes section for more details.
functionoptions = list
A list of options for the plot of the expression f. By default, f is plotted as a solid red line.
lineoptions = list
A list of options for the lines on the plot. By default the lines are dotted blue.
maxiterations = posint
The maximum number of iterations to perform. The default value of maxiterations depends on which type of output is chosen:
output = value: default maxiterations = 100
output = sequence: default maxiterations = 10
output = information: default maxiterations = 10
output = plot: default maxiterations = 5
output = animation: default maxiterations = 10
output = value, sequence, plot, animation, or information
The return value of the function. The default is value.
output = value returns the final numerical approximation of the root.
output = sequence returns an expression sequence pk, k=0..n that converges to the exact root for a sufficiently well-behaved function and initial approximation.
output = plot returns a plot of f with each iterative approximation shown and the relevant information about the numerical approximation displayed in the caption of the plot.
output = animation returns an animation showing the iterations of the root approximation process.
output = information returns detailed information about the iterative approximations of the root of f.
plotoptions = list
The final plot options when output = plot or output = animation.
pointoptions = list
A list of options for the points on the plot. By default, the points are plotted as green circles.
showfunction = truefalse
Whether to display f on the plot or not. By default, this option is set to true.
showlines = truefalse
Whether to display lines that accentuate each approximate iteration when output = plot. By default, this option is set to true.
showpoints = truefalse
Whether to display the points at each approximate iteration on the plot when output = plot. By default, this option is set to true.
stoppingcriterion = relative, absolute, or function_value
The criterion that the approximations must meet before discontinuing the iterations. The following describes each criterion:
relative : pn−pn−1pn < tolerance
absolute : pn−pn−1 < tolerance
function_value : f⁡pn < tolerance
By default, stoppingcriterion = relative.
tickmarks = list
The tickmarks when output = plot or output = animation. By default, tickmarks are placed at the initial and final approximations with the labels p0 (or a and b for two initial approximates) and pn, where n is the total number of iterations used to reach the final approximation. See plot/tickmarks for more detail on specifying tickmarks.
caption = string
A caption for the plot. The default caption contains general information concerning the approximation. For more information about specifying a caption, see plot/typesetting.
tolerance = positive
The error tolerance of the approximation. The default value is 110000.
verticallineoptions = list
A list of options for the vertical lines on the plot. By default, the lines are dashed and blue.
view = [realcons..realcons, realcons..realcons]
The plotview of the plot when output = plot. See plot/options for more information.
The FixedPointIteration command numerically approximates the roots of an algebraic function, f by converting the problem to a fixed-point problem.
Given an expression f and an initial approximate a, the FixedPointIteration command computes a sequence pk, k=0..n, of approximations to a root of f, where n is the number of iterations taken to reach a stopping criterion.
The first argument f may be substituted with an option of the form fixedpointiterator = fpexpr. See Notes.
The FixedPointIteration command is a shortcut for calling the Roots command with the method=fixedpointiteration option.
This procedure first converts the problem of finding a root to the equation f⁡x=0 to a problem of finding a fixed point for the function g⁡x, where g⁡x=x−f⁡x and f⁡x is specified by f and x.
The user can specify a custom iterator function g⁡x by omitting the first argument f and supplying the fixedpointiterator = g option. The right-hand side expression g specifies a function g⁡x, and this procedure will aim to find a root to f⁡x = x−g⁡x=0 by way of solving the fixed-point problem g⁡x=x.
When output = plot or output = animation is specified, both the function f⁡x and the fixed-point iterator function g⁡x will be plotted and correspondingly labelled.
The tolerance option, when stoppingcriterion = function_value, applies to the function f⁡x in the root-finding form of the problem.
with⁡StudentNumericalAnalysis:
f≔x−cos⁡x:
FixedPointIteration⁡f,x=1.0,tolerance=10−2
0.7414250866
FixedPointIteration⁡f,x=1.0,tolerance=10−2,output=sequence,maxiterations=20
1.0,0.5403023059,0.8575532158,0.6542897905,0.7934803587,0.7013687737,0.7639596829,0.7221024250,0.7504177618,0.7314040424,0.7442373549,0.7356047404,0.7414250866
FixedPointIteration⁡f,x=1.0,tolerance=10−2,output=plot,stoppingcriterion=function_value,maxiterations=20
FixedPointIteration⁡f,x=1.0,tolerance=10−3,output=animation,stoppingcriterion=absolute,maxiterations=20
To find a root of f⁡x=x2−2⁢x−3 using the fixed-point iterator function g⁡x=2⁢x+3, use the fixedpointiterator = g option.
g≔2⁢x+312:
FixedPointIteration⁡fixedpointiterator=g,x=4.0,tolerance=10−2
3.011440019
FixedPointIteration⁡fixedpointiterator=g,x=4.0,tolerance=10−2,output=sequence
4.0,3.316624790,3.103747667,3.034385495,3.011440019
FixedPointIteration⁡fixedpointiterator=g,x=4.0,output=plot,stoppingcriterion=function_value,maxiterations=10
FixedPointIteration⁡fixedpointiterator=g,x=4.0,output=animation,stoppingcriterion=absolute
See Also
Student[NumericalAnalysis][Roots]
Student[NumericalAnalysis][VisualizationOverview]
Download Help Document