gsl_chebapp Class Reference

Chebyshev approximation (GSL). More...

#include <gsl_chebapp.h>


Detailed Description

Chebyshev approximation (GSL).

Approximate a function on a finite interval using a Chebyshev series:

\[ f(x) = \sum_n c_n T_n(x) \qquad \mathrm{where} \qquad T_n(x)=\cos(n \arccos x) \]

Definition at line 44 of file gsl_chebapp.h.


Public Member Functions

 gsl_chebapp (const gsl_chebapp &gc)
 Copy constructor.
gsl_chebappoperator= (const gsl_chebapp &gc)
 Copy constructor.
template<class param_t , class func_t >
int init (func_t &func, size_t ord, double a1, double b1, param_t &vp)
 Initialize a Chebyshev approximation of the function func over the interval from a1 to b1.
template<class vec_t >
int init (double a1, double b1, size_t ord, vec_t &v)
 Create an approximation from a vector of coefficients.
template<class vec_t >
int init_func_values (double a1, double b1, size_t ord, vec_t &fval)
 Create an approximation from a vector of function values.
double eval (double x) const
 Evaluate the approximation.
double eval_n (size_t n, double x) const
 Evaluate the approximation to a specified order.
int eval_err (double x, double &result, double &abserr)
 Evaluate the approximation and give the uncertainty.
int eval_n_err (size_t n, double x, double &result, double &abserr)
 Evaluate the approximation to a specified order and give the uncertainty.
double get_coefficient (size_t ix) const
 Get a coefficient.
int set_coefficient (size_t ix, double co)
 Set a coefficient.
int get_endpoints (double &la, double &lb)
 Return the endpoints of the approximation.
template<class vec_t >
int get_coefficients (size_t n, vec_t &v) const
 Get the coefficients.
template<class vec_t >
int set_coefficients (size_t n, vec_t &v)
 Set the coefficients.
int deriv (gsl_chebapp &gc) const
 Make gc an approximation to the derivative.
int integ (gsl_chebapp &gc) const
 Make gc an approximation to the integral.

Protected Attributes

uvector c
 Coefficients.
size_t order
 Order of the approximation.
double a
 Lower end of the interval.
double b
 Upper end of the interval.
size_t order_sp
 Single precision order.
uvector f
 Function evaluated at Chebyshev points.
bool init_called
 True if init has been called.

Member Function Documentation

double get_coefficient ( size_t  ix  )  const [inline]

Get a coefficient.

Legal values of the argument are 0 to order (inclusive)

Definition at line 310 of file gsl_chebapp.h.

int init ( func_t &  func,
size_t  ord,
double  a1,
double  b1,
param_t &  vp 
) [inline]

Initialize a Chebyshev approximation of the function func over the interval from a1 to b1.

The interval must be specified so that $ a < b $ , so a and b are swapped if this is not the case.

Definition at line 105 of file gsl_chebapp.h.

int set_coefficient ( size_t  ix,
double  co 
) [inline]

Set a coefficient.

Legal values of the argument are 0 to order (inclusive)

Definition at line 325 of file gsl_chebapp.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page