# 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()
```

Please start posting anonymously - your entry will be published after you log in or create a new account.

Asked: ** 2015-04-26 19:06:05 +0200 **

Seen: **515 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.