Integration

The Quant Express libraries integrate several method to estimate integrals with or without a probability distribution. The function to integrate can be specified by the user during runtime thanks to our unique Mathematical Expression Parser . The probability distribution can be any of the dozens supported by our libraries.
In pratical terms this means you can easily estimate the following equations in about 5 lines of code:
Math Integral Sample

   
In this example, we propose to numerically estimate the second integral.
   
Integral Lower Limit (a)
+
-
Integral Upper Limit (b)
+
-
   
 
Calculate
   
Integral Value

The code used to calculate the integral on this page is shown below:

C# Code Sample
/// <summary>
/// Function to integrate
/// </summary>
/// <param name="aX"></param>
/// <returns></returns>
private double Func(double aX)
{
    return Math.Exp(-(aX * aX) / 2.0);
}

protected void BtnCalculate_Click(object sender, EventArgs e)
{
    double wLowerLimit = Convert.ToDouble(SELowerLimit.Value);
    double wUpperLimit = Convert.ToDouble(SEUpperLimit.Value);
    
    // Evaluate the integral
    double wIntegral = QuantExpress.Maths.Integral.IntegralGaussLegendre(wLowerLimit, wUpperLimit,
        new QuantExpress.Maths.Delegates.FCT<double>(this.Func), 5000);
    
    // Display the integral estimate value
    EditIntegralValue.Text = wIntegral.ToString("N6");
}

Once the Function to integrate has been defined, the actual call to the integral method is just made of one line!

Now that is cool!