MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Legendre Polynomials

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56082] Re: Legendre Polynomials
  • From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
  • Date: Fri, 15 Apr 2005 04:47:16 -0400 (EDT)
  • References: <d3g8kd$smh$1@smc.vnet.net> <d3ls13$sgv$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

kazimir04 at yahoo.co.uk (Kazimir) wrote:
> > BesselJ[1.5, 0] evaluates to 0 but
> > (BesselJ[xx, yyy] /. xx -> 1.5) /. yyy -> 0 evaluates to complex
> > infinity
> >
> > I seem to encounter many of these problems with Bessel and Legendre
> > functions where I get actual diffrent numerical results depending on
> > How I set the parameters.
>
> I worked with Legendre Polynomils and also experienced the problem. If
> you use
> LegendreP[60, 1.] you have the correct answer 1.

It's correct, yes. But it easily might not have been.

It would have been safer to use either LegendreP[60, 1] or
LegendreP[60, x] /. x->1 , which both give 1 precisely.

> It looks like it uses
> a smart algorythm. If you use LegendreP[60, x] /. x -> 1. mathematica
> first finds the explicit forms of the polynomail, and only afer that
> puts x->1. which means that you have to sum up tirms of odre say 10^20
> to get 1. Due ti rounding errors you may obtain a wrong answer.

Indeed!

In[13]:= LegendreP[60, x] /. x->1.

Out[13]= -180992.

et cetera

In[14]:= LegendreP[60, x] /. x->1.00000000000000000000000

Out[14]= 0.

but _finally_

In[15]:= LegendreP[60, x] /. x->1.000000000000000000000000

Out[15]= 1.

Ah, the perils of using inexact numbers.

David Cantrell


  • Prev by Date: Re: Position different in 5.0 and 5.1?
  • Next by Date: Re: Position different in 5.0 and 5.1?
  • Previous by thread: Re: Legendre Polynomials
  • Next by thread: Re (correction): confusion about Thread[]