5 #include <gsl/gsl_integration.h> 30 : _gslFunction{
nullptr,
nullptr }
35 _gslFunction.function = [](
double x,
void *params) {
38 FN *_obj =
static_cast<FN *
>(params);
44 _gslFunction.params =
static_cast<void *
>(&fn);
55 sout <<
"result = " <<
result() <<
"\n";
56 sout <<
"exact result = " << expected <<
"\n";
57 sout <<
"estimated error= " <<
error() <<
"\n";
58 sout <<
"actual error = " << abs(
result() - expected) <<
"\n";
59 sout <<
"intervals = " <<
intervals() <<
"\n";
78 inline size_t intervals()
const {
return _workspace->size; }
98 _workspace = gsl_integration_workspace_alloc(size);
132 inline auto qng(
double xmin,
double xmax,
double epsabs = 1e-9,
double epsrel = 1e-9) {
139 return std::make_pair(
_errorCode, nofFunEvals);
152 inline int qag(
double xmin,
double xmax,
int key,
double epsabs = 1e-9,
double epsrel = 1e-9) {
171 inline int qags(
double xmin,
double xmax,
double epsabs = 1e-9,
double epsrel = 1e-9) {
187 inline int qagi(
double epsabs = 1e-9,
double epsrel = 1e-9) {
204 inline int qagiu(
double xmin,
double epsabs = 0,
double epsrel = 1e-9) {
222 inline int qagil(
double xmax,
double epsabs = 1e-9,
double epsrel = 1e-9) {
241 size_t _nFunctionEvals;
251 _workspace = gsl_integration_cquad_workspace_alloc(dim);
261 gsl_integration_cquad_workspace_free(
_workspace);
274 int apply(
double xmin,
double xmax,
double epsabs = 1e-9,
double epsrel = 1e-9) {
279 &
_error, &_nFunctionEvals);
int qagiu(double xmin, double epsabs=0, double epsrel=1e-9)
qagiu numerische Integration mit automatischer Schrittweitenanpassung von xmin bis + Unendlich ...
int qagil(double xmax, double epsabs=1e-9, double epsrel=1e-9)
qagil numerische Integration mit automatischer Schrittweitenanpassung von - Unendlich bis xmax ...
The BaseIntegral class Basisklasse zur numerischen Integration.
CQUADIntegral(FN &fn, size_t dim=100)
CQUADIntegral Konstruktor.
The CQUADIntegral class adaptive numerische Integration geeignet für Integranden mit Singularitäten o...
auto qng(double xmin, double xmax, double epsabs=1e-9, double epsrel=1e-9)
qng Integration von stetigen Funktionen keine automatische Schrittweitenanpassung ...
Integral(FN &fn, size_t size=1000)
Integral Konstruktor.
double error() const
error
static void error_if_not(const std::string &s, bool arg)
error_if_not Fehler wenn Bedingung nicht erfüllt ist
gsl_function _gslFunction
int qags(double xmin, double xmax, double epsabs=1e-9, double epsrel=1e-9)
qags numerische Integration mit automatischer Schrittweitenanpassung von singulären Funktionen ...
void show_results(std::ofstream &sout, double expected)
show_results einfache Ausgabe des Ergebnisses mit Zusatzinformationen
BaseIntegral(FN &fn)
BaseIntegral Konstruktor.
The Integral class erste Varianten der gsl-Klasse zur numerischen Integration. Der Template-Parameter...
int apply(double xmin, double xmax, double epsabs=1e-9, double epsrel=1e-9)
apply Ausführung der numerischen Integration
int qagi(double epsabs=1e-9, double epsrel=1e-9)
qagi numerische Integration mit automatischer Schrittweitenanpassung von - Unendlich bis + Unendlich ...
int qag(double xmin, double xmax, int key, double epsabs=1e-9, double epsrel=1e-9)
qag numerische Integration mit automatischer Schrittweitenanpassung (Gauß-Kronrod) ...
double result() const
result
size_t intervals() const
intervals