Artemis.Engine.Maths.SpecialFunctions.SiApprox C# (CSharp) Method

SiApprox() public static method

Approximately evaluate the sine integral at x. This approximation only converges for |x| <= 5π. The sine integral is defined as x / Si(x) = | sinc(t) dt / 0 with sinc(t) = sin(t)/t.
public static SiApprox ( double x ) : double
x double
return double
        public static double SiApprox(double x)
        {
            return Integrator.Simpsons(t => Math.Sin(t) / t, 1e-8, x, 1 << 10);
            // 24/12/2015: The following comment refers to a time when this code belonged
            // to an old version of Artemis. Currently, there is no class named UpperSITransition,
            // thus the commment is moot. However, the issue involving convergence still persists.

            // 7/6/2015: This approximation isn't convergent enough on x > 4π
            // to be used by UpperSITransition. The above statement works, but
            // is seriously inefficient. Consider implementing something from
            // the Cephes library later on.
            /*
            var x2 = x * x;
            // This is the Padé Approximant of Si, given by
            //      https://en.wikipedia.org/wiki/Trigonometric_integral
            return x*(1.0
                + x2*(-4.54393409816329991e-2
                    + x2*(1.15457225751016682e-3
                        + x2*(-1.41018536821330254e-5
                            + x2*(9.43280809438713025e-8
                                + x2*(-3.53201978997168357e-10
                                    + x2*(7.08240282274875911e-13
                                        + x2*(-6.05338212010422477e-16))))))))
                / (1.0
                    + x2*(1.01162145739225565e-2
                        + x2*(4.99175116169755106e-5
                            + x2*(1.55654986308745614e-7
                                + x2*(3.28067571055789734e-10
                                    + x2*(4.5049097575386581e-13
                                        + x2*(3.21107051193712168e-16)))))));
             */
        }