How can I evaluate a certain probability density function?

The PDF of a random variable XX is given by

Note that H(t)H(t) is also a function of xx. Here −∞<μ<∞-\infty<\mu<\infty, λ>=0\lambda>=0 and m>=1/2m>=1/2

Let II be a function of random variable YY.

I need to evaluate


How do I do it? I tried the following:

Lets say N=10N=10 and TT and WW vectors are given by

Am I doing it right.?




What have you tried? Please provide copy-paste-able Mathematica code in your question so that you have higher chances to receive help. Right now this looks like “do this for me, although I haven’t tried anything“. Nevertheless, NIntegrate should be useful…
– Lukas
May 1 at 9:17



Integrate will work, too. Look up Sum and/or Dot for the summation.
– Michael E2
May 1 at 11:36



@MichaelE2, Thanks for your comment. Please havea look at the edit. How to express the multiplication in the summation?
– Srestha Narayanan
May 1 at 11:54



f[x_] := 2*m^m*x^(2*m – 1)/(Sqrt[\[Pi]]*Gamma[m])*W.(H /@ T) Also, TransformedDistribution outputs a distribution not a PDF. You cannot reuse f as the name of a second function. The PDF would be pdfY[y_]:=PDF[dist, y]. You need to add some assumptions/constraints on parameters and x to evaluate the integral.
– Bob Hanlon
May 1 at 15:42



@BobHanlon, Thank you very much for your very useful comment. I have edited my MMA code. Is it okay now?
– Srestha Narayanan
May 1 at 16:01


1 Answer


It is certainly not required but usually one writes a weighted sum of probability density functions where the sum of the weights equals 1. In your example the sum of the weights is √π\sqrt{\pi}. One can rewrite the pdf of XX as

fX(x)=2mmx2m−1Γ(m)n∑i=1wih(ti)f_X(x)={{2m^m x^{2m-1}}\over{\Gamma(m)}}\sum_{i=1}^n w_i h(t_i)

with ∑ni=1wi=1\sum_{i=1}^n w_i=1. This makes it more explicit that each of the weighted pdf’s is indeed a legitimate pdf:

∫∞02mmx2m−1Γ(m)h(ti)dx=1\int_{0}^{\infty}{{2m^m x^{2m-1}}\over{\Gamma(m)}}h(t_i)dx=1

As a check here is the Mathematica code:

g[x_] := (2 m^m x^(2 m – 1)/Gamma[m])
Exp[-m (2^(1/2) λ t + μ + x^2 Exp[-2^(1/2) λ t – μ]) ]

Integrate[g[x], {x, 0, ∞}, Assumptions -> {a > 0, t ∈ Reals, λ > 0, μ > 0, m > 1/2}]
(* 1 *)

Because we have a weighted sum of nice pdf’s we can write

∫∞√afX(x)dx=n∑i=1wi∫∞√a2mmx2m−1Γ(m)h(ti)dx=n∑i=1wiΓ(m,ame−√2tiλ−μ)Γ(m)\int_{\sqrt{a}}^{\infty}f_X(x)dx=\sum_{i=1}^{n}w_i \int_{\sqrt{a}}^{\infty}{{2m^m x^{2m-1}}\over{\Gamma(m)}}h(t_i)dx=\sum_{i=1}^{n}w_i{{\Gamma(m,a\,m\, e^{-\sqrt{2}t_i \lambda-\mu})}\over{\Gamma(m)}}

(I say “nice pdf” to avoid me messing up any discussion of switching the order of integration and summation.) You want Pr(Y>a)=Pr(X2>a)=Pr(X>√a)Pr(Y>a)=Pr(X^2>a)=Pr(X>\sqrt{a}) (because the only positive support is where X≥0X \ge 0). (The numerator in the final sum above is the incomplete gamma function.)



Thanks for your answer and nice explanation. However, I just have one comment. fX(x)f_X(x) is the PDF of random variable XX. If YY is a random variable where Y=X2Y=X^2, what about the PDF fY(y)f_Y(y)? Is it okay just to modify the integration limits? Don’t we need to transform the PDF?
– Srestha Narayanan
May 2 at 4:30



That sounds like a separate question. But you have everything above to determine the pdf of YY. FY(y)=Pr(Y≤y)=1−Pr(Y>y)F_Y(y)=Pr(Y \le y)=1-Pr(Y>y). And fY(y)f_Y(y) is just the derivative of that.
– Jim Baldwin
May 2 at 4:35



In fact, It is a part of my question. My ultimate aim is to find the PDF fY(y)f_Y(y) where YY is a random variable with Y=X2Y=X^2. Would you please help me to find that.
– Srestha Narayanan
May 2 at 4:51



Why did you assume t>0t>0 in your assumptions?
– Srestha Narayanan
May 2 at 5:52



Sorry. I shouldn’t have assumed t>0t>0. I guess I was just on a roll with such >0>0 assumptions. I’m sure that assumption isn’t necessary. I’ll check that out tomorrow.
– Jim Baldwin
May 2 at 6:27