# integral(abs(cos(x)),(x,0,pi))

this is for sure 2, however it evaluates to -1 !!! Is there anything wrong with the statement itself? Any suggestion?

add a comment

integral(abs(cos(x)),(x,0,pi))

add a comment

2

It is my understanding that Maxima has a difficult time with absolute values in integrals. You can get the answer using a numerical approximation via:

```
numerical_integral(abs(cos(x)),0,pi)
```

Or via `sympy`

you can use:

```
import sympy
print sympy.integrals.integrate(abs(cos(x)),(x,0,pi)).n()
```

Asked: **
2015-04-26 12:06:05 -0500
**

Seen: **464 times**

Last updated: **Apr 26 '15**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.