Python Forum

Full Version: complex algebraic function simplify
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
import sympy

a=sympy.Symbol('a')
C=sympy.Symbol('C')
t=sympy.Symbol('t')
E=sympy.Symbol('E')
R1=sympy.Symbol('R1')
R2=sympy.Symbol('R2')
i=sympy.Symbol('i')

i=E/(R1+1/(R2+a*i*t/(C-i)))
res=sympy.solve(i,t)
print(res)
i dont have result from res, is it because i is on both sides of the equation?
is there any other way to have a result of i=f(t)
Thank you!!!
Use an expression that must be zero in solve() as the docstrings says
>>> import sympy
>>> a, C, t, E, R1, R2, i = sympy.symbols("a, C, t, E, R1, R2, i")
>>> a
a
>>> C
C
>>> z = i - E/(R1 + 1/(R2 + a * i * t / (C-i)))                                              
>>> sympy.solve(z, t)                                                                        
[(C - i)*(-E*R2 + R1*R2*i + i)/(a*i*(E - R1*i))]