Ask Your Question
0

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

asked 9 years ago

Vangelis gravatar image

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 9 years ago

calc314 gravatar image

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()
Preview: (hide)
link

Comments

thanks

Both of your suggestions work!!!

Vangelis gravatar imageVangelis ( 9 years ago )

@Vangelis: you can mark the answer as accepted: click the check mark on the left.

slelievre gravatar imageslelievre ( 9 years ago )

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 9 years ago

Seen: 1,165 times

Last updated: Apr 26 '15