# solve() drops variables from equation - why?

this is my worksheet: https://cocalc.com/share/f7766c5e-2f4...

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.

edit retag close merge delete

Sort by » oldest newest most voted

You 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).

more

wow, 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?

( 2019-02-14 00:25:06 -0500 )edit