Suppose I want to generate a histogram of $n$ trials a slightly complicated random variable in Mathematica. Is there an easy way to do this?
For instance, to make a histogram of a normal variable one can simple use
Histogram[RandomVariate[NormalDistribution[0, 1], 200]]
I want to create a histogram of a more complicated random variable. The random variable comes from random matrix theory, but its specific form is probably not so important. If we call it X, running
Histogram[RandomVariate[X, 200]]
returns
RandomVariate::udist: "The specification X is not a random distribution recognized by the system." Indeed, even running
Histogram[RandomVariate[NormalDistribution[0, 1]^2, 200]]
returns this error message, and I think if I understood what's going wrong in this latter case my problem would be resolved also.
There is a Mathematica help page on the topic, but all the examples of random variables given there are for prepackaged probability distributions.
NormalDistribution[0, 1]^2
? It is square of the probability density function orx^2
wherex
distributed asNormalDistribution[0, 1]
?TransformedDistribution
,EmpiricalDistribution
andSmoothKernelDistribution
can be helpful. Could you provide an example of the distribution? $\endgroup$Histogram
is irrelevant to the question.NormalDistribution[0, 1]^2
is not correct syntax. As george said, look atProbabilityDistribution
. $\endgroup$Histogram
, you have a problem defining a distribution. Have a look at Create Your Own Distribution Workshop. $\endgroup$