Newton method

Newton method - Messages

#1 Posted: 4/8/2023 4:07:23 PM
Valery Ochkov

Valery Ochkov

55 likes in 633 posts.

Group: User

I cannot use the roots function and must use one old good simple method by Newton.
What can you say about it?

Newton-Eng.docx (1 MiB) downloaded 55 time(s).
1 users liked this post
Martin Kraska 4/9/2023 8:50:00 AM
#2 Posted: 4/9/2023 8:56:19 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Very nice.

I had problems when reproducing your 2D version. Depending on initial guess I got errors "requested matrix element does not exist". The situation seemed to improve a little by pre-allocating the vectors X and Y yet it didn't become really robust.

So instead of assigning to j+1 elements I used augment() to add new points to the iteration history.

This is the original version:

Newton2D.png
Newton2D.sm (21 KiB) downloaded 39 time(s).

And this is the modified version.

Newton2Da.png
Newton2Da.sm (19 KiB) downloaded 37 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#3 Posted: 4/9/2023 2:27:18 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

... can't find 2nd root


2nd root confirmed exact.

Solve(f,q,x0,x1,TOL) Copy.sm (162 KiB) downloaded 26 time(s).
#4 Posted: 4/9/2023 2:33:35 PM
overlord

overlord

549 likes in 1332 posts.

Group: Moderator

Tried to solve your functions with al_nleqsolve().

Regards

Newton.sm (13 KiB) downloaded 35 time(s).

2023-04-09_20-14.png
#5 Posted: 4/9/2023 6:19:38 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Another way, keeping the mathematical formulation and the iteration algorithm separate. As here.

Newton2Da.sm (13 KiB) downloaded 38 time(s).

Clipboard01.png

Best regards.
Alvaro.
#6 Posted: 4/10/2023 12:25:58 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Thanks Alvaro, added to my next Samples visit.
Take care ... Jean
#7 Posted: 4/10/2023 4:21:38 PM
overlord

overlord

549 likes in 1332 posts.

Group: Moderator

Wrote

I cannot use the roots function


Actually, you can.

Regards

2023-04-10_22-20.png
#8 Posted: 4/10/2023 8:29:31 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I cannot use the roots function and must use one old good simple method by Newton.
What can you say about it?


An old vintage in Smath ... two examples.
Take care Valery ... Jean.

Solve_roost f1(x,y). f2(x,y).sm (27 KiB) downloaded 34 time(s).



#9 Posted: 4/11/2023 2:21:16 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Two variations added.

Newton2Da. v2.sm (38 KiB) downloaded 59 time(s).

Newton2Da. v2.pdf (152 KiB) downloaded 52 time(s).

Best regards.
Alvaro.



1 users liked this post
sergio 5/3/2023 2:29:00 PM
#10 Posted: 5/3/2023 12:37:31 AM
Valery Ochkov

Valery Ochkov

55 likes in 633 posts.

Group: User

Wrote

Two variations added.

Newton2Da. v2.sm (38 KiB) downloaded 59 time(s).

Newton2Da. v2.pdf (152 KiB) downloaded 52 time(s).

Best regards.
Alvaro.




From my future article
Если уравнений не два, а три, то матрица Якоби будет состоять из трёх строк и трёх столбцов. При этом графически отображать решение придётся не двумя кривыми, а тремя поверхностями на 3D-графике, причём их взаимное пересечение и будет отмечать решение (задание читателю).
Слабо!
1 users liked this post
Alvaro Diaz Falconi 5/3/2023 3:21:00 AM
#11 Posted: 5/3/2023 12:02:25 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

You may find this Treasury useful/productive.


Solve(f,q,x0,x1,TOL) Copy.sm (300 KiB) downloaded 34 time(s).
  • New Posts New Posts
  • No New Posts No New Posts