aimstil  5.0.5
til_math.h
Go to the documentation of this file.
1 #ifndef TIL_MATH_H
2 #define TIL_MATH_H
3 
4 // include from TIL library
5 #include "til/til_common.h"
6 
7 namespace til {
8 
10  namespace math {
11 
12 
14  INLINE double sinc(double x)
15  {
16  const double EPSILON = 128 * std::numeric_limits<double>::epsilon();
17  // If x is too small, return assymptotic value
18  if (fabs(x) <= EPSILON) return 1.0;
19  // formula
20  return sin(x) / x;
21  }
22 
23 
25  INLINE double dsinc(double x)
26  {
27  const double EPSILON = 128 * std::numeric_limits<double>::epsilon();
28  // If x is too small, return assymptotic value
29  if (fabs(x) <= EPSILON) return 0.0;
30  // formula
31  return cos(x) / x - sin(x) / (x*x);
32  }
33 
35  INLINE double d2sinc(double x)
36  {
37  const double EPSILON = 128 * std::numeric_limits<double>::epsilon();
38  // if x is too small, return assymptotic value
39  if (fabs(x) <= EPSILON) return -1.0 / 3.0;
40  // formula
41  return 2*sin(x)/(x*x*x) - 2*cos(x)/(x*x) - sin(x)/x;
42  }
43 
44  } // namespace math
45 } // namespace til
46 
47 #endif
48 
INLINE double sinc(double x)
sinus cardinal
Definition: til_math.h:14
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
General macros, definitions and functions.
#define INLINE
Definition: til_common.h:26
INLINE double dsinc(double x)
first derivative of sinc
Definition: til_math.h:25
INLINE double d2sinc(double x)
second derivative of sinc
Definition: til_math.h:35