Message Boards Message Boards


Iterative calculation with loops?

Posted 1 year ago
2 Replies
0 Total Likes

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

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 1 year 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.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract