Hot answers tagged

11 votes
Accepted

How do you generate a random number with a pre-specified probability distribution?

...
user avatar
  • 348k
8 votes
Accepted

I want to count number of points inside the given shape

...
user avatar
  • 14.2k
6 votes
Accepted

While inside a function body does not work as expected

You may wish to disambiguate your description as it seems you're creating rational functions made up of polynomials. Below I modularized CreateDiscontinuityPoly ...
user avatar
  • 1,084
5 votes

How do you generate a random number with a pre-specified probability distribution?

Since your PDF already integrates to one over the range this is pretty straight-forward: ...
user avatar
  • 14.6k
2 votes

I want to count number of points inside the given shape

This exploits the simple nature of the regions and uses RegionMember: ...
user avatar
  • 55k
2 votes

I want to count number of points inside the given shape

With the following test data: SeedRandom[1]; data = RandomReal[{-2, 2}, {1000, 2}]; You may define a region using ...
user avatar
  • 23.9k

Only top scored, non community-wiki answers of a minimum length are eligible