Nested loops take time to execute.

Nested loops take time to execute. - I have a calculation with several nested For and While loops, but the execution takes too long - Сообщения

#1 Опубликовано: 15.04.2025 19:43:22
David Daniel Alvarez Galvis

David Daniel Alvarez Galvis

0 сообщений из 2 понравились пользователям.

Группа: User

Software Jacobsen V1.sm (100 КиБ) скачан 75 раз(а).

Hi everyone,
I have a calculation with several nested FOR and WHILE loops, but the execution is taking too long. I don’t know what the issue is.
Also, I don’t know how to extract the variables SIGA and SIGT from the IF statements inside the loops.
Thanks in advance for your time and help.
#2 Опубликовано: 16.04.2025 09:28:21
Davide Carpi

Davide Carpi

1417 сообщений из 2873 понравились пользователям.

Группа: Moderator

Hello,

I've put some trace() "traps" in your code and it seems that there is some logic issue at least in the while(k<=1) level.

2025-04-16 11_21_29-SMath Solver - [Software Jacobsen V1.sm_].png

First issue is that k is never initialized.

Second issue is that the first if() inside that while() sends the algorithm in an endless loop, since k doesn't change up to that point.

2025-04-16 11_21_49-SMath Solver - [Software Jacobsen V1.sm_].png

There might be more problems but I'll start from those.

Отредактировано 16.04.2025 09:49:28
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
3 пользователям понравился этот пост
Andrey Ivashov 16.04.2025 12:17:18, sergio 16.04.2025 16:08:42, NDTM Amarasekera 18.04.2025 11:04:52
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений