Student[NumericalAnalysis] - Maple Programming Help

Home : Support : Online Help : Education : Student Packages : Numerical Analysis : Visualization : Student/NumericalAnalysis/FalsePosition

Student[NumericalAnalysis]

 FalsePosition
 numerically approximate the real roots of an expression using the method of false position

 Calling Sequence FalsePosition(f, x=[a, b], opts) FalsePosition(f, [a, b], opts)

Parameters

 f - algebraic; expression in the variable x representing a continuous function x - name; the independent variable of f a - numeric; one of two initial approximates to the root b - numeric; the other of the two initial approximates to the root opts - (optional) equation(s) of the form keyword=value, where keyword is one of functionoptions, lineoptions, maxiterations, output, pointoptions, showfunction, showlines, showpoints, showverticallines, stoppingcriterion, tickmarks, caption, tolerance, verticallineoptions, view; the options for approximating the roots of f

Options

 • 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 solid blue.
 • maxiterations = posint
 The maximum number of iterations to to perform when numerically approximating a root of f. 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, 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, ${p}_{k}$, $k$=$0..n$, where the first $n-1$ elements are the subintervals that contain an approximation and the $\mathrm{nth}$ element is the final approximate root.
 – 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 of the numerical approximation on the plot of f.
 – output=information returns detailed information about the iterative approximations of the root of f.
 • pointoptions = list
 A list of options for the points on the plot. By default, the points are plotted as green circles.
 • showfunction = true or false
 Whether to display f on the plot or not.  By default, this option is set to true.
 • showlines = true or false
 Whether to display lines that accentuate each approximate iteration when output=plot. By default, this option is set to true. To control the vertical lines, see the showverticallines and verticallineoptions options.
 • showpoints = true or false
 Whether to display the points at each approximate iteration on the plot when output=plot. By default, this option is set to true.
 • showverticallines = true or false
 Whether to display the vertical lines at each iterative approximation on the plot when output=plot. By default, this option is set to true.
 • stoppingcriterion = relative, absolute, function_value
 The criterion that the approximation must meet before discontinuing the iterations. The following describes each criterion:
 – relative : $\frac{\left|{p}_{n}-{p}_{n-1}\right|}{\left|{p}_{n}\right|}$ < tolerance
 – absolute : $\left|{p}_{n}-{p}_{n-1}\right|$ < tolerance
 – function_value : $\left|f\left({p}_{n}\right)\right|$ < 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 a and b for the two initial approximates and the label ${p}_{n}$ for the final approximation, where $n$ is the total number of iterations used to reach the final approximation.  If the stopping criterion is not met, no tickmark will be placed on the last 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 $\frac{1}{10000}$.
 • 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 plot view of the plot when output = plot.  See plot/options for more information.

Description

 • The FalsePosition command numerically approximates the roots of an algebraic function, f, using a technique similar to the Secant method, but bracketing is incorporated.
 • Given an expression f and an initial approximate a, the FalsePosition command computes a sequence ${p}_{k}$, $k$=$0..n$, of approximations to a root of f, where $n$ is the number of iterations taken to reach a stopping criterion.
 • The FalsePosition command is a shortcut for calling the Roots command with the method=falseposition option.

Examples

 > $\mathrm{with}\left({\mathrm{Student}}_{\mathrm{NumericalAnalysis}}\right):$
 > $f≔{x}^{3}-7{x}^{2}+14x-6:$
 > $\mathrm{FalsePosition}\left(f,x=\left[2.7,3.2\right],\mathrm{tolerance}={10}^{-2}\right)$
 ${3.014898139}$ (1)
 > $\mathrm{FalsePosition}\left(f,x=\left[2.7,3.2\right],\mathrm{tolerance}={10}^{-2},\mathrm{output}=\mathrm{sequence}\right)$
 $\left[{2.7}{,}{3.2}\right]{,}\left[{2.7}{,}{3.100884956}\right]{,}\left[{2.7}{,}{3.041032849}\right]{,}{3.014898139}$ (2)
 > $\mathrm{FalsePosition}\left(f,x=\left[2.7,3.2\right],\mathrm{tolerance}={10}^{-2},\mathrm{stoppingcriterion}=\mathrm{absolute}\right)$
 ${3.005163289}$ (3)

To play the following animation in this help page, right-click (Control-click, on Macintosh) the plot to display the context menu.  Select Animation > Play.

 > $\mathrm{FalsePosition}\left(f,x=\left[3.2,4.0\right],\mathrm{output}=\mathrm{animation},\mathrm{tolerance}={10}^{-2},\mathrm{stoppingcriterion}=\mathrm{function_value}\right)$ > $\mathrm{FalsePosition}\left(f,x=\left[2.9,3.1\right],\mathrm{output}=\mathrm{plot}\right)$ 