On Dirichlet integrale computation

16 views
Skip to first unread message

nimportequoi idem

unread,
Oct 26, 2023, 7:48:31 AM10/26/23
to mpmath
I'm trying to compute some oscillatory integral using the quadosc function. But I didn't manage to use it correctly

I've tried to compute, as an example, Dirichlet integral $\int_0 ^{+ \infty} \dfrac{\sin(t)}{t} dt = \dfrac{\pi}{2}$ using the following code:

from mpmath import *

display(pi / 2)
display(quadosc(lambda u: sin(u) / u, [0, inf], omega=1))
display(quadosc(lambda u: sin(u) / u, [0, inf], period=2*pi))
display(quadosc(lambda u: sin(u) / u, [0, inf], zeros=lambda n: n * pi))

The answer is:
mpf('1.5707963267948966')
mpf('1.641666298892096')
mpf('1.641666298892096')
mpf('1.641666298892096')

But, when I change the number of decimal, e.g. mp.dps = 50, then I have the "right" answer:
mpf('1.5707963267948966192313216916397514420985846996875534')
mpf('1.5707963267948965954112058173691061340591300876825049')
mpf('1.5707963267948965954112058173691061340591300876825049')
mpf('1.5707963267948965954112058173691061340591300876825049')

Is someone able to explain how to improve the behaviour of quadosc?

Olivier

Vinzent Steinberg

unread,
Oct 27, 2023, 4:30:35 AM10/27/23
to mpmath
Hi Olivier,

I cannot reproduce the behavior you are observing, I'm getting pi/2 for all three variants with mpmath 1.2.1.

Which mpmath version are you using?

Best regards,
Vinzent

nimportequoi idem

unread,
Nov 10, 2023, 10:29:50 AM11/10/23
to mpmath
According to my file __init__.py, my version is '1.1.0'. That explain probably this behaviour.

Vincent, Thanks you for your answer

Best regards,

Olivier
Reply all
Reply to author
Forward
0 new messages