Re: [Help-gsl] gsl_sum (potential division by zero?)
At Sun, 24 Dec 2006 13:35:14 +0100, Michel Van den Bergh wrote: I was looking at the code for gsl_sum. I have not completely understood it yet, but I noticed that whereas levin_utrunc.c explicitly tests for terms that are zero, this is not the case for levin_u.c. As one divides by such terms, it seems that one may potentially divide by zero this way. Am I wrong? Hello, Thanks for your email. I think the original code that the routine was translated from assumes that all terms passed in are non-zero since any others would not contribute to the sum. The documentation does not seem to mention that terms should be different from zero. Yes, I will add a note about that. I am not a numerical analyst (IANANA) but it seems to me that even in levin_utrunc.c no motivation is given for discarding zero terms. Wouldn't it be more natural to add a bit of noise to the remainder estimates to reduce the risk of division by zero? Generally in GSL we just implement what is published in the literature, so far I have not seen any newer algorithms published. -- best regards, Brian Gough (GSL Maintainer) Network Theory Ltd, Publishing the GSL Manual - http://www.network-theory.co.uk/gsl/manual/ ___ Help-gsl mailing list Help-gsl@gnu.org http://lists.gnu.org/mailman/listinfo/help-gsl
[Help-gsl] gsl_sum (potential division by zero?)
Hi, I am not a numerical analyst (IANANA) but it seems to me that even in levin_utrunc.c no motivation is given for discarding zero terms. The division by zero problem occurs because in the levin_u transform if some terms f(n) in a series are zero, so are the corresponding remainder estimates nf(n). But it seems to me that division by zero can also occur deeper in the algorithm. Wouldn't it be more natural to add a bit of noise to the remainder estimates to reduce the risk of division by zero? It seems to me that adding a bit of noise to the remainder estimates would not fundamentally alter the convergence properties of the levin_u transform. The remainder estimates are very crude anyway. But again IANANA. Regards, Michel ___ Help-gsl mailing list Help-gsl@gnu.org http://lists.gnu.org/mailman/listinfo/help-gsl
[Help-gsl] gsl_sum (potential division by zero?)
Hi, I was looking at the code for gsl_sum. I have not completely understood it yet, but I noticed that whereas levin_utrunc.c explicitly tests for terms that are zero, this is not the case for levin_u.c. As one divides by such terms, it seems that one may potentially divide by zero this way. Am I wrong? The documentation does not seem to mention that terms should be different from zero. Regards, Michel ___ Help-gsl mailing list Help-gsl@gnu.org http://lists.gnu.org/mailman/listinfo/help-gsl