Accord.Math.Bessel.I C# (CSharp) Method

I() public static method

Bessel function of the first kind, of order 1.
public static I ( double x ) : double
x double
return double
        public static double I(double x)
        {
            double ans;

            double ax = Math.Abs(x);

            if (ax < 3.75)
            {
                double y = x / 3.75;
                y = y * y;
                ans = ax * (0.5 + y * (0.87890594 + y * (0.51498869 + y * (0.15084934
                   + y * (0.2658733e-1 + y * (0.301532e-2 + y * 0.32411e-3))))));
            }
            else
            {
                double y = 3.75 / ax;
                ans = 0.2282967e-1 + y * (-0.2895312e-1 + y * (0.1787654e-1 - y * 0.420059e-2));
                ans = 0.39894228 + y * (-0.3988024e-1 + y * (-0.362018e-2 + y * (0.163801e-2 + y * (-0.1031555e-1 + y * ans))));
                ans *= Math.Exp(ax) / Math.Sqrt(ax);
            }
            return x < 0.0 ? -ans : ans;
        }

Same methods

Bessel::I ( int n, double x ) : double