octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Integration pkg algo replacement suggestion


From: Fotios Kasolis
Subject: Integration pkg algo replacement suggestion
Date: Sat, 25 Sep 2010 19:30:15 +0200

In the integration 1.0.7 pkg exists a routine that generates gaussian points and weights (in the file grule.m) using the algorithm given by Davis and Rabinowitz in Methods of numerical integration.
 
I suggest that the algorithm is replaced by Trefethen Golub - Welsch algorithm for the obvious reason! (+ the beauty of the theory!)
 
function [ x, w ] = grule (n)
b = 0.5 ./ sqrt (1 - (2 * (1:n - 1)) .^ - 2);
L = diag (b, 1) + diag (b, - 1);
[ V, D ] = eig (L);
x = diag (D);
[ x, i ] = sort (x);
w = (2 * V(1, i) .^ 2)';
 
/Fotios

reply via email to

[Prev in Thread] Current Thread [Next in Thread]