Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm afraid this is going to be a really stupid question.

Evaluating the following definite integral

Integrate[Sqrt[1 - (x^2 + y^2)], {x, -1, 1}, {y, -1, 1}]

gives

(2/3) (Pi - I (-2 + Log[4]))

I don't want the imaginary part. Adding the option

Assumptions -> x^2 + y^2 <= 1

doesn't work. What did I miss?

share|improve this question
    
You try to integrate Sqrt[1 - (x^2 + y^2)] over the region where the integrand becomes imaginary (for {x,y} outside the unit circle}), namely you're integrating over a square (-1,1) x (-1,1). –  Artes Jun 12 '13 at 13:07
add comment

1 Answer

up vote 7 down vote accepted

Good:

Integrate[Sqrt[1 - (x^2 + y^2)] Boole[x^2 + y^2 <= 1], {x, -1, 1}, {y, -1, 1}]

Better:

Integrate[r Sqrt[1 - r^2], {r, 0, 1}, {θ, -π, π}]

Vastly better:

2 π Integrate[r Sqrt[1 - r^2], {r, 0, 1}]

Exercise: why?

share|improve this answer
2  
Because in the polar coordinates the area outside the integration region is automatically avoided? –  Taiki Jun 12 '13 at 13:17
    
Good show. You're right, @Taiki. :) –  J. M. Jun 12 '13 at 13:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.