Ask Your Question
1

Newton method for one variable

asked 2016-08-22 02:53:18 -0600

logomath gravatar image

updated 2016-08-28 13:07:57 -0600

I try to use 'solve' for nonlinear eauqtions in one variable, but the answer is tautological or "cannot evaluate symbolic expression numerically" if I add "explicit_solutions=True". Is Newton method (or any other, like secant method) implemented in Sage?

Ex: sage: x=var('x') sage: (x-cos(x)).solve(x)

[x == cos(x)]

while I would expect x= 0.739085

edit retag flag offensive close merge delete

Comments

1

You can find it with find_root(x-cos(x),0,1)

mforets gravatar imagemforets ( 2016-08-22 03:19:11 -0600 )edit

thank you!

logomath gravatar imagelogomath ( 2016-08-22 04:10:40 -0600 )edit

It appears that find_root doesn't allow arbitrary precision. Is there another way?

logomath gravatar imagelogomath ( 2016-08-28 12:52:22 -0600 )edit

You might try mpmath, see using mpmath.findroot.

mforets gravatar imagemforets ( 2016-08-28 16:47:03 -0600 )edit

Ok,thank you.

logomath gravatar imagelogomath ( 2016-08-31 13:26:50 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2016-08-22 03:17:36 -0600

FrédéricC gravatar image

solve is for symbolic or algebraic solutions. Use that

sage: find_root(x-cos(x),0,1)
0.7390851332151559
edit flag offensive delete link more

Comments

Oh, thank you!

logomath gravatar imagelogomath ( 2016-08-22 04:09:10 -0600 )edit

It appears that find_root doesn't allow arbitrary precision. Is there another way?

logomath gravatar imagelogomath ( 2016-08-28 12:52:42 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-08-22 02:53:18 -0600

Seen: 163 times

Last updated: Aug 22 '16