LegendreP & Gauss quad bug
- To: mathgroup at smc.vnet.net
- Subject: [mg25414] LegendreP & Gauss quad bug
- From: Paul Cally <cally at kronos.maths.monash.edu.au>
- Date: Fri, 29 Sep 2000 01:07:11 -0400 (EDT)
- Organization: Monash University
- Sender: owner-wri-mathgroup at wolfram.com
There is a bug in the V4 implementation of the Legendre function LegendreP, at least in the linux version. I am running Mathematica 4.0 under RedHat 6.2 linux. I have found the following bug: Mathematica 4.0 for Linux Copyright 1988-1999 Wolfram Research, Inc. -- Motif graphics initialized -- In[1]:= LegendreP[5,2,N[1/3]] Out[1]= -10.3704 In[2]:= LegendreP[5,2,N[1/3,20]] Out[2]= -0.17283950617283951 In[3]:= %%/% Out[3]= 60. =================================== LegendreP[n,m,x] appears to work properly if x is a machine precision number, but if it is higher precision, it gives a result which is out by EXACTLY the factor m!/n! This error is NOT present in Version 3.0 running under Digital Unix. Please note that this also causes the standard package GaussianQuadratures to give wrong results for the quadrature weights if n is odd and precision is set to greater than 16. In[1]:= << NumericalMath`GaussianQuadrature` In[2]:= GaussianQuadratureWeights[3, -1, 1] Out[2]= {{-0.774597, 0.555556}, {0, 0.888889}, {0.774597, 0.555556}} In[3]:= GaussianQuadratureWeights[3, -1, 1,17] Out[3]= {{-0.77459666924148337703585, 0.98360655737704918033}, > {0, 0.0327868852459016393443}, > {0.77459666924148337703585, 0.98360655737704918033}} If n is even, there is no abscissa at x=0, and the error scales away. However, if n is odd, the unscaled weight associated with the exact number x=0 is correct but all the others are wrong. When normalized, all the weights are therefore greatly in error. Paul Cally -- +--------------------------------------------------------------------------+ |Assoc Prof Paul Cally | Ph: +61 3 9905-4471 | |Dept of Mathematics & Statistics | Fax: +61 3 9905-3867 | |Monash University | paul.cally at sci.monash.edu.au | |PO Box 28M, Victoria 3800 | | |AUSTRALIA | http://www.maths.monash.edu.au/~cally/ | +--------------------------------------------------------------------------+