|
GeographicLib 2.7
|
A function defined by its derivative and its inverse. More...
#include <GeographicLib/Trigfun.hpp>
Public Member Functions | |
| TrigfunExt () | |
| TrigfunExt (const std::function< real(real)> &fp, real halfp, bool sym=false, real scale=-1) | |
| real | operator() (real x) const |
| real | deriv (real x) const |
| real | inv (real z) const |
| void | ComputeInverse () |
| bool | Symmetric () const |
| int | NCoeffs () const |
| int | NCoeffsInv () const |
| real | Max () const |
| real | HalfPeriod () const |
| real | HalfRange () const |
| real | Slope () const |
A function defined by its derivative and its inverse.
This is an extension of Trigfun which allows a function to be defined by its derivative. In this case the derivative must be even, so that its integral is odd (and taken to be zero at the origin).
In addition, this class offers a flexible interface to computing the inverse of the function. If the inverse is only required at a few points
Example of use:
Definition at line 498 of file Trigfun.hpp.
|
inline |
Definition at line 532 of file Trigfun.hpp.
| GeographicLib::TrigfunExt::TrigfunExt | ( | const std::function< real(real)> & | fp, |
| real | halfp, | ||
| bool | sym = false, |
||
| real | scale = -1 |
||
| ) |
Constructor specifying the derivative, an even periodic function
| [in] | fp | the derivative function, fp(x) = f'(x). |
| [in] | halfp | the half period. |
| [in] | sym | is fp symmetric about the quarter period point (so it contains only odd Fourier harmonics)? |
| [in] | scale; | this is passed to the Trigfun constructor when finding the Fourier series for fp. |
|
inline |
Evaluate the TrigfunExt.
| [in] | x | the function argument. |
Definition at line 556 of file Trigfun.hpp.
|
inline |
Evaluate the derivative for TrigfunExt.
| [in] | x | the function argument. |
Definition at line 564 of file Trigfun.hpp.
|
inline |
Evaluate the inverse of f
| [in] | z | the value of f(x) |
This compute the inverse using Newton's method with the derivative function fp supplied on construction. Initially, the starting guess is based on just the secular component of f(x). However, if ComputeInverse() is called, a rough Trigfun approximation to the inverse is found and this is used as the starting point for Newton's method.
Definition at line 577 of file Trigfun.hpp.
|
inline |
Compute a coarse Fourier series approximation of the inverse.
This is used to provide a better starting guess for Newton's method in inv(). Because ComputeInverse() is fairly expensive, this only makes sense if inv() will be called many times. In order to limit the expense in computing this approximate inverse, the number of Fourier components in the Trigfun for the inverse is limited to 3/2 of the number of components for f and the tolerance is set to the square root of the machine epsilon.
Definition at line 591 of file Trigfun.hpp.
|
inline |
Definition at line 602 of file Trigfun.hpp.
|
inline |
Definition at line 606 of file Trigfun.hpp.
References GeographicLib::Trigfun::NCoeffs().
|
inline |
Definition at line 611 of file Trigfun.hpp.
References GeographicLib::Trigfun::NCoeffs().
|
inline |
Definition at line 617 of file Trigfun.hpp.
References GeographicLib::Trigfun::Max().
|
inline |
Definition at line 621 of file Trigfun.hpp.
References GeographicLib::Trigfun::HalfPeriod().
|
inline |
Definition at line 625 of file Trigfun.hpp.
References GeographicLib::Trigfun::HalfRange().
|
inline |
Definition at line 629 of file Trigfun.hpp.
References GeographicLib::Trigfun::Slope().