[SciPy-User] random points within an ellipse

Mark McClure mcmcclur@unca....
Thu Aug 5 23:48:22 CDT 2010

On Wed, Aug 4, 2010 at 8:18 PM, alex <argriffi@ncsu.edu> wrote:
> On Wed, Aug 4, 2010 at 7:38 PM, Benjamin Root <ben.root@ou.edu> wrote:
>> For a project, I need to create sets of random coordinates within a 2d
>> domain.  To start, I have been creating random x and y coordinates, which
>> has worked very nicely.  However, I would like to start doing some fancier
>> domains like ellipses and crescents.
> For an ellipse you could start with random points in a disk like this
> http://mathworld.wolfram.com/DiskPointPicking.html
> and then I think you can just stretch along an axis to give the points
> inside the ellipse disk.

This is definitely the way to go for an ellipse.  Essentially, this
works because the determinant of the Jacobian of the underlying
transformation is constant.  Given a parametrized domain with
non-constant Jacobian determinant, it may be possible to re-scale the
parametrization to one with constant Jacobian determinant.  Finding
such a rescaling essentially boils down to solving differential
equations.  If you are interested, I set up a Sage notebook that
illustrates a few such examples:

Mark McClure

More information about the SciPy-User mailing list