Easy definite integral

38 views
Skip to first unread message

Montgomery-Smith, Stephen

unread,
Aug 19, 2016, 2:54:42 PM8/19/16
to sage-s...@googlegroups.com
Shouldn't this be an easy integral to compute?

sage: y = var('y')
sage: t = var('t')
sage: integrate(y*e^(-y),y,0,t)

Huge amount of error messages deleted, followed by:

ValueError: Computation failed since Maxima requested additional
constraints; using the 'assume' command before evaluation *may* help
(example of legal syntax is 'assume(t>0)', see `assume?` for more details)
Is t positive, negative or zero?

Then I can fix it like this.

sage: assume(t>0)
sage: integrate(y*e^(-y),y,0,t)
-(t + 1)*e^(-t) + 1

However the integral is an analytic function, and exists even if t is
negative or complex.

Thanks, Stephen

Robert Dodier

unread,
Aug 19, 2016, 8:28:29 PM8/19/16
to sage-s...@googlegroups.com
On 2016-08-19, Montgomery-Smith, Stephen <ste...@missouri.edu> wrote:

> sage: integrate(y*e^(-y),y,0,t)
>
> Huge amount of error messages deleted, followed by:
>
> ValueError: Computation failed since Maxima requested additional
> constraints; using the 'assume' command before evaluation *may* help
> (example of legal syntax is 'assume(t>0)', see `assume?` for more details)
> Is t positive, negative or zero?

> However the integral is an analytic function, and exists even if t is
> negative or complex.

On looking into the source code, I see Maxima is trying to classify the
type of problem, and using asksign for that. Maxima can actually get the
result without resorting to asksign, but it doesn't try that first. The
relevant function, if anybody cares, is METHOD-BY-LIMITS in
src/defint.lisp.

I dunno if this is a bug. It is needlessly clumsy but not incorrect.

HTH in some way.

Robert Dodier

Dima Pasechnik

unread,
Aug 20, 2016, 2:29:34 AM8/20/16
to sage-support
I wonder why there is no attempt to compute the antiderivative first.

Emmanuel Charpentier

unread,
Aug 20, 2016, 3:33:07 PM8/20/16
to sage-support

No need to :

sage: integrate(y*e^-y,y,0,t,algorithm="sympy")

-(t + 1)*e^(-t) + 1


HTH,

--
Emmanuel Charpentier

Reply all
Reply to author
Forward
0 new messages