![]() |
Object-oriented Scientific Computing Library: Version 0.910
|
Steffenson equation solver (GSL) More...
#include <gsl_root_stef.h>
This is Newton's method with an Aitken "delta-squared" acceleration of the iterates. This can improve the convergence on multiple roots where the ordinary Newton algorithm is slow.
Defining the next iteration with
the accelerated value is
We can only use the accelerated estimate after three iterations, and use the unaccelerated value until then.
This class finds a root of a function a derivative. If the derivative is not analytically specified, it is most likely preferable to use of the alternatives, gsl_root_brent, cern_root, or cern_mroot_root. The function solve_de() performs the solution automatically, and a lower-level GSL-like interface with set() and iterate() is also provided.
By default, this solver compares the present value of the root ( ) to the previous value (
), and returns success if
, where
.
If test_residual is set to true, then the solver additionally requires that the absolute value of the function is less than root::tol_rel.
The original variable x_2
has been removed as it was unused in the original GSL code.
Definition at line 104 of file gsl_root_stef.h.
Public Member Functions | |
virtual const char * | type () |
Return the type, "gsl_root_stef" . | |
int | iterate () |
Perform an iteration. | |
virtual int | solve_de (double &xx, func_t &fun, dfunc_t &dfun) |
Solve func using x as an initial guess using derivatives df . | |
int | set (func_t &fun, dfunc_t &dfun, double guess) |
Set the information for the solver. | |
Data Fields | |
double | root |
The present solution estimate. | |
double | tolf2 |
The relative tolerance for subsequent solutions (default ![]() | |
bool | test_residual |
True if we should test the residual also (default false) | |
Protected Attributes | |
double | f |
Function value. | |
double | df |
Derivative value. | |
double | x_1 |
Previous value of root. | |
double | x |
Root. | |
int | count |
Number of iterations. | |
func_t * | fp |
The function to solve. | |
dfunc_t * | dfp |
The derivative. |
int gsl_root_stef< func_t, dfunc_t >::iterate | ( | ) | [inline] |
After a successful iteration, root contains the most recent value of the root.
Definition at line 158 of file gsl_root_stef.h.
int gsl_root_stef< func_t, dfunc_t >::set | ( | func_t & | fun, |
dfunc_t & | dfun, | ||
double | guess | ||
) | [inline] |
Set the function, the derivative, the initial guess and the parameters.
Definition at line 277 of file gsl_root_stef.h.
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).