Ask Your Question
2

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

asked 2019-02-14 10:56:35 -0500

stockh0lm gravatar image

updated 2019-02-18 09:15:45 -0500

tmonteil gravatar image

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 flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-02-18 09:15:30 -0500

tmonteil gravatar image

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-02-14 10:56:35 -0500

Seen: 116 times

Last updated: Feb 18