Python Forum
complex algebraic function simplify - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: complex algebraic function simplify (/thread-24960.html)



complex algebraic function simplify - catlessness - Mar-12-2020

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


RE: complex algebraic function simplify - Gribouillis - Mar-12-2020

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))]