Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- How do you get a vector or function to be recalcul...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-24-2019
01:16 PM

10-24-2019
01:16 PM

I have a function that produce a series of Pi using Monte Carlo.

Is there a way I can use it in a loop so that it recalculates all its values of Pi each iteration?

Thanks

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-24-2019
03:25 PM

10-24-2019
03:25 PM

Addendum:

The function argument must not becessarily be a dummy argument. It may determine how many iterations the Montecarlo simulation should go through.

maybe something like the following.

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-24-2019
03:10 PM

10-24-2019
03:10 PM

Re: How do you get a vector or function to be recalculated?

If its really a function (of a dummy argument) and you call it within a loop with, lets say, the loop counter as argument, the function will create new random number every time and give you a different result.

For more help you'll have to show what you've done so far by attaching your worksheet.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-24-2019
03:25 PM

10-24-2019
03:25 PM

Addendum:

The function argument must not becessarily be a dummy argument. It may determine how many iterations the Montecarlo simulation should go through.

maybe something like the following.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-24-2019
04:38 PM

10-24-2019
04:38 PM

Re: How do you get a vector or function to be recalculated?

I needed to generate three data sets of 100 determinations of Pi but using increasing number of darts thrown each time (I used 100, 1000, 10000). The problem I was having is that the CalcPi(N) function I used wouldn't update its values when I tried to use it in my loop within my function PiDS(N,D) (Data Sets of Pi where N is number of darts thrown and D is number of determinations of Pi to make and parse into array). The way I fixed it is by using a temp array and set it to CalcPi(1) before setting it to CalcPi(N) each iteration, that way it made the function generate a new array each time. Not sure if there is a proper way of doing it. Hope I made sense...

Thanks for the help.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-24-2019
05:13 PM

10-24-2019
05:13 PM

Re: How do you get a vector or function to be recalculated?

Not sure if there is a proper way of doing it.

Hard to say without seeing what exactly you have done.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

10-24-2019
08:47 PM

10-24-2019
08:47 PM

Re: How do you get a vector or function to be recalculated?