Sage: Ticket #3732: Unnecessary Maxima interactions in integration
https://trac.sagemath.org/ticket/3732
<p>
Here are a variety of integrals for which Maxima should not have to interact to ask about assumptions, but does.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/3732
Trac 1.1.6wasMon, 28 Jul 2008 04:11:36 GMTattachment set
https://trac.sagemath.org/ticket/3732
https://trac.sagemath.org/ticket/3732
<ul>
<li><strong>attachment</strong>
set to <em>testintfailscases.py</em>
</li>
</ul>
TicketaginiewiczMon, 01 Sep 2008 23:32:18 GMT
https://trac.sagemath.org/ticket/3732#comment:1
https://trac.sagemath.org/ticket/3732#comment:1
<p>
There's another example (that's with 3.1.2.alpha2), here it shouldn't need assumption on a:
</p>
<pre class="wiki">sage: var('a')
a
sage: integrate((x-a)^2*exp(-(x-a)^2), x, -Infinity, +Infinity)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/giniu/<ipython console> in <module>()
/opt/sage/local/lib/python2.5/site-packages/sage/calculus/functional.py in integral(f, *args, **kwds)
252 """
253 try:
--> 254 return f.integral(*args, **kwds)
255 except ValueError, err:
256 raise err
/opt/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py in integral(self, v, a, b)
2532 raise ValueError, "Integral is divergent."
2533 else:
-> 2534 raise TypeError, error
2535
2536
TypeError: Computation failed since Maxima requested additional constraints (use assume):
Is a positive or negative?
</pre>
TicketgnpriceFri, 24 Oct 2008 10:25:20 GMTattachment set
https://trac.sagemath.org/ticket/3732
https://trac.sagemath.org/ticket/3732
<ul>
<li><strong>attachment</strong>
set to <em>gaussian-integral-testcase.py</em>
</li>
</ul>
<p>
another failing integral
</p>
TicketgnpriceFri, 24 Oct 2008 10:26:55 GMT
https://trac.sagemath.org/ticket/3732#comment:2
https://trac.sagemath.org/ticket/3732#comment:2
<p>
I added a testcase for another integral, namely <code>integral( s^2 * exp(- (a + b) * s^2 ), s)</code>, that fails to integrate. This is reproduced on Sage 3.1.1.
</p>
TicketkcrismanThu, 29 Jan 2009 16:45:24 GMTsummary changed
https://trac.sagemath.org/ticket/3732#comment:3
https://trac.sagemath.org/ticket/3732#comment:3
<ul>
<li><strong>summary</strong>
changed from <em>calculus -- some examples of sage integration failing</em> to <em>Additional examples of maxima interactions in calculus leading to errors</em>
</li>
</ul>
<p>
Added clearer summary. The second attachment is not relevant to this ticket, though certainly we should be able to integrate arbitrary functions!
</p>
<p>
What is the purpose of this ticket long-term? These could be added, complete with their error messages, to calculus.py examples - but we already have several of those. Or one could say this is just a reminder of what we would eventually like Sage to be able to use Maxima to do, and put them in but not test them.
</p>
<p>
Otherwise this is in some sense related to solving <a class="closed ticket" href="https://trac.sagemath.org/ticket/780" title="defect: [with patch, positive review] calculus integration failing due to ... (closed: fixed)">#780</a> (among several others), which is a thornier problem.
</p>
TicketkcrismanThu, 24 Sep 2009 00:43:52 GMT
https://trac.sagemath.org/ticket/3732#comment:4
https://trac.sagemath.org/ticket/3732#comment:4
<p>
With the latest Maxima upgrade and Pynac conversion, the last two integrals are correct - the penultimate one is, of course,
</p>
<pre class="wiki">1/2*sqrt(pi)
</pre><p>
and the last one is
</p>
<pre class="wiki">1/2*(a+b)^(3/2)*s^3*gamma_incomplete(-3/2,(a+b)/s^2)/(s^2)^(3/2)
</pre>
TicketkcrismanFri, 02 Oct 2009 16:37:46 GMTdescription, summary changed
https://trac.sagemath.org/ticket/3732#comment:5
https://trac.sagemath.org/ticket/3732#comment:5
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/3732?action=diff&version=5">diff</a>)
</li>
<li><strong>summary</strong>
changed from <em>Additional examples of maxima interactions in calculus leading to errors</em> to <em>Unnecessary Maxima interactions in integration</em>
</li>
</ul>
<p>
Here is the current state of this ticket. Of the examples in the first attached file, the following are legitimate bugs of this type.
</p>
<p>
The first example has unnecessary questions.
</p>
<pre class="wiki">sage: integrate(1/sqrt(x-q), x, 1, 2)
2 sqrt(2 - q) - 2 sqrt(1 - q) # should be this always
</pre><p>
The third example is definitely a case for this, as of Maxima 5.19.1:
</p>
<pre class="wiki">(%i19) integrate(log(q-x), x, a, b);
Is b - a positive, negative, or zero?
positive;
(%o19) (b - q) log(q - b) - (a - q) log(q - a) - b + a
(%i20) integrate(log(q-x), x, a, b);
Is b - a positive, negative, or zero?
negative;
(%o20) (b - q) log(q - b) - (a - q) log(q - a) - b + a
(%i21) integrate(log(q-x), x, a, b);
Is b - a positive, negative, or zero?
zero;
(%o21) (b - q) log(q - b) - (a - q) log(q - a) - b + a
</pre><p>
The fifth example has MANY questions to ask, always the same answer:
</p>
<pre class="wiki">(%i36) integrate(1/sqrt(q^2-x^2),x, a, b);
Is b - a positive, negative, or zero?
negative;
Is q - a positive, negative, or zero?
zero;
Is q + a positive, negative, or zero?
zero;
Is q + b positive, negative, or zero?
positive;
b a
(%o36) asin(------) - asin(------)
abs(q) abs(q)
</pre><p>
++++++++++++++++++++++++++++++++
</p>
<p>
The following should not be considered bugs, at least not for the reason given.
</p>
<p>
The second example is okay:
</p>
<pre class="wiki">sage: integrate(1/(x-q),x,1,2)
</pre><p>
Maxima adds pi*I and/or switches q-2 to 2-q as appropriate. If we don't like those differences, that should be on a different ticket.
</p>
<p>
The fourth example is:
</p>
<pre class="wiki">sage: integrate(1/(q-x^2), x)
</pre><p>
The answers given are a constant away from each other, but look very different. This probably should be considered a bug (Maxima can't connect between logs and arctan/h stuff), but is likely to not be resolved soon, or by questions.
</p>
<p>
The last example is definitely not a bug, as for q=-1 you should get a different answer!
</p>
TicketkcrismanTue, 22 Dec 2009 17:02:41 GMTupstream set
https://trac.sagemath.org/ticket/3732#comment:6
https://trac.sagemath.org/ticket/3732#comment:6
<ul>
<li><strong>upstream</strong>
set to <em>N/A</em>
</li>
</ul>
<p>
Update: these (the three remaining ones above) are still in Maxima 5.20.1.
</p>
TicketjdemeyerTue, 13 Aug 2013 15:35:53 GMTmilestone changed
https://trac.sagemath.org/ticket/3732#comment:7
https://trac.sagemath.org/ticket/3732#comment:7
<ul>
<li><strong>milestone</strong>
changed from <em>sage-5.11</em> to <em>sage-5.12</em>
</li>
</ul>
Ticketvbraun_spamThu, 30 Jan 2014 21:20:52 GMTmilestone changed
https://trac.sagemath.org/ticket/3732#comment:8
https://trac.sagemath.org/ticket/3732#comment:8
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.1</em> to <em>sage-6.2</em>
</li>
</ul>
Ticketvbraun_spamTue, 06 May 2014 15:20:58 GMTmilestone changed
https://trac.sagemath.org/ticket/3732#comment:9
https://trac.sagemath.org/ticket/3732#comment:9
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.2</em> to <em>sage-6.3</em>
</li>
</ul>
Ticketvbraun_spamSun, 10 Aug 2014 16:51:03 GMTmilestone changed
https://trac.sagemath.org/ticket/3732#comment:10
https://trac.sagemath.org/ticket/3732#comment:10
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.3</em> to <em>sage-6.4</em>
</li>
</ul>
Ticketgh-DaveWitteMorrisWed, 27 Jan 2021 18:57:21 GMT
https://trac.sagemath.org/ticket/3732#comment:11
https://trac.sagemath.org/ticket/3732#comment:11
<p>
Here is a particularly easy one (that sympy and giac can do, of course):
</p>
<pre class="wiki">sage: var("a");
sage: integrate(cos(x), x, 0, a)
<snip>
ValueError: ...
Is a positive, negative or zero?
sage: integrate(cos(x), x, 0, a, algorithm="sympy")
sin(a)
sage: integrate(cos(x), x, 0, a, algorithm="giac")
sin(a)
</pre>
Ticket