Tag Info

New 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.


0

You can use Table, please check the documentation examples. I'd recommend going through some of the tutorials before taking on a bigger project in Mathematica. Table is one of the most basic constructs, usually covered in tutorials.


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 ...


0

There was some part of the model that could not be fully translated from Modelica to Mathematica. If you aren't seeing any further problems, it probably means the parts that couldn't be translated were in parameters you are not using for anything.



Top 50 recent answers are included