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.Thu, 14 Feb 2019 00:25:06 -0600solve() drops variables from equation - why?http://ask.sagemath.org/question/45454/solve-drops-variables-from-equation-why/ this is my worksheet: https://cocalc.com/share/f7766c5e-2f4d-4916-bb0d-74a7182e5fd5/2019-02-09-203517.sagews?viewer=share
In line 47 I solve for d_k. However the result does not contain p_ges nor U. That does not make sense to me, and makes me suspicious towards the result. What could have caused that? This equation describes a physical phenomenon, and it would not make sense for d_k to be independent of U or p_ges.Wed, 13 Feb 2019 15:14:41 -0600http://ask.sagemath.org/question/45454/solve-drops-variables-from-equation-why/Answer by rburing 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 47 I solve for d_k. However the result does not contain p_ges nor U. That does not make sense to me, and makes me suspicious towards the result. What could have caused that? This equation describes a physical phenomenon, and it would not make sense for d_k to be independent of U or p_ges.</p>
http://ask.sagemath.org/question/45454/solve-drops-variables-from-equation-why/?answer=45455#post-id-45455You have two definitions (with the `=` sign) of `p_ges`. One of them is the symbol
p_ges = var('p_ges', latex_name=r'\varphi_{ges}')
and the other one is the right-hand side of some equation `p_ges == p_1 + p_2 + p_3 + p_4`.
You should probably give this right-hand side a different name, e.g.
p_ges_rhs = p_1 + p_2 + p_3 + p_4
Then the equation you want to solve is
d = solve(p_ges == p_ges_rhs, d_k)
---
Your old line 47 is equivalent to
d = solve(p_ges_rhs == 0, d_k)
which explains why `p_ges` doesn't appear (it is implicitly set to zero).Wed, 13 Feb 2019 15:41:38 -0600http://ask.sagemath.org/question/45454/solve-drops-variables-from-equation-why/?answer=45455#post-id-45455Comment by stockh0lm for <p>You have two definitions (with the <code>=</code> sign) of <code>p_ges</code>. One of them is the symbol</p>
<pre><code>p_ges = var('p_ges', latex_name=r'\varphi_{ges}')
</code></pre>
<p>and the other one is the right-hand side of some equation <code>p_ges == p_1 + p_2 + p_3 + p_4</code>.</p>
<p>You should probably give this right-hand side a different name, e.g.</p>
<pre><code>p_ges_rhs = p_1 + p_2 + p_3 + p_4
</code></pre>
<p>Then the equation you want to solve is</p>
<pre><code>d = solve(p_ges == p_ges_rhs, d_k)
</code></pre>
<hr>
<p>Your old line 47 is equivalent to</p>
<pre><code>d = solve(p_ges_rhs == 0, d_k)
</code></pre>
<p>which explains why <code>p_ges</code> doesn't appear (it is implicitly set to zero).</p>
http://ask.sagemath.org/question/45454/solve-drops-variables-from-equation-why/?comment=45456#post-id-45456wow, surprise! thank you so much for this insight!
I struggle with understanding the use of "=" and "==" . Now i think that "=" could be called "is defined as", while "==" is more like "evaluates to the same as". Is that correct?Thu, 14 Feb 2019 00:25:06 -0600http://ask.sagemath.org/question/45454/solve-drops-variables-from-equation-why/?comment=45456#post-id-45456