Opened 7 years ago

Closed 4 years ago

#12628 closed defect (fixed)

Integration of Product of Sin(nz)/(nz) says divergent, but is not divergent

Reported by: dkrenn Owned by: burcin
Priority: major Milestone: sage-6.4
Component: calculus Keywords: integration, divergent, infinity
Cc: Merged in:
Authors: Daniel Krenn Reviewers: Ralf Stephan
Report Upstream: Reported upstream. Developers acknowledge bug. Work issues:
Branch: c3fb2ff (Commits) Commit: c3fb2ff1a2ddefb21dca15a0f1b8e2f971fc4caa
Dependencies: Stopgaps:

Description (last modified by dkrenn)

We have

sage: var('z,n')
(z, n)
sage: f(z,n) = sin(n*z)/(n*z)
sage: integrate(f(z,1)*f(z,3)*f(z,5)*f(z,7),z,0,oo)
Traceback (most recent call last)
...
ValueError: Integral is divergent.

but the value of that integral is 22/315*pi, see, for example, evaluations in Mathematica below.

Splitting the integral gives

sage: integrate(f(z,1)*f(z,3)*f(z,5)*f(z,7),z,0,1) 
1/105*integrate(sin(3*z)*sin(5*z)*sin(7*z)*sin(z)/z^4, z, 0, 1)
sage: integrate(f(z,1)*f(z,3)*f(z,5)*f(z,7),z,1,oo)   
256/105*I*gamma(-3, -16*I) - 49/30*I*gamma(-3, -14*I) - 25/42*I*gamma(-3, -10*I) + 32/105*I*gamma(-3, -8*I) - 9/70*I*gamma(-3, -6*I) + 4/105*I*gamma(-3, -4*I) - 1/210*I*gamma(-3, -2*I) + 1/210*I*gamma(-3, 2*I) - 4/105*I*gamma(-3, 4*I) + 9/70*I*gamma(-3, 6*I) - 32/105*I*gamma(-3, 8*I) + 25/42*I*gamma(-3, 10*I) + 49/30*I*gamma(-3, 14*I) - 256/105*I*gamma(-3, 16*I) + 1/2520

so we see that the integral from 0 to 1 is not evaluated.

Here are some more examples and the comparison to Mathematica:

sage: var('z,n')
(z, n)
sage: f(z,n) = sin(n*z)/(n*z)
sage: integrate(f(z,1),z,0,oo)
1/2*pi
sage: integrate(f(z,1)*f(z,3),z,0,oo)
1/6*pi
sage: integrate(f(z,1)*f(z,3)*f(z,5),z,0,oo)
1/10*pi
sage: integrate(f(z,1)*f(z,3)*f(z,5)*f(z,7),z,0,oo)
Traceback (most recent call last)
...
ValueError: Integral is divergent.
sage: integrate(f(z,1)*f(z,3)*f(z,5)*f(z,7)*f(z,9),z,0,oo)
3677/72576*pi
sage: integrate(f(z,1)*f(z,3)*f(z,5)*f(z,7)*f(z,9)*f(z,11),z,0,oo)
Traceback (most recent call last)
...
ValueError: Integral is divergent.
sage: integrate(f(z,1)*f(z,3)*f(z,5)*f(z,7)*f(z,9)*f(z,11)*f(z,13),z,0,oo)
193359161/6227020800*pi
sage: integrate(f(z,1)*f(z,3)*f(z,5)*f(z,7)*f(z,9)*f(z,11)*f(z,13)*f(z,15),z,0,oo)
Traceback (most recent call last)
...
ValueError: Integral is divergent.
In[1]:= f[z_,n_]:=Sin[n z]/(n z)

In[2]:= Integrate[f[z,1],{z,0,Infinity}]

        Pi
Out[2]= --
        2

In[3]:= Integrate[f[z,1]*f[z,3],{z,0,Infinity}]             

        Pi
Out[3]= --
        6

In[4]:= Integrate[f[z,1]*f[z,3]*f[z,5],{z,0,Infinity}]

        Pi
Out[4]= --
        10

In[5]:= Integrate[f[z,1]*f[z,3]*f[z,5]*f[z,7],{z,0,Infinity}]

        22 Pi
Out[5]= -----
         315

In[6]:= Integrate[f[z,1]*f[z,3]*f[z,5]*f[z,7]*f[z,9],{z,0,Infinity}]

        3677 Pi
Out[6]= -------
         72576

In[7]:= Integrate[f[z,1]*f[z,3]*f[z,5]*f[z,7]*f[z,9]*f[z,11],{z,0,Infinity}]

        48481 Pi
Out[7]= --------
        1247400

In[8]:= Integrate[f[z,1]*f[z,3]*f[z,5]*f[z,7]*f[z,9]*f[z,11]*f[z,13],{z,0,Infinity}]

        193359161 Pi
Out[8]= ------------
         6227020800

In[9]:= Integrate[f[z,1]*f[z,3]*f[z,5]*f[z,7]*f[z,9]*f[z,11]*f[z,13]*f[z,15],{z,0,Infinity}]

        5799919 Pi
Out[9]= ----------
        227026800

Change History (13)

comment:1 Changed 7 years ago by dkrenn

  • Description modified (diff)

comment:2 Changed 7 years ago by kcrisman

Naturally, this is straight from Maxima.

Maxima 5.26.0 http://maxima.sourceforge.net
using Lisp SBCL 1.0.24
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) integrate(sin(z)/z*sin(3*z)/(3*z)*sin(5*z)/(5*z)*sin(7*z)/(7*z),z,0,inf);

defint: integral is divergent.
 -- an error. To debug this try: debugmode(true);
(%i2) integrate(sin(z)/z*sin(3*z)/(3*z)*sin(5*z)/(5*z)*sin(7*z)/(7*z)*sin(9*z)/(9*z),z,0,inf);
                                   3677 %pi
(%o2)                              --------
                                    72576

That is kind of weird, the even/odd (well, mod 4) issue.

This is now on the Maxima bug tracker.

comment:3 Changed 7 years ago by kcrisman

  • Report Upstream changed from N/A to Reported upstream. Little or no feedback.

comment:4 Changed 7 years ago by roed

  • Report Upstream changed from Reported upstream. Little or no feedback. to Reported upstream. Developers acknowledge bug.

comment:5 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:6 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:7 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:8 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:9 follow-up: Changed 4 years ago by rws

This works now in Sage 6.5beta4, so just a doctest is needed.

comment:10 Changed 4 years ago by dkrenn

  • Branch set to u/dkrenn/t/12628

comment:11 in reply to: ↑ 9 Changed 4 years ago by dkrenn

  • Authors set to Daniel Krenn
  • Commit set to c3fb2ff1a2ddefb21dca15a0f1b8e2f971fc4caa
  • Status changed from new to needs_review

Replying to rws:

This works now in Sage 6.5beta4, so just a doctest is needed.

Doctest added.


New commits:

c3fb2ffadd doctest for integrals in trac #12628

comment:12 Changed 4 years ago by rws

  • Reviewers set to Ralf Stephan
  • Status changed from needs_review to positive_review

Is fine, thanks.

comment:13 Changed 4 years ago by vbraun

  • Branch changed from u/dkrenn/t/12628 to c3fb2ff1a2ddefb21dca15a0f1b8e2f971fc4caa
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.