Skip to main content
7 votes

How to use Mathematica to find the maximum expected value of multiple normal distributions?

This is only a partial answer in that it only provides the means for $n=2$ through $n=5$. With $n>6$ Mathematica only returns the input. ...
JimB's user avatar
  • 41.8k
6 votes

Why is random sampling with ordinary and compiled code so different?

Your hackery way of injection function definitions into Compile is the root of your troubles. Observe the output of the following code: ...
Domen's user avatar
  • 26.3k
4 votes

How can I generate a random number within a function and use the result repeatedly in the same function?

You have to generate your random index only once, for example using With (or Module): ...
Domen's user avatar
  • 26.3k
1 vote

Apply RandomReal to list in list in Mathematica

SeedRandom[1]; lst = {{1, 1, 1}, {1, 1}, {1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1}}; rlist = RandomReal[1, Length@Flatten@lst]; Internal`CopyListStructure[lst, rlist] ...
Syed's user avatar
  • 55.4k

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