SymPy - Solving for variable in equation
<p>Is it possible to define an equation and solve a variable in that equation?</p>

<pre><code>D_PWM, Rsense, A = symbols('D_PWM, Rsense, A')

i_out = D_PWM * (A/Rsense)

print i_out

solve(i_out, Rsense)
</code></pre>

<p>Result:</p>

<pre><code>A*D_PWM/Rsense
[]
</code></pre>

<p><strong>i_out</strong> has not been declared as a symbol.</p>

<pre><code>&gt;&gt;&gt; from sympy import *
&gt;&gt;&gt; var('D_PWM, Rsense, A i_out')
(D_PWM, Rsense, A, i_out)
&gt;&gt;&gt; eqn=Eq(i_out,D_PWM * (A/Rsense))
&gt;&gt;&gt; solve(eqn,Rsense)
[A*D_PWM/i_out]
</code></pre>

python sympy