#12947: Bug in integrating x*cos(x^3)
-------------------------------------+-------------------------------------
Reporter: kcrisman | Owner: burcin
Type: defect | Status: needs_review
Priority: trivial | Milestone: sage-6.3
Component: calculus | Resolution:
Keywords: | Merged in:
Authors: Peter Bruin | Reviewers: Ralf Stephan
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/pbruin/12947-maxima_integral | 3d9a07cd45fd002020a1f67cb2394af5a38d76a0
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by pbruin):
The imaginary part turns out to be "simply" the fact that floating-point
addition is not associative, and for some reason the terms in the
expression `e` from comment:17 are added in random order by `.n()`.
{{{
sage: e = integrate(x*cos(x^3),(x,0,1/2)); e
1/12*I*sqrt(3)*gamma(2/3, 1/8*I) - 1/12*I*sqrt(3)*gamma(2/3, -1/8*I) -
1/12*gamma(2/3, 1/8*I) - 1/12*gamma(2/3, -1/8*I) + 1/6*gamma(2/3)
sage: v = [term.n() for term in e.operands()]; v
[0.0454319516149362 + 0.166098636946833*I,
0.0454319516149362 - 0.166098636946833*I,
-0.0958970927532841 + 0.0262301494946934*I,
-0.0958970927532841 - 0.0262301494946934*I,
0.225686323237733]
sage: uniq([sum(p.action(v)) for p in permutations(5)])
[0.124756040961038 - 2.77555756156289e-17*I,
0.124756040961038,
0.124756040961038 + 2.77555756156289e-17*I,
0.124756040961038 - 1.38777878078145e-17*I,
0.124756040961038,
0.124756040961038 + 1.38777878078145e-17*I,
0.124756040961038 - 2.77555756156289e-17*I,
0.124756040961038,
0.124756040961038 + 2.77555756156289e-17*I,
0.124756040961038 - 1.38777878078145e-17*I,
0.124756040961038 + 1.38777878078145e-17*I,
0.124756040961038 - 2.77555756156289e-17*I,
0.124756040961038 + 2.77555756156289e-17*I,
0.124756040961038]
}}}
This gives 14 different outcomes depending on the summation order (some of
the differences are hidden due to the number of digits printed). I don't
think this can be solved easily, so I propose we stick to the `# abs tol`
fix.
--
Ticket URL: <http://trac.sagemath.org/ticket/12947#comment:20>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.