/// <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");
} |