5
$\begingroup$

Im new to Mathematica, and I have been searching online without success an answer to what should be an easy question. I want to define a function $f$ on, say, $n$ independent random variables and compute statistics about $f$ (such as expected value and variance).

Say I have a matrix $m=\{\{a,b,c\},\{b,d,f\},\{c,f,e\}\}$ and I compute Det[m]. I will get a function on these variables. I want to say they are Bernoulli 0 - 1 with probability $p$. Is there a way I can do this?

$\endgroup$
1
  • 1
    $\begingroup$ The answer is "Yes". The "how" depends on what you want to do next with the Det $\endgroup$ Commented Feb 7, 2016 at 23:08

1 Answer 1

6
$\begingroup$

For example:

xa = Array[x[Sort@{##}] &, {3, 3}];
k  = TransformedDistribution[Det@xa, 
           Thread[Union@Flatten[xa] \[Distributed] BernoulliDistribution[1/2]]];
MatrixForm@xa

Mathematica graphics

And then

Probability[x > 1/4, x \[Distributed] k]
Variance[k]
Expectation[x, x \[Distributed] k]

(*
5/64
35/64
-(3/8)
*)
$\endgroup$
3
  • 1
    $\begingroup$ @DanielMontealegre I don't follow what you mean by your comment about a symmetric matrix. Could you perhaps edit your original question to include more details on your intended use? Otherwise it seems to me that Belisarius showed how you could accomplish what you originally asked. $\endgroup$
    – MarcoB
    Commented Feb 8, 2016 at 0:23
  • 1
    $\begingroup$ @MarcoB If you look at the definition of $m$ in the question ... I overlooked it also at first :) $\endgroup$ Commented Feb 8, 2016 at 0:36
  • 1
    $\begingroup$ Ha! I had misread / misunderstood the question. I see now what Daniel meant now. $\endgroup$
    – MarcoB
    Commented Feb 8, 2016 at 3:35

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.