#14976: integration with non symbolic bounds broken
-------------------------------+--------------------------
       Reporter:  burcin       |         Owner:
           Type:  defect       |        Status:  new
       Priority:  critical     |     Milestone:  sage-5.12
      Component:  symbolics    |    Resolution:
       Keywords:  integration  |     Merged in:
        Authors:               |     Reviewers:
Report Upstream:  N/A          |   Work issues:
         Branch:               |  Dependencies:
       Stopgaps:               |
-------------------------------+--------------------------

Comment (by charpent):

 I disagree. See below :

 Replying to [comment:2 nbruin]:
 > Looking at the returned error, I do not get the impression this has
 anything to do with maxima or with checking whether something is real-
 valued. The error we're getting is that attributes like `variables` and
 `derivative` end up being looked up on sage integer objects rather than on
 SR elements. This must happen somewhere during the picking apart of the
 expression:
 > {{{
 > sage: g
 > integrate(f(a), a, 0, a^2)
 > sage: [type(o) for o in g.operands()]
 > [sage.symbolic.expression.Expression,
 >  sage.symbolic.expression.Expression,
 >  sage.symbolic.expression.Expression,
 >  sage.symbolic.expression.Expression]
 > sage: g.operands()[2].diff(a)
 > 0
 > }}}
 > as you see, all quantities involved are symbolic expressions and this
 "symbolic constant 0" has no problem being differentiated.
 > {{{
 > sage: g.derivative(a)
 > AttributeError
 > sage: %debug
 > ipdb> up
 > > /usr/local/sage/5.7/local/lib/python2.7/site-
 packages/sage/symbolic/integration/integral.py(224)_tderivative_()
 >     223         return ans + f.subs(x==b)*b.diff(diff_param) \
 > --> 224                     - f.subs(x==a)*a.diff(diff_param)
 >     225
 > ipdb> p [(c,type(c)) for c in [f,x,a,b,diff_param]]
 > [(f(a), <type 'sage.symbolic.expression.Expression'>), (a, <type
 'sage.symbolic.expression.Expression'>), (0, <type
 'sage.rings.integer.Integer'>), (a^2, <type
 'sage.symbolic.expression.Expression'>), (a, <type
 'sage.symbolic.expression.Expression'>)]
 > }}}
 > I suspect that this lower bound `a=0` (here a is the local variable in
 `_tderivative`) is coming from the lower integration bound involved in the
 definition of `g`, and apparently this bound got stripped out of SR a
 little prematurely for this purpose.

 So ? If this was tre source of the error, it shouldn't happen with
 symbolic lower and upper bounds (see my slightly generalized example), but
 it does. Furrthermore, declaring the bounds as real allows for completing
 the task (bothh from maxima and from sage)...

  Probably replacing the code above with
 > {{{
 >         return ans + f.subs(x==b)*SR(b).diff(diff_param) \
 >                     - f.subs(x==a)*SR(a).diff(diff_param)
 > }}}
 > would solve the problem. However it might be worthwhile to look why `a`
 got stripped out of SR in the first place and whether that should simply
 be prevented at the spot (so that `_tderivative` gets called with symbolic
 `a,b` regardless of whether they happen to be integer constants)

--
Ticket URL: <http://trac.sagemath.org/ticket/14976#comment:3>
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/groups/opt_out.


Reply via email to