Beispiel #1
0
        /// <summary>
        /// Returns the exponentially scaled modified Bessel function
        /// of order 0 of the argument.
        /// <p>
        /// The function is defined as <tt>i0e(x) = exp(-|x|) j0( ix )</tt>.
        /// </summary>
        /// <param name="x">the value to compute the bessel function of.</param>
        /// <returns></returns>
        static public double i0e(double x)
        {
            double y;

            if (x < 0)
            {
                x = -x;
            }
            if (x <= 8.0)
            {
                y = (x / 2.0) - 2.0;
                return(Arithmetic.Chbevl(y, A_i0, 30));
            }

            return(Arithmetic.Chbevl(32.0 / x - 2.0, B_i0, 25) / System.Math.Sqrt(x));
        }
Beispiel #2
0
        /// <summary>
        /// Returns the exponentially scaled modified Bessel function
        /// of the third kind of order 1 of the argument.
        /// <p>
        /// <tt>k1e(x) = exp(x) * k1(x)</tt>.
        /// </summary>
        /// <param name="x">the value to compute the bessel function of.</param>
        /// <returns></returns>
        static public double k1e(double x)
        {
            double y;

            if (x <= 0.0)
            {
                throw new ArithmeticException();
            }
            if (x <= 2.0)
            {
                y = x * x - 2.0;
                y = System.Math.Log(0.5 * x) * i1(x) + Arithmetic.Chbevl(y, A_k1, 11) / x;
                return(y * System.Math.Exp(x));
            }

            return(Arithmetic.Chbevl(8.0 / x - 2.0, B_k1, 25) / System.Math.Sqrt(x));
        }
Beispiel #3
0
        /// <summary>
        /// Returns the exponentially scaled modified Bessel function of the third kind of order 0 of the argument.
        /// </summary>
        /// <param name="x"></param>
        /// <returns></returns>
        static public double k0e(double x)
        {
            double y;

            if (x <= 0.0)
            {
                throw new ArithmeticException();
            }
            if (x <= 2.0)
            {
                y = x * x - 2.0;
                y = Arithmetic.Chbevl(y, A_k0, 10) - System.Math.Log(0.5 * x) * i0(x);
                return(y * System.Math.Exp(x));
            }

            y = Arithmetic.Chbevl(8.0 / x - 2.0, B_k0, 25) / System.Math.Sqrt(x);
            return(y);
        }
Beispiel #4
0
        /// <summary>
        /// Returns the exponentially scaled modified Bessel function
        /// of order 1 of the argument.
        /// <p>
        /// The function is defined as <tt>i1(x) = -i exp(-|x|) j1( ix )</tt>.
        /// </summary>
        /// <param name="x">the value to compute the bessel function of.</param>
        /// <returns></returns>
        static public double i1e(double x)
        {
            double y, z;

            z = System.Math.Abs(x);
            if (z <= 8.0)
            {
                y = (z / 2.0) - 2.0;
                z = Arithmetic.Chbevl(y, A_i1, 29) * z;
            }
            else
            {
                z = Arithmetic.Chbevl(32.0 / z - 2.0, B_i1, 25) / System.Math.Sqrt(z);
            }
            if (x < 0.0)
            {
                z = -z;
            }
            return(z);
        }