ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 07 Jan 2014 05:44:03 -0600Solving non linear system of equationshttp://ask.sagemath.org/question/10885/solving-non-linear-system-of-equations/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
Sat, 04 Jan 2014 00:19:38 -0600http://ask.sagemath.org/question/10885/solving-non-linear-system-of-equations/Answer by calc314 for <p>Why this is not working in sage?</p>
<pre><code>f=-V+exp(V)-w-1;
g=0.5*V-w;
sol=solve([f==0,g==0],V,w,solution_dict=True)
</code></pre>
<p>It does not return numerical solutions when there are two.</p>
<p>Thanks</p>
http://ask.sagemath.org/question/10885/solving-non-linear-system-of-equations/?answer=15889#post-id-15889The `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.
Sat, 04 Jan 2014 08:14:42 -0600http://ask.sagemath.org/question/10885/solving-non-linear-system-of-equations/?answer=15889#post-id-15889Comment by tmonteil for <p>The <code>solve</code> command looks for an analytic solution. In this case, the solution will involve the Lambert W function, <code>lambert_w</code>. For some reason, though, Sage is not finding it. (You need to use <code>to_poly_solve=True</code> in the <code>solve</code> command, but Sage is encountering an error.)</p>
<p>To find approximations of the solutions, you can use <code>find_root</code>.</p>
<p>For example,</p>
<pre><code>find_root(-V+exp(V)-0.5*V-1,-1,0.5)
</code></pre>
<p>and</p>
<pre><code>find_root(-V+exp(V)-0.5*V-1,0.5,1)
</code></pre>
<p>give the two roots.</p>
http://ask.sagemath.org/question/10885/solving-non-linear-system-of-equations/?comment=16470#post-id-16470Yep. 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.Tue, 07 Jan 2014 05:44:03 -0600http://ask.sagemath.org/question/10885/solving-non-linear-system-of-equations/?comment=16470#post-id-16470