1 страниц (4 вхождений)
Secant Method - Calculation time increases non-linearly with number of iterations - Сообщения
#1 Опубликовано: 14.12.2014 11:33:51
Hi
I want to solve a complex non-linear equation using the Secant Method and decided to verify the algorithm with a simple function. For this test, I set the number of iterations to n, rather than check against an error threshold.
SMath gives the correct solution.
However, because the number of iterations is set by n, I would expect the calculation time to be proportional to n, but it increases very quickly as you can see from the attached file. So:
• have I done something silly in the algorithm?
• is there something different I need to do when using SMath?
• any other ideas?
Many thanks
Brian
Secant Method - Test.sm (6 КиБ) скачан 173 раз(а).
I want to solve a complex non-linear equation using the Secant Method and decided to verify the algorithm with a simple function. For this test, I set the number of iterations to n, rather than check against an error threshold.
SMath gives the correct solution.
However, because the number of iterations is set by n, I would expect the calculation time to be proportional to n, but it increases very quickly as you can see from the attached file. So:
• have I done something silly in the algorithm?
• is there something different I need to do when using SMath?
• any other ideas?
Many thanks
Brian
Secant Method - Test.sm (6 КиБ) скачан 173 раз(а).
#2 Опубликовано: 14.12.2014 12:04:35
Hi bdrunagle,
This happens because each result doesn't contains a number, but the whole set of numbers involved up to that iteration.
Use an eval at each iteration to store just the result and speed up the calculation.
![2014-12-14 16_03_08-SMath Studio Desktop - [Secant Method - Test.sm_].png](/ru-RU/files/Download/ysCcSM/2014-12-14-16_03_08-SMath-Studio-Desktop---[Secant-Method---Test.sm_].png)
This happens because each result doesn't contains a number, but the whole set of numbers involved up to that iteration.
Use an eval at each iteration to store just the result and speed up the calculation.
![2014-12-14 16_03_08-SMath Studio Desktop - [Secant Method - Test.sm_].png](/ru-RU/files/Download/ysCcSM/2014-12-14-16_03_08-SMath-Studio-Desktop---[Secant-Method---Test.sm_].png)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Опубликовано: 14.12.2014 17:00:08
That's just what I needed!
Thanks very much Davide.
Thanks very much Davide.
#4 Опубликовано: 15.12.2014 04:06:45
You are welcome 
Best regards,
Davide

Best regards,
Davide
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 страниц (4 вхождений)
-
Новые сообщения
-
Нет новых сообщений