Ask Your Question

Is there an equivalent of NSolve of mathematica?

asked 2010-12-20 06:07:15 +0200

Shashank gravatar image

updated 2015-01-14 16:22:37 +0200

FrédéricC gravatar image

I am trying to solve a system of non-linear system of equations. Is there a equivalent of NSolve or FindRoot of mathematica in sage. I looked up on the net and there is a equivalent command nsolve in sympy. However, for some reason "from sympy import nsolve" gives a error.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2010-12-20 08:46:13 +0200

Felix Lawrence gravatar image

Scipy has quite a collection of numerical solvers in scipy.optimize. Does scipy.optimize.nonlin suit your needs?

edit flag offensive delete link more

answered 2010-12-20 21:06:34 +0200

Eviatar Bach gravatar image

Here is the equivalent to FindRoot:

edit flag offensive delete link more


find_root works only in 1D I was actually trying to minimiize in 5D. I ended up using simplex algorithm from scipy it works pretty well.

Shashank gravatar imageShashank ( 2011-01-11 19:05:33 +0200 )edit

answered 2010-12-20 07:30:03 +0200

Shashank gravatar image

I found a way around. I can define f=abs(f1)+abs(f2)+... and minimize f using the simplex algorithm. However, I have not been play with the tolerance and maximum number of iterations in minimize(). Is there is simple way of changing the tolerance for minimize with alogorithm="simplex"?

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2010-12-20 06:07:15 +0200

Seen: 1,271 times

Last updated: Dec 20 '10