[Maxima] Integration has problems with sums

Robert Dodier robert.dodier at gmail.com
Mon Jun 25 01:15:41 CDT 2007


On 6/22/07, Detlef Schmicker <d.schmicker at physik.de> wrote:

> (%i3) x^2*%e^(-x^2)*sin(x)^2+%e^(-x^2);
>                                   2                2
>                            2   - x     2        - x
> (%o3)                     x  %e     sin (x) + %e
> (%i4) integrate(%,x,-inf,inf);
>                      inf
>                     /               2                2
>                     [        2   - x     2        - x
> (%o4)               I      (x  %e     sin (x) + %e    ) dx
>                     ]
>                     /
>                      - inf

By default, Maxima does not treat integrate as linear,
probably because there are infinite series which cannot
be integrated term by term. However, for any finite sum,
the integral of the sum is the sum of the integrals, right?

So this is at least a pretty significant missed opportunity
on Maxima's part. Maxima developers: Yes/no?

With a linearity declaration I get the following.

(%i1) display2d : false;
(%o1) false
(%i2) declare (integrate, linear);
(%o2) done
(%i3) x^2*%e^(-x^2)*sin(x)^2 + %e^(-x^2);
(%o3) x^2*%e^-x^2*sin(x)^2+%e^-x^2
(%i4) integrate (%, x, -inf, inf);
(%o4) 'integrate(x^2*%e^-x^2*sin(x)^2,x,-inf,inf)
       +'integrate(%e^-x^2,x,-inf,inf)
(%i5) ''%, nouns;
(%o5) %e^-1*sqrt(%pi)*(%e+1)/4+sqrt(%pi)

Note that the linearity was applied too late in %o4.
Reevaluation (with nouns=true, sigh) yields the hoped-for result.

best
Robert Dodier


More information about the Maxima mailing list