Opened 4 years ago

Last modified 3 months ago

#22671 new defect

Bug with definite integral

Reported by: rws Owned by:
Priority: major Milestone: sage-9.4
Component: calculus Keywords:
Cc: slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by slelievre)

Two similar integrals, differing by an exponent 1/3 vs 1/5, behave differently.

Here, three ways to compute an integral agree:

sage: q = 1/3
sage: g = (1 + x)^q / (1 - x)
sage: a = g.integrate(x, 2., 3., hold=True)  # hold
sage: b = g.integrate(x, 2., 3.)  # no hold
sage: c = g.nintegral(x, 2., 3.)  # numerical
sage: print(f'  a ≈ {a.n()}\n  b ≈ {b.n()}\n  c ≈ {c[0]}')
  a ≈ -1.045820326411141
  b ≈ -1.04582032641114
  c ≈ -1.045820326411141

Here they do not:

sage: Q = 1/5
sage: G = (1 + x)^Q / (1 - x)
sage: A = G.integrate(x, 2., 3., hold=True)  # hold
sage: B = G.integrate(x, 2., 3.)  # no hold  # long time!
sage: C = G.nintegral(x, 2., 3.)  # numerical
sage: print(f'  A ≈ {A.n()}\n  B ≈ {B.n()}\n  C ≈ {C[0]}')
  A ≈ -0.8870832386197556
  B ≈ -0.963974668699275 - 0.0295059317724807*I
  C ≈ -0.8870832386197555

Change History (2)

comment:1 Changed 3 months ago by slelievre

  • Cc slelievre added
  • Description modified (diff)

comment:2 Changed 3 months ago by slelievre

  • Description modified (diff)
  • Milestone changed from sage-8.0 to sage-9.4
Note: See TracTickets for help on using tickets.