SDDS ToolKit Programs and Libraries for C and Python
All Classes Files Functions Variables Macros Pages
gy.c File Reference

Detailed Description

Implements the integral of K_{5/3}(t) multiplied by y^n from y to infinity.

This file provides the implementation of gy(), which computes: inf. GY = y^n ∫ K_{5/3}(t) dt y The integral evaluation is based on methods described by V. O. Kostroun and uses exponential and hyperbolic function evaluations. It is generally reliable up to several decimal places for a range of inputs.

License
This file is distributed under the terms of the Software License Agreement found in the file LICENSE included with this distribution.
Author
R. Dejus, H. Shang, R. Soliday, M. Borland

Definition in file gy.c.

#include "mdb.h"
#include <math.h>

Go to the source code of this file.

Functions

double gy (long n, double y)
 Compute the integral of K_{5/3}(t) scaled by y^n from y to infinity.
 

Function Documentation

◆ gy()

double gy ( long n,
double y )

Compute the integral of K_{5/3}(t) scaled by y^n from y to infinity.

This function calculates the integral: GY = y^n ∫ from t=y to t=∞ of K_{5/3}(t) dt. It uses a summation approach with an iterative increment (dt) and stops when subsequent terms are sufficiently small compared to the current sum.

Parameters
nThe exponent applied to y.
yThe lower limit of the integral.
Returns
The computed integral value GY.

Definition at line 42 of file gy.c.

42 {
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}
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