To compute the following integral using the Gauss-Laguerre method:
The delegate function is simply a sine function, since the weighting function w(x) = e-x for
the Gauss-Laguerre integration.
Running this example creates the results shown above. The exact result of this integral is equal to 0.5. The result for
n = 6 is already very accurate.
Testing the Gauss-Laguerre Integration Method
In order to test the Gauss-Laguerre method as defined above, a new TestGaussLaguerre()
static method has been added and executed. Supporting code and methods are not shown.
►
|
static void TestGaussLaguerre();
{
ListBox1.Items.Clear();
ListBox2.Items.Clear();
double result;
for (int n = 1; n < 9; n++)
(
result = Integration.GaussLaguerre(f3, n);
ListBox1.Items.Add(" " + n + );
ListBox2.Items.Add(" " + result);
)
}
|
|