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.

Suppose $Y = \sqrt{2T}\cos(U)$, $ 0 \le u \le \pi $, and $ 0 \le \cos^{-1}(\frac{y}{\sqrt {2t}}) \le \pi ) $, so $ -1 \le \frac{y}{\sqrt{2t}} \le 1 $, with all $ \mathbb{R}$. The iterated integral is $$ G(y)= P(Y \le y) =P(\sqrt{2T}\cos(U) \le y)=\int_{0}^{y}\int_{0}^{\cos^{-1}(\frac{y}{\sqrt {2t}})} \frac{e^{-t}}{\pi } \mathrm{d}u \mathrm{d}t$$

My Mathematica code is

Integrate[((E^-t)/(\[Pi])), {u, 0,  ArcCos[y/((2 t)^(1/2))]}, 
 Assumptions -> 
  0 <= u <= \[Pi] && -1 <= ArcCos[y/((2 t)^(1/2))] <= 1 && 
   Element[t, Reals] > 0]

Integrate[%, {t, 0, y}, 
 Assumptions -> -1 <= ArcCos[y/((2 t)^(1/2))] <= 1 && 
   Element[t, Reals] > 0]

but then Mathematica never seems to finish evaluating the second one, and so I have to Abort it. Is there any way to find this as a function of $y$? $G(y)$ is a CDF of $Y$.

share|improve this question
Just to make sure, your original expression under the integral is independent of u ? If this is the case, you don't really have to write the whole thing as a double integral. The result of inner integration is obvious - it's just the upper limit. –  Vitaliy Kaurov Sep 6 '12 at 4:43
Yes, it is independent of $u$. That's a good point, I will just need to make sure it would be valid for this problem, and should have included that $Y = \sqrt{2T}\cos(U)$, and will do so now. –  Identity Sep 6 '12 at 4:55
How can you satisfy $ -1 \le \frac{y}{\sqrt{2t}} \le 1 $ when t is close to zero ? –  b.gatessucks Sep 6 '12 at 5:47
@b.g is right: executing Plot[ArcCos[1/Sqrt[2 t]], {t, 0, 1}] will immediately show that the inverse cosine is not even defined for sufficiently small values of $t$. The difficulty is that this problem--which appears to compute a probability by integration (assuming $T$ and $t$ are the same)--plays fast and loose with inverse trig functions and suffers accordingly. The solution is to re-solve the problem to generate an integral without the inverse cosine. –  whuber Sep 6 '12 at 15:28

2 Answers 2

up vote 2 down vote accepted

Your second integral:

f[y_?NumericQ] := NIntegrate[E^-t ArcCos[y/Sqrt[2 t]]/ Pi, {t, y ^2/2, y}]

Plot[f[x], {x, 0, 2}]

Mathematica graphics

share|improve this answer

I think what you mean in your second integral is the integral between y^2/2 and \[Infinity]:

Integrate[(E^-t ArcCos[y/(Sqrt[2] Sqrt[t])])/\[Pi], {t, 1/2 y^2, \[Infinity]}]

It is returned unevaluated by Mathematica:

(* $\int_{\frac{y^2}{2}}^{\infty } \frac{e^{-t} \text{ArcCos}\left[\frac{y}{\sqrt{2} \sqrt{t}}\right]}{\pi } \, dt$*)

Therefore, let's change the integration variable such that

y/Sqrt[2t ]->z, 
i.e. t -> (y^2/z^2)/2, dt -> - y^2/z^3 dz, t = {y^2/2, \[Infinity]} -> z = {1,0}.

The resulting integral is then readily solved analytically by Mathematica:

f[y_] = y^2 Integrate[(1/\[Pi]) (1/z^3) ArcCos[z] Exp[-y^2/(2 z^2)], {z, 0, 
    1}, Assumptions -> y > 0]

(* 1/2 Erfc[y/Sqrt[2]] *)

Hope this helps. Best regards, Wolfgang

share|improve this answer
@ NN? please identify yourself and explain why when you downvalue an answer. Mine had already 2+ votes. Thank you. –  Dr. Wolfgang Hintze 7 hours ago

Your Answer


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.