Speeding up calculation time for Monte Carlo simulations

Speeding up calculation time for Monte Carlo simulations - Poruke

#1 Objavljeno: 1. 12. 2023. 04:41:02
Fikret Atalay

Fikret Atalay

2 svidjanja u 24 postova.

Grupa: User

Hi all, I don't even know if this is possible, but I figured I would ask anyways to see if someone might know any tricks.

I wrote a worksheet to show my students an example of a method for making probabilistic calculations of a parameter instead of using deterministic methods. The probabilistic calculation using Monte Carlo simulation lends itself to calculating probability of failure, which is a nice way of explaining system reliability.

Ideally, one would run a large number of simulations so that the result converges. However, it seems like the matrix calculations (or at least the way I am doing them) are quite slow, and when I assign a meaningful number of trials (say, 1000 or more), it takes the worksheet forever to calculate. I can do the same in Excel and it is almost instantaneous to do even 10000 or 20000 trials, but I hate doing these in Excel since I can show the work and the equations much more easily with SMath.

Any suggestions on what might speed up the run-time? The worksheet is attached for reference.

Thanks!
FT

Correlated Normal Variables - Bearing Capacity Example.sm (417,53 KiB) preuzeto 1641 put(ova).
#2 Objavljeno: 1. 12. 2023. 04:51:42
Martin Kraska

Martin Kraska

1.369 svidjanja u 2.283 postova.

Grupa: Moderator

You just have to switch all cells to numeric optimization (Ctrl A to select everything, right mouse button on any cell, select Optimization> Numeric

Then, with 10000 tries it took a couple of seconds on my 6 years old notebook.

Correlated Normal Variables - Bearing Capacity Example_Kr.sm (417,97 KiB) preuzeto 1641 put(ova).
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
1 korisnika je svidelo ovu objavu
sergio 1. 12. 2023. 17:43:00
#3 Objavljeno: 1. 12. 2023. 04:55:34
Fikret Atalay

Fikret Atalay

2 svidjanja u 24 postova.

Grupa: User

And there it is, easy as that Thank you so much!

Wrote

You just have to switch all cells to numeric optimization (Ctrl A to select everything, right mouse button on any cell, select Optimization> Numeric

Then, with 10000 tries it took a couple of seconds on my 6 years old notebook.

Correlated Normal Variables - Bearing Capacity Example_Kr.sm (417,97 KiB) preuzeto 1641 put(ova).



1 korisnika je svidelo ovu objavu
sergio 1. 12. 2023. 17:43:00
#4 Objavljeno: 2. 12. 2023. 01:35:02
Jean Giraud

Jean Giraud

983 svidjanja u 6.866 postova.

Grupa: User

Wrote

Any suggestions on what might speed up the run-time? The worksheet is attached for reference.


The attached document runs Monte-Carlo in two styles.
1. Logistic style 4 s
2. Ordinary style 0.7 s
Observe eval(,)
Jean

Stat Monte Carlo [rlogis] Copy 2.sm (102,24 KiB) preuzeto 1374 put(ova).
#5 Objavljeno: 2. 12. 2023. 01:45:46
Fikret Atalay

Fikret Atalay

2 svidjanja u 24 postova.

Grupa: User

Thanks for sharing, looks like it will be useful!

Wrote

Wrote

Any suggestions on what might speed up the run-time? The worksheet is attached for reference.


The attached document runs Monte-Carlo in two styles.
1. Logistic style 4 s
2. Ordinary style 0.7 s
Observe eval(,)
Jean

Stat Monte Carlo [rlogis] Copy 2.sm (102,24 KiB) preuzeto 1374 put(ova).



  • Novi postovi
  • Nema novih postova