Bill Allombert on Fri, 16 Mar 2018 17:00:02 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Integration Methods in PARI


On Fri, Mar 16, 2018 at 04:34:13PM +0100, kevin lucas wrote:
> I have been trying to evaluate the following integral in PARI:
> 
> intnum(x=0, +oo, x*exp(cos(x))*sin(sin(x))/(x^2-1))
> 
> but end up with the following error
> 
>  ***   at top-level: ...x*exp(cos(x))*sin(sin(x))/(x^2-1))
>  ***                                             ^---------
>  *** _/_: impossible inverse in divrr: 0.E-230.
>  ***   Break loop: type 'break' to go back to GP prompt

It seems to me your integral is diverging around x=1.
Maybe you meant something else ?

> How should I proceed? More generally, how should one integrate such
> functions, which are oscillatory but not decomposable into a product of
> a non-oscillating function and a sine or cosine, as in the manual?

You can approximate the function by a Fourier series.

Cheers,
Bill.