4
$\begingroup$

A very simple and direct question, I know. But there are, in my view, surprisingly few simple and direct answers on the net.

My question is, suppose I have the following equation $Y = 1/(C-(A-B))$ and $B$ is a random variable that follows the Normal distribution, say. How do I:

1: Use Mathematica to obtain the equation for $Y$?

2: Find the mean of the equation found in 1.

$\endgroup$
  • $\begingroup$ I don't understand the question. It seems $Y=1/B$. Perhaps show how'd you work it out by hand to clarify. $\endgroup$ – Szabolcs Jul 16 '18 at 13:16
  • $\begingroup$ @Szabolcs The equation simplifies, to 1/B. I will change it slightly to make it a little more useful. $\endgroup$ – user120911 Jul 16 '18 at 13:21
  • 1
    $\begingroup$ Maybe you want TransformedDistribution and Mean. $\endgroup$ – Szabolcs Jul 16 '18 at 13:21
  • $\begingroup$ Note that Mean won't work here as this particular $Y$ has no mean (doesn't converge). $\endgroup$ – Szabolcs Jul 16 '18 at 13:22
  • $\begingroup$ Perhaps in your item 1, you mean you wish to "obtain the distribution of $Y$", where you could be more specific: do you want an PDF? CDF? other means of representing the distribution of $Y$? For your item 2, since a mean need not exist, what sort of answer do you expect when the mean does not exist? $\endgroup$ – Eric Towers Jul 16 '18 at 18:52
11
$\begingroup$

Look up TransformedDistribution.

dist = TransformedDistribution[1/(b + 1), b \[Distributed] NormalDistribution[]]

enter image description here

PDF[dist, x]

enter image description here

You can use RandomVariate to sample or Mean to compute the mean. Note that this particular distribution has no mean though (so the calculation will fail).

$\endgroup$
  • $\begingroup$ While the Mean cannot be evaluated, the Median can and evaluates to 1/(1 - Sqrt[2]*InverseErf[ -1 + Erf[1/Sqrt[2]]]) or approximately 0.709826. You can also evaluate the modes with the primary mode at 1/2 and the secondary mode at -1 $\endgroup$ – Bob Hanlon Jul 16 '18 at 16:20
2
$\begingroup$

I'm not clear what you are after. You have given an equation for Y and you are asking to use Mathematica how to obtain the equation for Y. Why would you need to get as output what you have just specified using input?

If you mean that you want to simplify the equation, isn't this simply Y=1/B?

I think when you ask to find the mean of the equation, you mean that you want it expressed in terms of B. This isn't specifically a Mathematica problem.

There seems to be some interesting material elsewhere on StackExchange - look here:

https://stats.stackexchange.com/questions/80874/expectation-of-reciprocal-of-a-variable

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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