Ask Your Question
1

Solving non linear system of equations

asked 2014-01-04 07:19:38 +0100

Zardoz777 gravatar image

updated 2014-01-04 14:06:54 +0100

Shashank gravatar image

Why this is not working in sage?

f=-V+exp(V)-w-1;
g=0.5*V-w;
sol=solve([f==0,g==0],V,w,solution_dict=True)

It does not return numerical solutions when there are two.

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-01-04 15:14:42 +0100

calc314 gravatar image

The solve command looks for an analytic solution. In this case, the solution will involve the Lambert W function, lambert_w. For some reason, though, Sage is not finding it. (You need to use to_poly_solve=True in the solve command, but Sage is encountering an error.)

To find approximations of the solutions, you can use find_root.

For example,

find_root(-V+exp(V)-0.5*V-1,-1,0.5)

and

find_root(-V+exp(V)-0.5*V-1,0.5,1)

give the two roots.

edit flag offensive delete link more

Comments

Yep. Though in this case it is straightforward to reduce the system into a 1-dimensional equation, it coud be very nice to have `find_root` work with more variables. Also, i do not get an error with `to_poly_solve=True`, just a useless result.

tmonteil gravatar imagetmonteil ( 2014-01-07 12:44:03 +0100 )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

Stats

Asked: 2014-01-04 07:19:38 +0100

Seen: 741 times

Last updated: Jan 04 '14