cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

## Re: Rnd in Mathcad

Thanks for the insights and the interesting article.

I think we see the behaviour of the Monte Carlo simulation you described pretty well if we go up to 10^7 points like in the videos (Valery needs animations ) here:

Logarithmic scale: http://communities.ptc.com/videos/4532

Linear scale: http://communities.ptc.com/videos/4533

## Re: Rnd in Mathcad

 Werner Exinger wrote:Thanks for ... the interesting article.

At first I was thinking that these words are about my article "Tripartite duel in Monte Carlo"

## Re: Rnd in Mathcad

Sorry, my zero knowledge of Russian language prevents me from commenting on your article.

My post was a reply to Alan's.

After all this thread is about your Monte Carlo simulation which in your opinion is too slow or not at all improving and about Mathcad's random number generator which you thought is responsible for this.

Alans remarks clarified that what you see in your simulations is just normal behaviour and that you will have to increase the number of trials significantly to see a small improvent and the article he referred to is a good one and worth reading. My animations try to demonstrate exactly that by showing the simulation with 10^7 trials. We see a nice convergence but if you look where we are at 10^5 trials (which is where you stopped your simultation) - better seen in the animation with the log scale as this is already at FRAME 4 of 499! - you see you simply stopped you animation too soon.

## Re: Rnd in Mathcad

 Werner Exinger wrote:I cannot duplicate the problem/error your animation shows but...

See (optimize) please attach.

## Re: Rnd in Mathcad

 See (optimize) please attach.

As far as I can see there is no error in this sheet which could lend to wrong simulation results. So the above said is still true: You cannot excpect a much better result with "just" 10^5 trials - thats all. You simply stopped your animation too soon. If you want the approximation to be closer to the real value, you will have to increase the number of trials significantly.

One thing I would optimize is the precalculation of Delta like this

The way you did it is very time consuming as the count starts over from scratch for every vector element.

Another thing I tried to optimize was to get rid of all the submatrix commands to speed up animation, but I ran into Mathcad's plot limit when I increased the number of trials (see: http://communities.ptc.com/message/228788#228788)

So I just changed a few minor things like making the number of trials and the maximal frame number easily selectable in one place; tried to make the total number of point for each animation frame a better "round" number and got rid of the a little bit odd nonlinearscale replacing it by a linear and a logarithmic one.

For a number of trials as high as 10^6 I also had to adjust the size of the points plotted to be as small as possible.

If you intend to increase that number to something like 10^7 you will have to change your sheet significantly as you will run into memory problems - too many big vectors, too many points to plot, etc.

Also you would have to reduce the pointsize again as to not reveal the pi-sign too soon, But that's not possible in the 2D plot so you will have to workaround that problem, In my animations with 10^7 trials here (http://communities.ptc.com/videos/4533 and http://communities.ptc.com/videos/4532) I favored a fading effect. If a point is chosen by random, it is not plotted immedeatly but is faded in in more than 100 steps of transparency. So the simulation will have to hit a point over 100 times to get the picture underneath fully revealed.

Here is an animation using your sheet with 10^6 trials http://communities.ptc.com/videos/4538

## Re: Rnd in Mathcad

Werner! I see you have a powerfull computer. Can you check the program in attach?

## Re: Rnd in Mathcad

 Valery Ochkov wrote:Werner! I see you have a powerfull computer

Not at all! It was a slow single core notebook with just 1 GB of RAM :-(

## Re: Rnd in Mathcad

But check please the sheet (duel).

May by you have fresh ideas.

## Re: Rnd in Mathcad

Check for what? Is there any specific problem?

## Re: Rnd in Mathcad

 Werner Exinger wrote:Check for what? Is there any specific problem?

For model!

And for rnd in the model.