# [Maxima] Calculation of simple Integrals

Stefano Ferri ferriste at gmail.com
Wed Feb 11 07:38:14 CST 2009

```Maxima can't actually correctly handle signs of functions. In particular, this
happens when you try to bound a variable between two values and one of these
is %pi or %e. The sign of trigonometric functions remains unknown. Look at
this:

http://sourceforge.net/tracker/index.php?func=detail&aid=2477795&group_id=4933&atid=104933

Maxima isn't (for now) able to understand that sin(x) is positive if you bound
x between 0 and %pi, so your integral is reprinted as you typed it.

Stefano

In data mercoledì 11 febbraio 2009 14:11:29, Alexey Beshenov ha scritto:
: > On Wednesday 11 February 2009 15:48:37 Lorenzo Isella wrote:
> > (%i5) integrate(abs(sin(x)), x, 0 , %pi);
> >                                %pi
> >                               /
> >                               [
> > (%o5)                         I    abs(sin(x)) dx
> >                               ]
> >                               /
> >                                0
> >
> > So, it looks like that maxima (as expected!) has no trouble in
> > calculating definite integrals of simple trigonometric functions,
> > but if I add an absolute value, even if it has no effect on the
> > sinus in the selected interval, then it returns what (according to
> > some reading I did) stands for its inability of calculating the
> > integral analytically.
> > Why is that? Am I misunderstanding anything?
>
> integrate does not handle abs. abs(sin(x)) could be simplified to
> sin(x) in this case, but Maxima can't do it:
>
> (%i1) assume(x >= 0 and x <= %pi);
> (%o1) [x >= 0,x <= %pi]
>
> (%i2) sign(x);
> (%o2) pz
>
> (%i3) abs(x);
> (%o3) x
>
> (%i4) sign(sin(x));
> (%o4) pnz
>
> (%i5) abs(sin(x));
> (%o5) abs(sin(x))

```