Skip to main content
1-Visitor
November 11, 2015
Solved

Iterative Programming

  • November 11, 2015
  • 4 replies
  • 3483 views

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

Best answer by 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

4 replies

23-Emerald V
November 11, 2015

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

23-Emerald V
November 11, 2015

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

23-Emerald V
November 11, 2015

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

1-Visitor
November 11, 2015

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

DickCun1-VisitorAuthor
1-Visitor
November 13, 2015

‌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..

23-Emerald V
November 13, 2015

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