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 :
|
|
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.
|
|
A list of options for the plot of the expression . By default, the expression is plotted as a solid red line. For more information on plot options, see plot/options.
|
|
The number of times that Newton's method is applied iteratively to . 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 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.
|
|
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 blue circles. For more information on plot options, see plot/options.
|
|
showfunction = true or false
|
|
Whether the expression 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.
|
|
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 magenta 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.
|
|
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.
|
|
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.
|
|
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
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
>
|
|
>
|
|
The command to create the plot from the Plotting Guide is
>
|
|
|
|