2
$\begingroup$

I have a complicated large integral I want to evaluate (does not have a closed form, need an approximation), but Mathematica seems to keep "Running...". Is there any way to make Mathematica use more CPU power or anything to speed the calculations up?

The integral is the following:

Integrate[x (0.25 - x)^0.5*1/(Integrate[(1 - ((2 x/(1 - 2 x))*
  Cos[z])^2)^0.5, {z, 0, Pi}])*Sin[y]*
  (1 - ((2 x/(1 - 2 x))*Cos[y])^2)^0.5, {x, 0, 0.25}, {y, 0, Pi}]

Also, how long should I expect this to take?

Thank you for any help!

$\endgroup$
2
  • $\begingroup$ What do you expect the final answer to be? I got the final answer= 0.005459 $\endgroup$ Commented Jul 29, 2014 at 23:38
  • $\begingroup$ I'm expecting it somewhere between 0.005-0.007, so that is probably the correct value! How did you manage to get that? Did you just run the command the way I wrote it? $\endgroup$ Commented Jul 29, 2014 at 23:42

2 Answers 2

4
$\begingroup$

The whole integration is complicated and I can not get it once like you. I break it down as follows:

f = (1 - ((2 x/(1 - 2 x))*Cos[z])^2)^(1/2)

and then do normal unbounded integration

int1 = Integrate[f,z]

and then find the bounded integration by simply substitute the boundary values of z

int11 = (int1 /. z -> Pi) - int1 /. z -> 0

and then do the NIntegrate

NIntegrate[
 x (0.25 - x)^0.5*1/(int11)*
  Sin[y]*(1 - ((2 x/(1 - 2 x))*Cos[y])^2)^(1/2), {x, 0, 0.25}, {y, 0, 
  Pi}]
(*0.00545945*)
$\endgroup$
1
  • $\begingroup$ Perfect, thank you! $\endgroup$ Commented Jul 29, 2014 at 23:51
3
$\begingroup$

Using Assumptions and a little simple substitution do can directly do that inner integral:

 $Assumptions = {0 < x < 1/4};
 r1 = Simplify[ 
       Integrate[(1 - (xx*Cos[z])^2)^(1/2), {z, 0, Pi},
       Assumptions -> {0 < xx < 1}]  /. xx -> (2 x/(1 - 2 x)) ]

then it turns out you can do the integral over y analytically as well:

 r2 = Simplify[Integrate[ x (1/4 - x)^(1/2)/
    (r1) Sin[y] (1 - ((2 x/(1 - 2 x)) Cos[y])^2)^(1/2) , {y, 0, Pi }   ]]

enter image description here

finally...

 NIntegrate[ r2  , { x, 0, 1/4 }]  (* 0.00545945 *) 
$\endgroup$
2
  • $\begingroup$ +1 I kept thinking I was misreading the inner integral (aging eyes). I was surprised it didn't evaluate as is. Seeing your answer, I'm still surprised it does not evaluate. $\endgroup$
    – Michael E2
    Commented Jul 30, 2014 at 22:40
  • $\begingroup$ Do you think it's possible to get a closed form answer using this method? $\endgroup$ Commented Jul 31, 2014 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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