Simpson's method for numerically computing the integration of a function I have implemented the Simpson's rule for numerical integration. 

Check this video for the implemented function.

namespace Simpsons_method_of_integration
{
    //https://www.youtube.com/watch?v=ns3k-Lz7qWU
    using System;

    public class Simpson
    {
        private double Function(double x)
        {
            return 1.0 / (1.0 + Math.Pow(x, 5)); //Define the function f(x)
        }

        public double Compute(double a, double b, int n)
        {
            double[] x = new double[n + 1];

            double delta_x = (b - a) / n;

            x[0] = a;

            for (int j = 1; j &lt;= n; j++)//calculate the values of x1, x2, ...xn
            {
                x[j] = a + delta_x * j;
            }

            double sum = Function(x[0]);

            for (int j = 1; j &lt; n; j++)
            {
                if (j % 2 != 0)
                {
                    sum += 4 * Function(x[j]);
                }
                else
                {
                    sum += 2 * Function(x[j]);
                }
            }

            sum += Function(x[n]);

            double integration = sum * delta_x / 3;

            return integration;
        }
    }

    public class MainClass
    {
        public static void Main()
        {
            Simpson simpson = new Simpson();
            double a = 0d;//lower limit a
            double b = 3d;//upper limit b
            int n = 6;//Enter step-length n

            if (n % 2 == 0)//n must be even
            {
                Console.WriteLine(simpson.Compute(a, b, n));
            }
            else
            {
                Console.WriteLine("n should be an even number");
            }

            Console.ReadLine();
        }
    }
}


Output:

1.07491527775614




How can I make this source code more efficient?
There is no reason to allocate the double[] x array. It is better to compute the argument as you go: initialize double x = a; and increment it x += delta_x; in the loop body.
if in the loop is usually a performance killer. Consider incrementing j by 2:

    for (int j = 1; j &lt; n; j += 2)
    {
        sum += 2 * Function(x);
        x += delta_x;
        sum += 4 * Function(x);
        x += delta_x;
    }


Now depending on the parity of n the very last addition could be wrong, and you need to compensate for it.
Function shall not be a Simpson's method. The Simpson shall not care what it integrates. Change the signature of Compute to accept the callable.
The choice of \$\dfrac{1}{1 + x^5}\$ for an integrand looks strange. It is hard to verify that the result is correct. I recommend to test against some more friendly integrands first.