Newton's Method - Maple Help

Student[Calculus1]

 NewtonsMethod
 demonstrate Newton's method

 Calling Sequence NewtonsMethod(f(x), x = a, opts)

Parameters

 f(x) - algebraic expression in variable 'x' x - name; specify the independent variable a - algebraic expression, assumed to be real; specify initial point opts - equation(s) of the form option=value where option is one of functionoptions, iterations, output, pointoptions, showfunction, showpoints, showroot, showtangents, showverticallines, tangentoptions, verticallineoptions, or Student plot options; specify output options

Description

 • The NewtonsMethod(f(x), x=a) command returns the result of applying 5 iterations of Newton's method for approximating a root.  This method is also known as the Newton-Raphson method. By using options, you can specify that the command returns a plot, animation, or sequence of iterations instead.
 • If the independent variable can be uniquely determined from the expression, the parameter x need not be included in the calling sequence.
 • Given an initial approximation a of a root (a zero) of an expression expr, Newton's method attempts to improve the approximation by finding the x-intercept b of the line tangent to the expression that passes through the point $\left(a,f\left(a\right)\right)$:

$b={x}_{i}-\frac{f\left({x}_{i}\right)}{\mathrm{f\text{'}}\left({x}_{i}\right)}$

 In general, by repeating this process, you obtain a better approximation.
 • The opts argument can contain any of the Student plot options or any of the following equations that (excluding output) set plot options.
 functionoptions = list
 A list of options for the plot of the expression $f\left(x\right)$.  By default, the expression is plotted as a solid red line. For more information on plot options, see plot/options.
 iterations = posint
 The number of times that Newton's method is applied iteratively to a.  If a root is found, the routine may perform fewer than this number of iterations.
 output = value, sequence, plot, or animation
 This option controls the return value of the function.
 – output = value specifies that the approximation after $5$ iterations of Newton's method is returned.  Plotting options are ignored if output = value. This is the default.
 – output = sequence specifies that a sequence of iterations of Newton's method is returned. Plotting options are ignored if output = sequence.
 – output = plot specifies that a plot, which shows the expression and the Newton iterations from the initial point a, connecting these points with lines to show the progression, is returned.
 – output = animation specifies that an animation demonstrating successive iterations of Newton's method is returned.
 pointoptions = list
 A list of options for the plot of the Newton iterates and the expression evaluated at these points. By default, these points are plotted as circles. For more information on plot options, see plot/options.
 showfunction = true or false
 Whether the expression $f\left(x\right)$ is plotted.  By default, the value is true.
 showpoints = true or false
 Whether the Newton iterates and the expression evaluated at these points are marked.  By default, the value is true.
 showroot = true or false
 If this option is set to true, the last approximation is given to fsolve as an initial point, and if fsolve finds a root, it is plotted as a box. By default, the value is false.
 showtangents = true or false
 Whether the tangent lines of the expression evaluated at the Newton iterates is plotted. By default, the value is true.
 showverticallines = true or false
 Whether the lines from the Newton iterates and the expression evaluated at these points are plotted. By default, the value is true.
 tangentoptions = list
 A list of options for the plot of the tangents where the expression is evaluated at the Newton iterates. By default, these are plotted as solid blue lines. For more information on plot options, see plot/options.
 verticallineoptions = list
 A list of options for the plot of the vertical lines connecting the Newton iterates and the expression evaluated at these points. By default, these are plotted as dashed blue lines. For more information on plot options, see plot/options.
 caption = anything
 A caption for the plot.
 The default caption is constructed from the parameters and the command options. caption = "" disables the default caption. For more information about specifying a caption, see plot/typesetting.
 title = anything
 A title for the plot.
 The default title is constructed from the parameters and the command options. title = "" disables the default title. For more information about specifying a title, see plot/typesetting.

Examples

 > $\mathrm{with}\left(\mathrm{Student}\left[\mathrm{Calculus1}\right]\right):$
 > $\mathrm{NewtonsMethod}\left(\mathrm{sin}\left(x\right)+1,x=1\right)$
 ${-1.619017361}$ (1)
 > $\mathrm{NewtonsMethod}\left(\mathrm{sin}\left(x\right)+1,x=2,\mathrm{output}=\mathrm{sequence}\right)$
 ${2}{,}{6.588037826}{,}{5.225039135}{,}{4.962948756}{,}{4.837009302}{,}{4.774618375}$ (2)
 > $\mathrm{NewtonsMethod}\left({x}^{3}-x,x=-0.432,\mathrm{view}=\left[-2..1,\mathrm{DEFAULT}\right],\mathrm{output}=\mathrm{plot}\right)$
 > $\mathrm{NewtonsMethod}\left({x}^{3}-x,x=2,\mathrm{view}=\left[0..3,\mathrm{DEFAULT}\right],\mathrm{output}=\mathrm{plot}\right)$

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{NewtonsMethod}\left(x\mathrm{sin}\left(x\right),x=1,\mathrm{output}=\mathrm{animation}\right)$

The command to create the plot from the Plotting Guide is

 > $\mathrm{NewtonsMethod}\left({x}^{2}+x+1,x=2,\mathrm{output}=\mathrm{plot}\right)$