Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: math
See also: simpsonint

Quantlet: GaussLegendre
Description: abscissas and weights of the Gauss-Legendre n-point quadrature.

Usage: {X,W} = GaussLegendre(x1,x2,n,EPS)
Input:
x1 scalar, lower limit of integretion
x2 scalar, upper limit of integration
n scalar, integer, number of points of integration
EPS scalar, relative prcision
Output:
X n x 1 vector of abscissas
W n x 1 vector of weights

Example:
y=GaussLegendre(0,20,3,0.00001)
y

Result:
Contents of y.X
[1,]    2.254
[2,]       10
[3,]   17.746
Contents of y.W
[1,]   5.5556
[2,]   8.8889
[3,]   5.5556
Example:
library("math")
y=GaussLegendre(-3,3,10,0.00001)
;calculate an integral on(-3,3) interval
sum(pdfn(y.X).*y.W)

Result:
Contents of sum
[1,]   0.9973



Author: P. Uniejewski, R. Weron, 20040620 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006