Initialize an object for computing DE integration.
Execute integration of func by DE formula.
Initialize an object for computing DE integration.
Return the set value
Return type of integration. The First and second charactor of the return value are explain the the starting value or end value of integration is finite value ('F') or infinity 'I'. If the return value has the third character and its value is 'E', the integration is formed as int_{xa}^{xb} f(x) exp(-x) dx
Return weights of each division points.
Return the set value
Return division points (computing points) of trapezoidal quadrature for DE formula.
1 // integration on [0, 1] 2 auto int01 = DEInt!real(0, 1); 3 assert(int01.type == "FF"); 4 5 // int_0^1 x dx = 0.5 6 assert(int01.integrate((real x) => x).approxEqual(0.5)); 7 8 // int_0^1 x^^2 dx = 1/3 9 assert(int01.integrate((real x) => x^^2).approxEqual(1/3.0)); 10 11 12 // integration on [-inf, inf] 13 auto intII = DEInt!real(-real.infinity, real.infinity); 14 assert(intII.type == "II"); 15 16 // Gaussian integral 17 assert(intII.integrate((real x) => exp(-x^^2)).approxEqual(sqrt(PI))); 18 19 import std.mathspecial; 20 // integration int_1^inf x * exp(-x) dx = Gamma(2, 1) 21 auto intFI = DEInt!real(1, real.infinity, Yes.isExpType); 22 assert(intFI.type == "FIE"); 23 24 // incomplete gamma function 25 assert(intFI.integrate((real x) => x).approxEqual(gammaIncompleteCompl(2, 1) * gamma(2)));
A struct for performing numerical integration by double-exponential (DE) formula. It is also known as "Tanh-sinh quadrature". In DE formula, the integration (1) is converted to (2). (1) int_{xa}^{xb} f(x) dx (2) int_{ta}^{tb} f(g(t)) g'(t) dt
This struct calculates reusable state in advance. The type of DE formula is automatically decided from the given interval of the integration.
Reference: