Tag Info

New answers tagged

4

RandomVariate for BinomialDistribution[n,p] changes between methods depending on the value of Min[n*{p,1-p}]. What we're seeing here is that one of those methods is poorly optimized. Because of this thread, we've made some improvements which should improve speed when Min[n*{p,1-p}]<10. These will be in the next release of Mathematica. We'll also ...


5

I get on Mathematica 10.2, Ubuntu 14.04 In[10]:= Map[{First[ Timing[Do[ RandomVariate[BinomialDistribution[10 #, 1/#]], {100}]]], First[Timing[ Do[RandomVariate[ BinomialDistribution[10 #, 1/(# + 1)]], {100}]]]} &, {1500, 3000, 5000, 10000}] Out[10]= {{0.023484, 2.37428}, {0.012502, 6.22335}, {0.013843, 12.4218}, ...


5

Please edit with your results: MMa 10.0.0.0, Windows 8.1 – Sektor {0.015625, 0.03125}, {0.`, 0.0625}, {0.`, 0.125}, {0.`, 0.`}} MMa 10.0.0.0 through MinGW & mintty, Windows 8.1 – Sektor {0., 0.03125}, {0., 0.0625}, {0., 0.125}, {0., 0.}} MMA 10.2, Ubuntu 12.04 - blochwave {0.03, 0.1, ...


9

The polygon of interest is state = Entity["AdministrativeDivision", {"Illinois", "UnitedStates"}]; (polygon = state["Polygon"]) // Short (* Polygon[GeoPosition[{{{36.9821, -89.1329}, <<187>> ,{36.9821, -89.1329}}}]] *) however that expression is not a valid region RegionQ[polygon] (* False *) because the argument of Polygon[] is not a ...


14

After some amount of effort, I managed to come up with an implementation of O'Neill's "XSH-RR" family of permuted congruential generators. The following covers the 8-, 16-, 32-, and 64-bit generators, and the mcg, oneseq, and setseq variants. (I'll leave the modification to handle the unique variant as an exercise for the interested reader.) A similar ...


13

I just followed through with the tutorial "Defining Your Own Generator". Start with provided, a little tweaked functions. The key trick is to ensure that the bit-expandable Mathematica integers are of the size of relative machine unsigned integers. I use BitAnd with mask to accomplish that: pcgRandomR[state_, inc_] := Module[{ newstate, xorshifted, rot, ...


2

It would seem that if only a Method is given and it does not change what is already set that the seed is not randomized: Table[ SeedRandom[Method -> "ExtendedCA"]; SeedRandom[1]; SeedRandom[Method -> "ExtendedCA"]; RandomInteger[10, 10] , {3} ] {{1, 4, 0, 7, 0, 0, 8, 6, 0, 4}, {1, 4, 0, 7, 0, 0, 8, 6, 0, 4}, {1, 4, 0, 7, 0, 0, 8, 6, 0, 4}} ...


2

As long as you use Set (m =) rather than SetDelayed (m :=) the matrix will not be given new values unless you reevaluate the definition of m. SeedRandom[1]; Clear[m] m = RandomReal[{0, 1}, {2, 2}] {{0.817389, 0.11142}, {0.789526, 0.187803}} m {{0.817389, 0.11142}, {0.789526, 0.187803}} m {{0.817389, 0.11142}, {0.789526, 0.187803}} m ...


4

As noted in the comment by WRI staff, this is indeed a bug in the interplay between RandomVariate and the distribution at hand. The obvious workaround for now is to use UniformDistribution[{μ - Pi, μ + Pi}] for zero-concentration cases.


7

To me this looks like a bug. A possible workaround is to use ProbabilityDistribution together with the PDF of the VonMisesDistribution: SeedRandom[1] RandomVariate@ProbabilityDistribution[PDF[VonMisesDistribution[0, 0], x], {x, -∞, ∞}] $\ $ 1.99422 This bug is caused by the evaluation of Statistics`NormalDistributionsDump`compiledvonmisesrandom[0, 0, ...


2

The random functionality within Mathematica is all of a pattern: RandomFunction[range, outputStructure] where range depends on what RandomFunction you are using, e.g. for RandomInteger and RandomReal it is {min, max} and they both default to {0,1} if no min/max are supplied. The outputStructure tells the RandomFunction how many random numbers you want and ...


0

FYI, the random points being generated will serve as coordinate centers for randomly oriented molecules. We can generate the molecules onto the random points in region1. We want each molecule to have a random orientation so we need to do rotational transformations before we translate the molecule to its new point teosPEO := Table[ ...


0

Seems like this is an issue, thanks for looking into this @bbgodfrey. I went ahead and created four regions and got rid of the upper/lower z-bounds by increasing to -20<=z<=20. region1 is what I want, region2 through region4 are for testing. region1 is the original region that I want bounded by equation1, x, y, and two planes 6<=x-y+2*z<=7 ...



Top 50 recent answers are included