Private Sub Command1_Click()
'PROGRAM D3R9
'Driver for routine GAULEG
NPOINT = 10
X1 = 0#
X2 = 1#
X3 = 10#
Dim X(10), W(10)
Call GAULEG(X1, X2, X(), W(), NPOINT)
Print
Print Tab(5); "# X(I) W(I)"
For I = 1 To NPOINT
Print Tab(5); Format$(I, "##");
Print Tab(14); Format$(X(I), "0.######");
Print Tab(27); Format$(W(I), "0.######")
Next I
'Demonstrate the use of GAULEG for an integral
Call GAULEG(X1, X3, X(), W(), NPOINT)
XX = 0#
For I = 1 To NPOINT
XX = XX + W(I) * FUNC(X(I))
Next I
Print
Print Tab(5); "Integral from GAULEG: "; Format$(XX, "0.######")
Print Tab(5); "Actual value: ";
Print Tab(20); Format$((1# - (1# + X3) * Exp(-X3)), "0.######")
End Sub
Function FUNC(X)
FUNC = X * Exp(-X)
End Function