Message Boards Message Boards

0
|
3286 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Iterative calculation with loops?

Posted 7 years ago

Hello everybody, I use loops to do an iterative calculation. Unfortunately, the execution time of a loop increases with the number of iterations. Have you seen this kind of problem?

Best Regards, Jamal FAJOUI

Attachments:
POSTED BY: Fajoui Jamal
2 Replies

Your notebook has a While loop nested inside a Do loop, and the body of those loops seems a bit of a horror of coding.

Ideally, one would like to replace the explicit loops with a higher-level Nest or NestWhile or similar structure, but with such complex code inside the loop it's very hard to tell what's going on.

Can you break out some steps that are inside the nested loop by encapsulating them in separate functions, then call those functions inside the loop. Yes, that could make running time greater with the explicit Do and While, but it would give us a chance at disentangling what's going on here.

POSTED BY: Murray Eisenberg
Posted 7 years ago

Thanks for your answer. I tried with another loop type like GoTo. But, the result is the same. As you can see, I defined a function (package) to compute the inverse and an other parameters. I can not use another package.

POSTED BY: Fajoui Jamal
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract