# solve(x) does not fully isolate x. Can Sympy use assume()tions?

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

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/239...

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.

edit retag close merge delete

Sort by ยป oldest newest most voted

Unfortunately, the Sage's assumptions are not passed to sympy and conversely, see trac ticket 24334 and trac ticket 24078.

What you can do as a workaround is to directly pass sympyassumptions, see : https://docs.sympy.org/latest/modules...

more