Re: Early Results from Mathematica 4.0
- To: mathgroup at smc.vnet.net
- Subject: [mg18095] Re: Early Results from Mathematica 4.0
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 17 Jun 1999 12:26:35 -0400
- Organization: Universitaet Leipzig
- References: <7jajk6$k1p@smc.vnet.net> <7jual2$56f@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
I think the whole idea with Integrate[]/NIntegrate[] of an
interpolation function is wrong. Say you have K points x[i], f[i] and
you need an expansion in Legendre polynoms with maximum of degree K
you can simply create a linear system for the expansion
coefficients a[i]
y[r_]=Sum[a[i]*LegendereP[i,r],{i,0,K-1}]
by the interpolation condition y[x[i]]=f[i].
Mathematica's Fit[] will do a least square approximation
when a fewer degree of the expansion is needed.
Regards
Jens
Paul Abbott wrote:
>
> Kevin J. McCann wrote:
>
> > I have an
> > application in which I take a potential function which is a function of R
> > and theta and expand it in terms of Legendre polynomials. To do this I do a
> > 2D curve fit on the data and then use NIntegrate to get the Legendre
> > coefficients as a function of R.
>
> I wonder if there is a faster way of doing this computation by
> converting the curve fit to an expansion in Legendre polynomials using
> symbolic methods and pattern-matching? Perhaps you could post a simple
> example of what you are doing.
>
> Also, you might find that reducing the AccuracyGoal/PrecisionGoal will
> make NIntegrate run _much_ faster.
>
> Cheers,
> Paul