I have a problem that I can't seem to figure out on my own due to limited knowledge of mathematics, and I was hoping I could seek help from the community. I would like to use LogNormalDistribution
to generate random variables bound by min and max. I fail to do so, and I believe it is due to the way I derive Mean
and StandardDeviation
. Here is a simplified version of what I want to achieve but using a UniformDistribution
instead.
size = 10^4;
bound = {10^-7, 10^-4};
NumberLinePlot @ Interval @ bound
Histogram @ RandomVariate[UniformDistribution @ bound, size]
Based on the above, I can generate random numbers using an UniformDistribution
. I have tried to derive a PDF
for the above. However, it fails with an error message. Note, I use Win10 and Mathematica 11 for this work.
Show[
Histogram[
RandomVariate[UniformDistribution @ bound, size],
30,
"PDF"
],
Plot[
PDF[UniformDistribution @ bound, x],
{x, bound}
]
]
Skeleton is not a Graphics primitive or directive.
What I would like to be able to do is generate random numbers within a pre-defined boundary using a LogNormalDistribution
. I have tried to achieve it by exploring Mean
and StandardDeviation
functions. However, I fail to achieve the desired outcome. In terms of the Mean
, I would like it to remain sloped to the left towards the min. However, it can be anywhere within the first 15% of the CDF
.
I do appreciate your help, and thank you for your willingness to assist me with the above.
EDIT 1 - PDF
Fix for the above example, based on @kglr contribution
Show[
Histogram[
RandomVariate[UniformDistribution@bound, size],
30,
"PDF"
],
Plot[
PDF[UniformDistribution@bound, x],
{x, ## & @@ bound}
]
]
Show[Histogram[RandomVariate[UniformDistribution@bound, size], 30, "PDF"], Plot[PDF[UniformDistribution@bound, x], {x, ## & @@ bound}]]
? $\endgroup$Plot[function[x], {x, a, b}]
notPlot[ function[x], {x, {a,b}}]
(this is what you have in your code).{x, ##&@@round}
(or, equivalently,{x, Sequence @@ round}
) gives{x, 10^-7, 10^-4
} which is the formPlot
wants in its second argument. $\endgroup$