vector_derint.h File Reference

Derivatives of integrals of functions stored in vectors with implicit fixed-size grid. More...

`#include <o2scl/interp.h>`

Go to the source code of this file.

## Namespaces

o2scl
The main O2scl namespace.

## Functions

Compute the derivative at every point of a generic vector

Given a vector `v` of size `n`, these functions compute the derivative at every point and store the result in `dv`.

template<class vec_t , class vec2_t >
void o2scl::vector_deriv_threept (size_t n, vec_t &v, vec2_t &dv)
Derivative of a vector with a three-point formula.

template<class vec_t , class vec2_t >
void o2scl::vector_deriv_threept_tap (size_t n, vec_t &v, vec2_t &dv)
Derivative of a vector with a three-point formula using two-point at the edges.

template<class vec_t , class vec2_t >
void o2scl::vector_deriv_fivept (size_t n, vec_t &v, vec2_t &dv)
Derivative of a vector with a five-point formula.

template<class vec_t , class vec2_t >
void o2scl::vector_deriv_fivept_tap (size_t n, vec_t &v, vec2_t &dv)
Derivative of a vector with a five-point formula with four- and three-point formulas used at the edges.

template<class ovec_t , class vec2_t >
void o2scl::vector_deriv_interp (size_t n, ovec_t &v, vec2_t &dv, size_t interp_type=itp_cspline)
Derivative from interpolation object.

template<class vec_t , class vec2_t , class vec3_t >
void o2scl::vector_deriv_interp (size_t n, vec_t &vx, vec2_t &vy, vec3_t &dv, size_t interp_type=itp_cspline)
Derivative from interpolation object.

Compute the integral over a generic vector

These functions implement composite (sometimes called extended) Newton-Cotes rules.

Given a vector `v` of size `n`, these functions compute the integral over the entire vector and return the result.

These functions were principally based on the information at http://mathworld.wolfram.com/Newton-CotesFormulas.html .

template<class vec_t >
double o2scl::vector_integ_trap (size_t n, vec_t &v)
Integrate with an extended trapezoidal rule.

template<class vec_t >
double o2scl::vector_integ_threept (size_t n, vec_t &v)
Integrate with an extended 3-point rule (extended Simpson's rule) More...

template<class vec_t >
double o2scl::vector_integ_extended4 (size_t n, vec_t &v)
Integrate with an extended rule for 4 or more points. More...

template<class vec_t >
double o2scl::vector_integ_durand (size_t n, vec_t &v)
Integrate with Durand's rule for 4 or more points. More...

template<class vec_t >
double o2scl::vector_integ_extended8 (size_t n, vec_t &v)
Integrate with an extended rule for 8 or more points. More...

template<class ovec_t >
double o2scl::vector_integ_interp (size_t n, ovec_t &v, size_t interp_type)
Integral from interpolation object.

## Detailed Description

These functions differentiate or integrate a function over a fixed-size grid specified in a vector. Derivatives and integrals are always specified without the factor defining the grid size (i.e. ), so the user must always multiply or divide the result by the grid size afterwards as necessary.

The derivative functions will call the error handler if they are given empty vectors or vectors of length 1. The integration rules often expect a minimum number of points, so for smaller vectors they fall back onto rules which use fewer points. For empty vectors they return zero, for vectors of length 1, they always return the sole element of the vector, and for vectors of length 2, they always return the average of the two elements. If the vector length is zero, the integration functions call the error handler.

More points does not always mean higher accuracy.

Definition in file vector_derint.h.

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).