Opened 3 years ago
Last modified 9 months ago
#21440 new defect
wrong result of integral
Reported by: | dkrenn | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-7.4 |
Component: | symbolics | Keywords: | wrong result, integration |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Reported upstream. Developers acknowledge bug. | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage: f1 = (2*cos(2*pi*x) - cos(4*pi*x)) / (5 - 4*cos(2*pi*x)) sage: integrate(f1, x, 0, 1) 23/24
but it should be 1/4
:
sage: sage: numerical_integral(f1,0,1) (0.24999999999999997, 4.6160077311221225e-15)
and
sage: e(x)=exp(2*pi*I*x) sage: f2=real(e(x)/(2-e(-x))) sage: (f1-f2).simplify_trig() # f1 equals f2 0 sage: integrate(f2,x,0,1) 1/4
This was reported by Lukas Spiegelhofer on 8/10/2015 16:00:13 via "Sage Notebooks Bugreports".
Change History (5)
comment:1 Changed 2 years ago by
- Report Upstream changed from N/A to Reported upstream. No feedback yet.
comment:2 Changed 2 years ago by
- Report Upstream changed from Reported upstream. No feedback yet. to Reported upstream. Developers acknowledge bug.
comment:3 Changed 9 months ago by
Is the following example an instance of the same bug, or a different problem?
sage: (cos(pi*x)*exp(-I*pi*x)).integral(x,-1/2,1/2) # wrong 1 sage: F = (cos(pi*x)*exp(-I*pi*x)).integral(x); F(x=1/2)-F(x=-1/2) # correct 1/2
comment:4 Changed 9 months ago by
Hmmm they look similar to me, although in your example the primitive computed by Maxima is correct, but for the case of the description also the primitive is wrong:
sage: f1 = (2*cos(2*pi*x) - cos(4*pi*x)) / (5 - 4*cos(2*pi*x)) sage: F1 = f1.integrate(x) sage: F1(x=1) - F1(x=0) # yet another result! 5/8 sage: F1_g = f1.integrate(x, algorithm="giac") sage: F1_g(x=1) - F1_g(x=0) 1/4
comment:5 Changed 9 months ago by
I'm not sure integrate
accepts inputs that take non-real values (it should be documented if yes or no):
sage: f(x)=cos(pi*x)*exp(-I*pi*x) sage: f(1/4) -1/2*I + 1/2
Note that:
sage: (cos(pi*x)*exp(-I*pi*x)).real().integral(x,-1/2,1/2) 1/2
Note: See
TracTickets for help on using
tickets.
see: https://sourceforge.net/p/maxima/bugs/3295/