Reputation: 409
My equation is ax = ln(ec-b/y)
How can I find what x*y equals in python? I've tried using SymPy.solve, but it doesn't allow me to solve for a term. Thanks in advance.
Upvotes: 0
Views: 210
Reputation: 18939
If you solve for y = f(x)
then y*x = x*f(x)
. So these two steps in SymPy are:
>>> from sympy.abc import a,b,c,x,y
>>> from sympy import solve, Eq
>>> solve(Eq(a*x , ln(exp(c-b)/y)),y)
[exp(-a*x - b + c)]
>>> _[0]*x # == y*x
x*exp(-a*x - b + c)
You can solve for any subexpression, but when it is not a symbol, it will be interpreted literally as if you solved for u
after replacing the sub-expression with u
:
>>> solve(x*y - 1/x, x*y)
[1/x]
In your expression there is no x*y
so that's why an attempt to naively solve for it fails.
Upvotes: 1