Skip to main content

LegendreGaussQuadrature

This routine computes the n Gauss-Quadrature points.

All Gauss-Quadrature points are inside (1,1)(-1, 1)

This example shows the usage of LegendreGaussQuadrature method.

This routine returns the quadrature points for Legendre polynom.

program main
use easifembase
implicit none
integer( i4b ) :: n
real( dfp ), allocatable :: pt( : ), wt( : )
type(string) :: msg, astr
n = 5
call reallocate( pt, n, wt, n )
call LegendreGaussQuadrature( n=n, pt=pt, wt=wt )
msg = "Legendre Gauss Quadrature n = " // tostring( n )
call display(msg%chars())
astr = MdEncode( pt .COLCONCAT. wt )
call display( astr%chars(), "" )
end program main

Zeros of J(x), n = 5 alpha=0 beta=0

ptwt
-0.906180.23693
-0.538470.47863
-1.56541E-160.56889
0.538470.47863
0.906180.23693

Some Legendre Gauss Quadrature points

n = 1

PointWeight
02

n = 2

PointWeight
-0.577351
0.577351

n = 3

PointWeight
-0.77460.55556
3.71231E-160.88889
0.77460.55556

n = 4

PointWeight
-0.861140.34785
-0.339980.65215
0.339980.65215
0.861140.34785

n = 5

PointWeight
-0.906180.23693
-0.538470.47863
2.66893E-170.56889
0.538470.47863
0.906180.23693

n = 6

PointWeight
-0.932470.17132
-0.661210.36076
-0.238620.46791
0.238620.46791
0.661210.36076
0.932470.17132

n = 7

PointWeight
-0.949110.12948
-0.741530.27971
-0.405850.38183
1.88509E-160.41796
0.405850.38183
0.741530.27971
0.949110.12948

n = 8

PointWeight
-0.960290.10123
-0.796670.22238
-0.525530.31371
-0.183430.36268
0.183430.36268
0.525530.31371
0.796670.22238
0.960290.10123

n = 9

PointWeight
-0.968168.12744E-02
-0.836030.18065
-0.613370.26061
-0.324250.31235
2.76366E-170.33024
0.324250.31235
0.613370.26061
0.836030.18065
0.968168.12744E-02

n = 10

PointWeight
-0.973916.66713E-02
-0.865060.14945
-0.679410.21909
-0.43340.26927
-0.148870.29552
0.148870.29552
0.43340.26927
0.679410.21909
0.865060.14945
0.973916.66713E-02