Very Slow Numerical Approximation

Very Slow Numerical Approximation - Newton-Raphson Method - Messages

#1 Posted: 2/22/2023 3:02:25 PM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

I tried to make a simple sheet that would show the path the Newton-Raphson approximation takes to get to a solution based on an initial guess.
The problem I'm having is that it's very slow with anything more than 2/3 iterations.
I'm not sure why it is slow. I can simulate the loop in steps and none of the calcs are slow outside of the loop.
Any ideas as to why this is so slow for i>2. i=3 is still okay, but is gets eternal after that.
In this particular case, the solution converges at the 7th iteration for two decimal places of accuracy.
This is a snip of 4 iterations, which takes well over 2 minutes...
2023-02-22 12_54_44-SMath Solver 1.0.8348 - [Newton-Raphson Approximation.sm].png

Any input would be much appreciated.
Thanks,
Newton-Raphson Approximation.sm (10 KiB) downloaded 52 time(s).
#2 Posted: 2/22/2023 4:31:04 PM
Arie

Arie

93 likes in 285 posts.

Group: User

I changed optimization of for loop to Numeric. It runs in less than a second on my machine.

Newton-Raphson Approximation.sm (11 KiB) downloaded 57 time(s).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
1 users liked this post
Wesly Centerwall 2/22/2023 4:44:00 PM
#3 Posted: 2/22/2023 4:44:57 PM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

I knew it was going to be something simple like this. Thanks!
  • New Posts New Posts
  • No New Posts No New Posts