#14821: Weird error in exponential integral
-------------------------------------+-------------------------------------
       Reporter:  ppurka             |        Owner:  burcin
           Type:  defect             |       Status:  needs_work
       Priority:  minor              |    Milestone:  sage-7.3
      Component:  calculus           |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Paul Masson        |    Reviewers:  Ralf Stephan
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/paulmasson/14821                 |  65b3b55e4aa15b2bb85b3854611932e4d76637c7
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by rws):

 * status:  needs_review => needs_work
 * reviewer:   => Ralf Stephan


Old description:

> This is so trivial that I am surprised this bug even exists. :) Present
> since at least sage-5.2 till present versions.
>
> The following integral works
> {{{
> H = exp(-x)
> H.integral(x, 0, 1)
>
> -e^(-1) + 1
> }}}
>
> But the following integral errors out
> {{{
> H = exp(-1.0 * x)
> H.integral(x, 0, 1)
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "_sage_input_19.py", line 10, in <module>
>     exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
> -*-\\n" +
> _support_.preparse_worksheet_cell(base64.b64decode("SCA9IGV4cCgtMS4wKjEwXi0xKngpCkguaW50ZWdyYWwoeCwgMCwgMSk="),globals())+"\\n");
> execfile(os.path.abspath("___code___.py"))
>   File "", line 1, in <module>
>
>   File "/tmp/tmpE7_LAK/___code___.py", line 4, in <module>
>     exec compile(u'H.integral(x, _sage_const_0 , _sage_const_1 )
>   File "", line 1, in <module>
>
>   File "expression.pyx", line 9058, in
> sage.symbolic.expression.Expression.integral
> (sage/symbolic/expression.cpp:37991)
>   File "/usr/local/src/sage/sage-5.2.server/local/lib/python2.7/site-
> packages/sage/symbolic/integration/integral.py", line 683, in integrate
>     return definite_integral(expression, v, a, b)
>   File "function.pyx", line 432, in
> sage.symbolic.function.Function.__call__
> (sage/symbolic/function.cpp:4941)
>   File "/usr/local/src/sage/sage-5.2.server/local/lib/python2.7/site-
> packages/sage/symbolic/integration/integral.py", line 173, in _eval_
>     return integrator(*args)
>   File "/usr/local/src/sage/sage-5.2.server/local/lib/python2.7/site-
> packages/sage/symbolic/integration/external.py", line 21, in
> maxima_integrator
>     result = maxima.sr_integral(expression, v, a, b)
>   File "/usr/local/src/sage/sage-5.2.server/local/lib/python2.7/site-
> packages/sage/interfaces/maxima_lib.py", line 746, in sr_integral
>     raise error
> RuntimeError: ECL says: In function GCD, the value of the second argument
> is
>   1.0
> which is not of the expected type INTEGER
> }}}

New description:

 {{{
 integral(exp(-300.0/(-0.064*x+14.0)),x,0.0,120.0)
 ...
 RuntimeError: ECL says: In function GCD, the value of the second argument
 is
   1.0
 which is not of the expected type INTEGER
 }}}

 The original ticket description whose case does work now:

 This is so trivial that I am surprised this bug even exists. :) Present
 since at least sage-5.2 till present versions.

 The following integral works
 {{{
 H = exp(-x)
 H.integral(x, 0, 1)

 -e^(-1) + 1
 }}}

 But the following integral errors out
 {{{
 H = exp(-1.0 * x)
 H.integral(x, 0, 1)

 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "_sage_input_19.py", line 10, in <module>
     exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
 -*-\\n" +
 
_support_.preparse_worksheet_cell(base64.b64decode("SCA9IGV4cCgtMS4wKjEwXi0xKngpCkguaW50ZWdyYWwoeCwgMCwgMSk="),globals())+"\\n");
 execfile(os.path.abspath("___code___.py"))
   File "", line 1, in <module>

   File "/tmp/tmpE7_LAK/___code___.py", line 4, in <module>
     exec compile(u'H.integral(x, _sage_const_0 , _sage_const_1 )
   File "", line 1, in <module>

   File "expression.pyx", line 9058, in
 sage.symbolic.expression.Expression.integral
 (sage/symbolic/expression.cpp:37991)
   File "/usr/local/src/sage/sage-5.2.server/local/lib/python2.7/site-
 packages/sage/symbolic/integration/integral.py", line 683, in integrate
     return definite_integral(expression, v, a, b)
   File "function.pyx", line 432, in
 sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4941)
   File "/usr/local/src/sage/sage-5.2.server/local/lib/python2.7/site-
 packages/sage/symbolic/integration/integral.py", line 173, in _eval_
     return integrator(*args)
   File "/usr/local/src/sage/sage-5.2.server/local/lib/python2.7/site-
 packages/sage/symbolic/integration/external.py", line 21, in
 maxima_integrator
     result = maxima.sr_integral(expression, v, a, b)
   File "/usr/local/src/sage/sage-5.2.server/local/lib/python2.7/site-
 packages/sage/interfaces/maxima_lib.py", line 746, in sr_integral
     raise error
 RuntimeError: ECL says: In function GCD, the value of the second argument
 is
   1.0
 which is not of the expected type INTEGER
 }}}

--

Comment:

 Your commit is fine and can be considered as reviewed. However, I made the
 mistake not looking at the second case given in comment:2. This one still
 crashes. So, to preserve the valuable discussion, instead of closing the
 ticket and opening a second, I put the second case on top of the ticket
 description and set "needs work".

--
Ticket URL: <https://trac.sagemath.org/ticket/14821#comment:13>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to