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.Mon, 18 Feb 2019 09:15:30 -0600solve(x) does not fully isolate x. Can Sympy use assume()tions?http://ask.sagemath.org/question/45463/solvex-does-not-fully-isolate-x-can-sympy-use-assumetions/This is my worksheet.
https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share
In line 50 i solve the equation describing my physical model for d_k:
d = solve(p_ges == p_ges_rhs, d_k)
But it turns out, that this does not fully isolate d_k at all. Many occurances of d_k remain. How can I help sage along? I really would like to get this fully solved for d_k.
Update: I tried to
assume(d_e >0, d_k > d_m > 0, e_m > e_s > 0)
things about the equation, but to no avail. In Mathematica `assume()` is just for simplifying quations, is it the same in sage, with no effect on `solve()`?
Update2:
I did this:
sage: import sympy
sage: x,d_e, d_m, e_m, e_s, v_ges, d_k =var('x d_e d_m e_m e_s v_ges d_k')
sage: sympy.solve(-1/((d_e - x)*e_m) + 1/(e_m*x) + 1/(sqrt((d_e - x)^2 + 4*d_k^2)*d_k*(e_m/d_m + e_s/(d_k - d
....: _m))) - 1/(sqrt(4*d_k^2 + x^2)*d_k*(e_m/d_m + e_s/(d_k - d_m)))-v_ges ,d_k)
[]
sage:
which I found mention of here:
https://ask.sagemath.org/question/23967/solve-for-variable-but-variable-is-still-in-answer/
I guess that means there is no solution for that problem. On IRC I was told that it is highly likely true, if sympy says so. doh.Thu, 14 Feb 2019 10:56:35 -0600http://ask.sagemath.org/question/45463/solvex-does-not-fully-isolate-x-can-sympy-use-assumetions/Answer by tmonteil for <p>This is my worksheet.
<a href="https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share">https://cocalc.com/share/f7766c5e-2f4...</a></p>
<p>In line 50 i solve the equation describing my physical model for d_k:</p>
<pre><code>d = solve(p_ges == p_ges_rhs, d_k)
</code></pre>
<p>But it turns out, that this does not fully isolate d_k at all. Many occurances of d_k remain. How can I help sage along? I really would like to get this fully solved for d_k.</p>
<p>Update: I tried to </p>
<pre><code>assume(d_e >0, d_k > d_m > 0, e_m > e_s > 0)
</code></pre>
<p>things about the equation, but to no avail. In Mathematica <code>assume()</code> is just for simplifying quations, is it the same in sage, with no effect on <code>solve()</code>?</p>
<p>Update2:</p>
<p>I did this:</p>
<pre><code>sage: import sympy
sage: x,d_e, d_m, e_m, e_s, v_ges, d_k =var('x d_e d_m e_m e_s v_ges d_k')
sage: sympy.solve(-1/((d_e - x)*e_m) + 1/(e_m*x) + 1/(sqrt((d_e - x)^2 + 4*d_k^2)*d_k*(e_m/d_m + e_s/(d_k - d
....: _m))) - 1/(sqrt(4*d_k^2 + x^2)*d_k*(e_m/d_m + e_s/(d_k - d_m)))-v_ges ,d_k)
[]
sage:
</code></pre>
<p>which I found mention of here:
<a href="https://ask.sagemath.org/question/23967/solve-for-variable-but-variable-is-still-in-answer/">https://ask.sagemath.org/question/239...</a></p>
<p>I guess that means there is no solution for that problem. On IRC I was told that it is highly likely true, if sympy says so. doh.</p>
http://ask.sagemath.org/question/45463/solvex-does-not-fully-isolate-x-can-sympy-use-assumetions/?answer=45498#post-id-45498Unfortunately, the Sage's assumptions are not passed to sympy and conversely, see [trac ticket 24334](https://trac.sagemath.org/ticket/24334) and [trac ticket 24078](https://trac.sagemath.org/ticket/24078).
What you can do as a workaround is to directly pass `sympy` assumptions, see : https://docs.sympy.org/latest/modules/assumptions/assume.html
Mon, 18 Feb 2019 09:15:30 -0600http://ask.sagemath.org/question/45463/solvex-does-not-fully-isolate-x-can-sympy-use-assumetions/?answer=45498#post-id-45498