Message Boards Message Boards

Iterative calculation with loops?

GROUPS:

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
Answer
1 month ago

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
Answer
1 month 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
Answer
1 month ago

Group Abstract Group Abstract