I'm rather new to Mathematica having been a longtime Matlab user, so apologies if my question is framed incorrectly or I have missed out expected infomation. I have tried to distill the problem to the essentials.
Effectively I am trying to plot a a transformed distribution in a similar fashion to this example code:
data = RandomVariate[NormalDistribution[6, 5/3], 10^6];
Show[Histogram[data, Automatic, "PDF"],
Plot[PDF[NormalDistribution[6, 5/3], x], {x, 0, 14},
PlotStyle -> Thick]]
I have create a transformed distribution, sampled some data from it using RandomVariate and plotted it in a histogram.
hiod = 6.5/2;
transDistrib =
TransformedDistribution[hiod/Tan[theta*Degree],
theta \[Distributed] NormalDistribution[6, 5/3]];
dataTrans = RandomVariate[transDistrib, 10^6];
Histogram[dataTrans, {0, 80, 1}, "PDF", ImageSize -> Large ]
This works as expected (I have done the same thing in Matlab). However, the equivalent generation of a PDF fails (code just hangs and aborts).
Plot[PDF[transDistrib, x], {x, 0, 80}, PlotStyle -> Thick]
I get the distinct feeling I an making a terribly simple error, either in my basic coding or understanding of how to represent probability distributions in Mathematica.
Ultimately I would like to derive the equation for the transformed distribution, but I have stumbled at this earlier stage using Mathematicas inbuilt functions.
Any pointers to solving my error would be greatly appreciated. I'm using Mathematica 11.0.1 on macOSX Sierra.
hiod
? Here it is underfined, thereforeTransformedDistribution
also remains unevaluated. $\endgroup$Tan
as @NicholasG suggests is an issue. You don't have a simple one-to-one function. You should look up "wrapped normal" to see that when you restrict the angles you're feeding to your function to range from say 0 to $\pi$ radians (or 0 to 180 degrees), the resulting density of that random variable has an infinite number of terms. But because you'll then have a one-to-one function, you can likely get an algebraic form for the density of the transformed variable but it will almost certainly have an infinite number of terms. $\endgroup$