Tag Info

Hot answers tagged

5

For loop is always slow. You may try this: f = Compile[{{x, _Real}, {y, _Real}}, If[y >= 12. Cos[x] && y >= 10 + x^3, 1, 0]]; vol[n_Integer /; n <= 10^6] := 3.* Total[f@@@Transpose@{RandomReal[{0, 1}, n], RandomReal[{10, 13}, n]}]/n; The calculation of 1000000 samples takes 1.1 s on my i5-3210M.


1

Based on the comments appended to the question, I believe that what you are looking for is: mvBeta[myrating, #, myR] & /@ RandomReal[{0,1},100] where you can change 100 to be any length vector you like, and myrating and myR have already been defined.


1

Using ManToGif by Vitaliy Kaurov ManToGif[man_, name_String, step_Integer] := Export[name <> ".gif", Import[Export[name <> Which[$OperatingSystem == "MacOSX", ".mov", $OperatingSystem == "Windows", ".avi"], man], "ImageList"][[1 ;; -1 ;; step]]]; Now write SetDirectory[NotebookDirectory[]]; r = 1; backgroundAxes ...



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