Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6533 > unrolled thread

Re: NIntegrate to compute LegendreP approximations to functions

Started by"J. Jesús Rico Melgoza" <jerico@umich.mx>
First post2011-11-19 11:51 +0000
Last post2011-11-19 11:51 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: NIntegrate to compute LegendreP approximations to functions "J. Jesús Rico Melgoza" <jerico@umich.mx> - 2011-11-19 11:51 +0000

#6533 — Re: NIntegrate to compute LegendreP approximations to functions

From"J. Jesús Rico Melgoza" <jerico@umich.mx>
Date2011-11-19 11:51 +0000
SubjectRe: NIntegrate to compute LegendreP approximations to functions
Message-ID<ja857r$iis$1@smc.vnet.net>
Thanks for the advise. Though, I don't see why the constant term is not calculated properly.
 The resulting approximation in

Plot[{u, Sum[c[k] LegendreP[k, t], {k, 0, 20}]}, {t, -1, 1}]

has a different c[0].
J. Rico


El 18/11/2011, a las 06:50, Bob Hanlon escribi=F3:

> Do the integration once.
>
> u = Sign[t];
>
> c[k_] = Simplify[
>  (2 k + 1)/2 Integrate[u LegendreP[k, t], {t, -1, 1}],
>  Element[k, Integers]]
>
> ((1 + 2*k)*Sqrt[Pi])/(2*Gamma[1 - k/2]*Gamma[(3 + k)/2])
>
>
> Bob Hanlon
>
>
> 2011/11/18 "J. Jes=FAs Rico Melgoza" <jerico@umich.mx>:
>>
>> Hello
>> I am approximating general scalar functions via orthogonal series. I am
>> using LegendreP polynomials.
>> As an example, I have approximated a Sign function. The coefficients
>> have been calculated as follows:
>>
>> n = 20;
>> u = Sign[t];
>> N[Table[(2 k + 1)/2 Integrate[u LegendreP[k, t], {t, -1, 1}], {k, 0,
>> n}]]
>>
>> Everything works well but I would like to speed up computations since
>> for large values of n, Integrate takes long computations times. I need
>> to speed up the process since in general I will be approximating
>> multi-variable functions. I have tried NIntegrate but I get multiple
>> messages such as
>>
>> NIntegrate::slwcon :  "Numerical integration converging too slowly;
>> suspect \
>> one of the following: singularity, value of the integration is 0, highly
>> \
>> oscillatory integrand, or WorkingPrecision too small. =91=99=98ButtonBox["
>> ",
>> Appearance->{Automatic, None},
>> BaseStyle->"Link",
>> ButtonData:>"paclet:ref/message/NIntegrate/slwcon",
>> ButtonNote->"NIntegrate::slwcon"]"
>>
>> NIntegrate is a very complete function in Mathematica, so much that it
>> has been rather difficult to find an adequate combination of  a method
>> and a strategy of integration that would improve the timing of
>> Integrate.
>>
>> Could anyone give me some advice?
>>
>> Jesus Rico-Melgoza
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web