SDDSlib
Loading...
Searching...
No Matches
SDDS
mdbmth
gy.c
Go to the documentation of this file.
1
/**
2
* @file gy.c
3
* @brief Implements the integral of K_{5/3}(t) multiplied by y^n from y to infinity.
4
*
5
* This file provides the implementation of gy(), which computes:
6
* inf.
7
* GY = y^n ∫ K_{5/3}(t) dt
8
* y
9
* The integral evaluation is based on methods described by V. O. Kostroun and uses
10
* exponential and hyperbolic function evaluations. It is generally reliable up to
11
* several decimal places for a range of inputs.
12
*
13
* @copyright
14
* - (c) 2002 The University of Chicago, as Operator of Argonne National Laboratory.
15
* - (c) 2002 The Regents of the University of California, as Operator of Los Alamos National Laboratory.
16
*
17
* @license
18
* This file is distributed under the terms of the Software License Agreement
19
* found in the file LICENSE included with this distribution.
20
*
21
* @author R. Dejus, H. Shang, R. Soliday, M. Borland
22
*/
23
24
#include "mdb.h"
25
#include <math.h>
26
#undef EPS
27
#define EPS 1.0e-8
28
#define NY 5.0 / 3.0
29
30
/**
31
* @brief Compute the integral of K_{5/3}(t) scaled by y^n from y to infinity.
32
*
33
* This function calculates the integral:
34
* GY = y^n ∫ from t=y to t=∞ of K_{5/3}(t) dt.
35
* It uses a summation approach with an iterative increment (dt) and stops when
36
* subsequent terms are sufficiently small compared to the current sum.
37
*
38
* @param n The exponent applied to y.
39
* @param y The lower limit of the integral.
40
* @return The computed integral value GY.
41
*/
42
double
gy
(
long
n,
double
y) {
43
double
p, sum, term, dt,
gy
;
44
45
p = 1.0;
46
sum = 0.0;
47
dt = 0.1;
48
term = exp(-y * cosh(p * dt)) * cosh(NY * p * dt) / cosh(p * dt);
49
while
(term > EPS * sum) {
50
sum += term;
51
p = p + 1;
52
term = exp(-y * cosh(p * dt)) * cosh(NY * p * dt) / cosh(p * dt);
53
}
54
gy
= pow(y, n) * dt * (sum + 0.5 * exp(-y));
55
return
gy
;
56
}
gy
double gy(long n, double y)
Compute the integral of K_{5/3}(t) scaled by y^n from y to infinity.
Definition
gy.c:42
Generated by
1.12.0