# Normal-like distribution over a bounded area

Is there a distribution that resembles the gaussian (normal) distribution, but such that it's probability density is nonzero only over a defined segment.

The question emerged when I tried to model the 'bullet spread' within a circle. Gaussian distribution works fine, but there is always a chance that the bullet would hit outside the circle. So I'd like to find a distribution very similar to Gaussian, but with property that the probability outside the defined segment (or circle) is zero.

EDIT: Yes, actually I mean a disk, not a circle. EDIT: And yes, I need only a one-dimensional distribution (along the radius of a disk) which will be circular-symmetrical (not dependent on angle).

• Here is a closely related question (though, perhaps, with less-than-satisfactory answers): math.stackexchange.com/questions/62003/… – cardinal Dec 24 '11 at 20:49
• It seems you are interested in distributions on a disk (as opposed to on a circle), though it's not clear why in your model a fired bullet could not fall outside of the disk. – cardinal Dec 25 '11 at 1:39
• It could be a model for what the distribution of bullets that actually fall on the disk look like. – Dason Dec 25 '11 at 5:43
• In my model, the disk represents the "hit zone" which shrinks if more time was spent for the "aiming". It would be very frustrating for a computer game player, for example, to have his shot fall outside the disk when them spent more time "aiming". – mbaitoff Dec 25 '11 at 6:32
• I just wanted to identify more closely your exact interest. Many times it is considerably easier to sample from a distribution than it is to work with it analytically. For example, in the truncated normal case, there is a simple way to sample (i.e., rejection sampling) which requires no knowledge or use at all of the normalization constant. (Though, better schemes may exist depending on the specific case at hand.) – cardinal Dec 25 '11 at 21:16

## 5 Answers

You could use a truncated normal distribution. It's just a normal distribution that you only consider an interval for. You need to rescale it to make sure that the pdf integrates to 1. But this sounds to me to be exactly what you're looking for.

• PDF of the truncated normal distribution is very complex. I wonder if I just "taper" the DPF of the normal distribution with some smooth window, like cosine taper, and rescale to obtain a unit integral? – mbaitoff Dec 25 '11 at 6:39
• @mbaitoff: In terms of sampling from a truncated distribution on a disk, that can be done quite readily by rejection sampling or other methods. If you want the distribution centered at the origin and circularly symmetric, then one only need sample from a single distribution (say, on the unit disk) and then rescale appropriately. – cardinal Dec 25 '11 at 17:11

The VonMises distribution is similar to the normal, but is used with circular data and is defined just on the interval of a circle (0-360 degrees, or 0-2pi radians).

The Beta distribution is defined from 0 to 1 (but could be scaled to other intervals), with the parameters equal it is symmetric and for many values bell shaped.

• These are good suggestions, particularly the von Mises, but it seems the OP is mostly interested in distributions on a disk of a given radius. – cardinal Dec 25 '11 at 1:40
• He could use the VonMises for the angle and the Beta for the radius. Either independent of each other, or the parameters of the beta could be dependent on the angle. – Greg Snow Dec 25 '11 at 5:44
• Perhaps I am mistaken, but it seems the OP is likely looking for something yielding a uniform phase distribution. The von Mises seems to be geared toward applications related to phase synchronization. It would seem a little strange for the phase of the bullet to be more likely to be zero, than, say, $\pi/2$, unless there was some bias in the mean location relative to the origin. That said, it's a nice feature that the uniform distribution is contained within the von Mises class. – cardinal Dec 25 '11 at 17:18
• Well, to get a uniform distribution within the circle, a uniform distribution on the angle coupled with a triangular distribution for the radius ought to work! – kjetil b halvorsen May 9 '17 at 16:49

This is an old question, but it's still relevant for new readers. I'm surprised that nobody mentioned the Raised Cosine distribution.

With mean $\mu$ and spread parameter $s$ it is perfectly bounded into $[\mu - s, \mu + s]$ and its probability density function (PDF) has a bell shaped curve as well.

• But does it have a two-dimensional version (in the plane)? – kjetil b halvorsen May 9 '17 at 16:48
• @kjetilbhalvorsen I don't know, but none of the answers here presented a multivariate solution. – plasmacel May 9 '17 at 16:56

+1 for the rejection-sampling answer.

Could you also sample from the Beta distribution where $\alpha$ (aka shape1) is 1 and $\beta \gt 1$ (aka shape2)? This is defined on [0,1], so multiply by the radius of the disc, and you'll have zero probability of selecting points at the radius or greater.

The upsides include: a) there's a zero probability of selecting a distance greater than or equal to the radius, and b) you can do straightforward sampling rather than things like rejection sampling.

The downsides include: a) it's fidgety close to 0 and b) the distribution is not "very similar" to the Gaussian. (It's much more peaked near 0 -- i.e. in the center -- than the Gaussian, though that might indeed be what the OP wants.)

It seems what is searched for is a uniform distribution on a disk, which I will take to be (the interior of) the unit circle. We can parametrize by $(r,\theta)$ so we have $0 \le r \le 1$ and $0 \le \theta \le 2\pi$. We can let $\theta$ have a uniform distribution, independent of $R$, and must find the distribution of $R$ that gives a uniform distribution on the circle. Since probability must be proportional to area, we have for $0 \le a \le b \le 1$ that $$\DeclareMathOperator{\P}{\mathbb{P}} \P(a\le R \le b) \propto \pi b^2 - \pi a^2$$ and taking $a=0$, $b=1$ gives $F_R(r)= r^2$. Then the density is the derivative $f_R(r)=2r$. The joint density of $R$ and $\theta$ then becomes $$f(r,\theta)=\frac1{2\pi}\cdot 2r = \frac{r}{\pi}$$ This is easy to simulate from, the sum of two independent uniforms have a triangular (and symmetric) distribution, sometimes described as a "tent" distribution. We only want the left part of the tent, which we can get by mirroring the distribution in a vertical line at the top (mode) of the tent. Simulating this in R gives: The R code for the simulation is:

set.seed(7*11*13)
rleft_tri  <-  function(n) {
T  <-  runif(n)+runif(n)
val  <-  ifelse(T <= 1,T, 2-T)
val
}

rdisk  <-  function(n)  {
val  <-  cbind(  rleft_tri(n),  2*pi*runif(n) )
colnames(val)  <-  c("R","Theta")
val
}

#

library(plotrix)
par(bg="antiquewhite")
points  <- rdisk(10000)         plot(c(-1,1),c(-1,1),type="n",axes=FALSE,xlab="",ylab="",xlim=c(-1.1,1.1),ylim=c(-1.1,1.1))
draw.circle(x=c(0,0),y=c(0,0),radius=1,col="aquamarine")
points(with(as.data.frame(points),cbind(R*cos(Theta), R*sin(Theta))),pch=".",col="red",cex=2)


Note that this is a special case of @Greg Snow's old answer, as the "left tent" distribution is a beta distribution with parameters $a=2, b=1$. But the above code for simulating it is probably faster than general code for simulating from a beta (or would be so if programmed in C).