Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline gth802s  
#1 Posted : 01 December 2023 10:41:02(UTC)
gth802s


Rank: Member

Groups: Registered
Joined: 21/11/2023(UTC)
Posts: 24
United States

Was thanked: 2 time(s) in 2 post(s)
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 (418kb) downloaded 13 time(s).

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline mkraska  
#2 Posted : 01 December 2023 10:51:42(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
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 (418kb) downloaded 16 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 01/12/2023(UTC)
Offline gth802s  
#3 Posted : 01 December 2023 10:55:34(UTC)
gth802s


Rank: Member

Groups: Registered
Joined: 21/11/2023(UTC)
Posts: 24
United States

Was thanked: 2 time(s) in 2 post(s)
And there it is, easy as that Clap Thank you so much!

Originally Posted by: mkraska Go to Quoted Post
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 (418kb) downloaded 16 time(s).


thanks 1 user thanked gth802s for this useful post.
on 01/12/2023(UTC)
Offline Jean Giraud  
#4 Posted : 02 December 2023 07:35:02(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: gth802s Go to Quoted Post
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 (103kb) downloaded 7 time(s).
Offline gth802s  
#5 Posted : 02 December 2023 07:45:46(UTC)
gth802s


Rank: Member

Groups: Registered
Joined: 21/11/2023(UTC)
Posts: 24
United States

Was thanked: 2 time(s) in 2 post(s)
Thanks for sharing, looks like it will be useful!

Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: gth802s Go to Quoted Post
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 (103kb) downloaded 7 time(s).


Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.