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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Iterative Programming

DickCun
12-Amethyst

Iterative Programming

To community:

The attached worksheet shows two programs.

The one on the left shows one way of repeating a calculation that works and accomplishes what it is supposed to do.

The one on the right is an attempt to0 do the same by iterating the calculations but only goes into a recursive mode.

Would like help in the proper programming procedure.

Thanks for any help

ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
23-Emerald III
(To:StuartBruff)

StuartBruff wrote:

Do you want the function to stack the values at the end of each iteration, as they do in GU3epm?  Or do you want some other behaviour?

Does this function fulfil a specific purpose, or is it a programming exercise/play-ground to try out various techniques?

One other thing, after another look at your function GU4epm, you need to move the initialization of s to before the while loop, otherwise the s:=s+1 expression is pretty useless as s gets reset next time round the loop.

Stuart

If stacking is needed, will something like this do what you want?

Stuart

View solution in original post

6 REPLIES 6
StuartBruff
23-Emerald III
(To:DickCun)

Richard Cunningham wrote:

To community:

The attached worksheet shows two programs.

The one on the left shows one way of repeating a calculation that works and accomplishes what it is supposed to do.

The one on the right is an attempt to0 do the same by iterating the calculations but only goes into a recursive mode.

Would like help in the proper programming procedure.

You need to move the expression incrementing t into the while loop.

As an aside, it's just infinitely iterating rather than recursing (in computer terms) because nothing is calling itself.

Stuart

StuartBruff
23-Emerald III
(To:DickCun)

Richard Cunningham wrote:

To community:

The attached worksheet shows two programs.

The one on the left shows one way of repeating a calculation that works and accomplishes what it is supposed to do.

The one on the right is an attempt to0 do the same by iterating the calculations but only goes into a recursive mode.

Would like help in the proper programming procedure.

Do you want the function to stack the values at the end of each iteration, as they do in GU3epm?  Or do you want some other behaviour?

Does this function fulfil a specific purpose, or is it a programming exercise/play-ground to try out various techniques?

One other thing, after another look at your function GU4epm, you need to move the initialization of s to before the while loop, otherwise the s:=s+1 expression is pretty useless as s gets reset next time round the loop.

Stuart

StuartBruff
23-Emerald III
(To:StuartBruff)

StuartBruff wrote:

Do you want the function to stack the values at the end of each iteration, as they do in GU3epm?  Or do you want some other behaviour?

Does this function fulfil a specific purpose, or is it a programming exercise/play-ground to try out various techniques?

One other thing, after another look at your function GU4epm, you need to move the initialization of s to before the while loop, otherwise the s:=s+1 expression is pretty useless as s gets reset next time round the loop.

Stuart

If stacking is needed, will something like this do what you want?

Stuart

What are you actually trying to achieve? Are you trying the replicate the answer of the program which uses For Loops with While Loops?

Mike

DickCun
12-Amethyst
(To:DickCun)

‌Stuart....

THanks so much for your help. I was able to add the other parts of the Elemental Percentile Method requirements to the program and arrive at scale and location parameters for a Gumbel,distribution.

DIck..

StuartBruff
23-Emerald III
(To:DickCun)

Richard Cunningham wrote:

Stuart....

THanks so much for your help. I was able to add the other parts of the Elemental Percentile Method requirements to the program and arrive at scale and location parameters for a Gumbel,distribution.

****..

No problem.  Interesting application - I hadn't heard of the Gumbel distribution before, so had a quick read of this presentation:  http://www.ims.nus.edu.sg/Programs/ocean07/files/abdel1.ppt and this book excerpt: Statistics of Extremes: Theory and Application

If you're not familiar with the capability, you might want to look up distribution/function fitting with Mathcad.

Stuart

Announcements

Top Tags