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, 04 Sep 2012 16:53:27 -0500Some equations fail to solve even with to_poly_solvehttp://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/In the following, I would expect to obtain `[z == 1/y*lambda_w(y)]`:
sage: z=var('z')
sage: y=var('y')
sage: solve(log(z)+3*z==0, z, to_poly_solve=True)
[z == 1/3*lambert_w(3)]
sage: solve(log(z)+y*z==0, z, to_poly_solve=True)
[z == -log(z)/y]
But Sage doesn't want to solve the equation for z. Perhaps, in view of the fact that it solves the equation when 3 is in place of z, it doesn't realize that y is supposed to represent a real number. I tried `assume(y,'real')` but that command did not help.
Does anyone know a workaround?Sun, 02 Sep 2012 18:02:34 -0500http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/Comment by kcrisman for <p>In the following, I would expect to obtain <code>[z == 1/y*lambda_w(y)]</code>:</p>
<pre><code>sage: z=var('z')
sage: y=var('y')
sage: solve(log(z)+3*z==0, z, to_poly_solve=True)
[z == 1/3*lambert_w(3)]
sage: solve(log(z)+y*z==0, z, to_poly_solve=True)
[z == -log(z)/y]
</code></pre>
<p>But Sage doesn't want to solve the equation for z. Perhaps, in view of the fact that it solves the equation when 3 is in place of z, it doesn't realize that y is supposed to represent a real number. I tried <code>assume(y,'real')</code> but that command did not help.</p>
<p>Does anyone know a workaround?</p>
http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?comment=19117#post-id-19117I couldn't even reproduce the correct answers in Maxima, strangely.Tue, 04 Sep 2012 08:37:06 -0500http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?comment=19117#post-id-19117Comment by benjaminfjones for <p>In the following, I would expect to obtain <code>[z == 1/y*lambda_w(y)]</code>:</p>
<pre><code>sage: z=var('z')
sage: y=var('y')
sage: solve(log(z)+3*z==0, z, to_poly_solve=True)
[z == 1/3*lambert_w(3)]
sage: solve(log(z)+y*z==0, z, to_poly_solve=True)
[z == -log(z)/y]
</code></pre>
<p>But Sage doesn't want to solve the equation for z. Perhaps, in view of the fact that it solves the equation when 3 is in place of z, it doesn't realize that y is supposed to represent a real number. I tried <code>assume(y,'real')</code> but that command did not help.</p>
<p>Does anyone know a workaround?</p>
http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?comment=19121#post-id-19121That's a valid observation. Maybe you (or someone) would be willing to post the issue upstream to the Maxima mailing list?Sun, 02 Sep 2012 18:23:03 -0500http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?comment=19121#post-id-19121Answer by achrzesz for <p>In the following, I would expect to obtain <code>[z == 1/y*lambda_w(y)]</code>:</p>
<pre><code>sage: z=var('z')
sage: y=var('y')
sage: solve(log(z)+3*z==0, z, to_poly_solve=True)
[z == 1/3*lambert_w(3)]
sage: solve(log(z)+y*z==0, z, to_poly_solve=True)
[z == -log(z)/y]
</code></pre>
<p>But Sage doesn't want to solve the equation for z. Perhaps, in view of the fact that it solves the equation when 3 is in place of z, it doesn't realize that y is supposed to represent a real number. I tried <code>assume(y,'real')</code> but that command did not help.</p>
<p>Does anyone know a workaround?</p>
http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?answer=13991#post-id-13991Maybe sympy can be helpful?
sage: from sympy import *
sage: y,z=symbols('y z')
sage: from sympy.solvers import solve
sage: solve(log(z)+y*z, z)
[LambertW(y)/y]
Sun, 02 Sep 2012 20:15:54 -0500http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?answer=13991#post-id-13991Comment by heatkernel for <p>Maybe sympy can be helpful?</p>
<pre><code>sage: from sympy import *
sage: y,z=symbols('y z')
sage: from sympy.solvers import solve
sage: solve(log(z)+y*z, z)
[LambertW(y)/y]
</code></pre>
http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?comment=19113#post-id-19113thanks, that works.Tue, 04 Sep 2012 16:53:27 -0500http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?comment=19113#post-id-19113Answer by achrzesz for <p>In the following, I would expect to obtain <code>[z == 1/y*lambda_w(y)]</code>:</p>
<pre><code>sage: z=var('z')
sage: y=var('y')
sage: solve(log(z)+3*z==0, z, to_poly_solve=True)
[z == 1/3*lambert_w(3)]
sage: solve(log(z)+y*z==0, z, to_poly_solve=True)
[z == -log(z)/y]
</code></pre>
<p>But Sage doesn't want to solve the equation for z. Perhaps, in view of the fact that it solves the equation when 3 is in place of z, it doesn't realize that y is supposed to represent a real number. I tried <code>assume(y,'real')</code> but that command did not help.</p>
<p>Does anyone know a workaround?</p>
http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?answer=13990#post-id-13990Maybe this way can be helpful:
sage: from sympy import *
sage: y,z=symbols('y z')
sage: from sympy.solvers import solve
sage: solve(log(z)-y*z, z)
[-LambertW(-y)/y]
Sun, 02 Sep 2012 20:10:11 -0500http://ask.sagemath.org/question/9288/some-equations-fail-to-solve-even-with-to_poly_solve/?answer=13990#post-id-13990