Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this exponential function, where j is unknown. How can I plot the variance function for $k= 0.1, \; 1, \;10$

$$f_{j,k}(y)=\frac{\sqrt{j}}{\sqrt{2 \pi}}e^{\sqrt{jk}}y^{-\frac{1}{2}} \text{exp}\left( -\frac{1}{2} (j y + \frac{k}{y}) \right) \quad \quad y>0$$

share|improve this question
Please at least write your function in Mathematica syntax. And if possible, tell us what have you tried. – Dr. belisarius Nov 29 '13 at 20:11

Assuming that given function is a PDF of a distribution:

f[y_, j_, k_] := Sqrt[j]/Sqrt[2 Pi] Exp[Sqrt[j k]]/Sqrt[y] Exp[-(1/2) (j y + k/y)];

You can create an object that will represent your distribution:

distr = ProbabilityDistribution[{"PDF", f[y, j, k]}, {y, 0, Infinity}, 
                                               Assumptions -> (j > 0 && k > 0)];

And now you can calculate anything you want:

(*(2 + Sqrt[j k])/j^2*)
CentralMoment[distr, 3]
(*(8 + 3 Sqrt[j k])/j^3*)
share|improve this answer
Great! But how will you plot the variance function from here?? – Jens Jensen Nov 30 '13 at 8:19
Sorry, I don't know what is "variance function". If you tell me I will try to help. – Kamov Sergey Nov 30 '13 at 8:29
The Variance[distr] is the variance function. However, I found out how to do it. Very simple of course. Thank you for the help. Problem solved. – Jens Jensen Nov 30 '13 at 8:45
@Karnov Sergey I have some few close related questions related to this topic. Can we start a chat, or email conversation? This was very helpful for me. – Jens Jensen Nov 30 '13 at 8:51
@JensJensen I think if you have another question you better post it here. Another users probably will find it useful. – Kamov Sergey Nov 30 '13 at 9:43

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.