1
$\begingroup$

I have the following MMA code. Note that the function I declared at the very beginning is the PDF of square of a Nakagami Distributed random variable. With $m=1$ and $P=1$, $f(h)$ becomes Exponential Distribution with rate parameter 1, i.e., ExponentialDistribution[1]

$\endgroup$
3
  • $\begingroup$ Expectation expects a probability distribution but f[h] is not a probability distribution in the eyes of Expectation. Type 'Head[f]` and the result will be Symbol rather than TransformedDistribution or some other type that is requred. $\endgroup$
    – JimB
    Commented Apr 26, 2016 at 15:03
  • $\begingroup$ @JimBaldwin, Thanks for your suggestion. Did you mean to put : h[Distributed] Head[f]? If yes, then I did it and the problem is still there... $\endgroup$ Commented Apr 26, 2016 at 15:28
  • $\begingroup$ No. See extended comment below. $\endgroup$
    – JimB
    Commented Apr 26, 2016 at 17:11

2 Answers 2

4
$\begingroup$

A PDF is not a distribution. To convert a PDF to its associated distribution use ProbabilityDistribution

Clear[λ, pb, Ps, μ]

f[h_] := 1/Gamma[m]*(m/P)^m*h^(m - 1)*Exp[-(m*h)/P];
m = 1; P = 1;

α = 4; δ = 2/α;

int = Assuming[{A > 0, r > 0, λ > 0}, 
  Integrate[(1 - Exp[-x*h*r^(-1/δ)])*pb*λ*π, {r, A, 
    Infinity}, GenerateConditions -> False]]

(*  -pb π r λ - (pb π^(3/2) λ Erfc[r Sqrt[h μ]])/(
 2 Sqrt[h μ])  *)

LI = Assuming[{A > 0, r > 0, λ > 0, x > 0}, 
  Exp[-Expectation[int, 
      h \[Distributed] ProbabilityDistribution[f[h], {h, 0, Infinity}]]] // 
   FullSimplify]

(*  E^(pb π λ (r + ArcCot[r Sqrt[μ]]/Sqrt[μ]))  *)

Note that this is the same result obtained with h\[Distributed]ExponentialDistribution[1]

LI === Assuming[{A > 0, r > 0, λ > 0, x > 0}, 
  Exp[-Expectation[int, h \[Distributed] ExponentialDistribution[1]]] // 
   FullSimplify]

(*  True  *)

x = s*Ps; A = r;
M = LI;

s = μ*r^α/Ps; B = M;

λ = 4; pb = 1/2; Ps = 19.9526; μ = 1.2589;

AverageProbSuccess[B_, λ_] := 
 NIntegrate[B*2*π*λ*r*Exp[-π*λ*r^2], {r, 0, Infinity}]

AverageProbSuccess[B, λ]

(*  0.8346  *)
$\endgroup$
3
$\begingroup$

This is an extended comment. f[h] as defined while clearly a probability density function is not of the type of function that Expectation expects. Consider the difference between the two functions f and g below:

f[h_] := 1/Gamma[m]*(m/P)^m*h^(m - 1)*Exp[-(m*h)/P]

(* Head *)
Head[f]
(* Symbol *)

(* PDF *)
f[h]
(* (E^(-((h m)/P)) h^(-1 + m) (m/P)^m)/Gamma[m] *)

(* Mean *)
Integrate[h f[h], {h, 0, ∞}]
(* ConditionalExpression[P, (Re[m] != 0 || m ∉ Reals) && 1 + Re[m] > 0 && Re[m/P] > 0]  *)

And now g

g := ProbabilityDistribution[1/Gamma[m]*(m/P)^m*h^(m - 1)*Exp[-(m*h)/P],
{h, 0, ∞},
Assumptions -> {m > 1, P > 0}]

(* Head *)
Head[g]
(* ProbabilityDistribution *)

(* PDF *)
PDF[g, h]
(* Piecewise[{{(h^(-1 + m)*(m/P)^m)/(E^((h*m)/P)*Gamma[m]), h > 0}}, 0] *)

(* Mean *)
Expectation[h, h \[Distributed] g]
(* P *)
$\endgroup$

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.