tintegrator.h - numeric - C++ library with numerical algorithms | |
git clone git://src.adamsgaard.dk/numeric | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
tintegrator.h (1555B) | |
--- | |
1 #ifndef INTEGRATOR_H_ | |
2 #define INTEGRATOR_H_ | |
3 | |
4 #include <string> | |
5 #include "header.h" | |
6 | |
7 class Integral { | |
8 | |
9 private: | |
10 | |
11 // Input function (maybe to be transformed) | |
12 Floattype (*f_in)(const Floattype); | |
13 | |
14 // Function to be evaluated (pointer to function) | |
15 Floattype (*f)(const Floattype); | |
16 | |
17 // Integral limits | |
18 Floattype low; // Lower | |
19 Floattype high; // Upper | |
20 | |
21 // Accuracy requirement values | |
22 const Floattype acc_pres; // Absolute | |
23 const Floattype eps; // Relative | |
24 | |
25 // Number of recursions | |
26 Lengthtype nrec; | |
27 | |
28 // Adaptive integrator function to be | |
29 // called recursively | |
30 Floattype adapt(const Floattype a, | |
31 const Floattype b, | |
32 const Floattype acc, | |
33 const Floattype f2, | |
34 const Floattype f3); | |
35 | |
36 // Result of integral | |
37 Floattype res; | |
38 | |
39 // Size of error | |
40 Floattype err; | |
41 | |
42 // Functions for variable transformations | |
43 // when one or both limits are infinite | |
44 Floattype infinf(const Floattype t); // a=inf | |
45 Floattype fininf(const Floattype t); // b=inf | |
46 Floattype inffin(const Floattype t); // a=inf,b=inf | |
47 | |
48 | |
49 public: | |
50 | |
51 // Constructor | |
52 Integral(Floattype (*function)(const Floattype), | |
53 const Floattype lower_limit, | |
54 const Floattype upper_limit, | |
55 const Floattype absolute_accuracy, | |
56 const Floattype relative_accuracy); | |
57 | |
58 // Return value of result | |
59 Floattype result(); | |
60 | |
61 // Return number of recursions taken | |
62 Lengthtype recursions(); | |
63 | |
64 // Print results and statistics | |
65 void show(const std::string function_description); | |
66 }; | |
67 | |
68 #endif |