Reputation: 735
I will try to use the result of solve function in sympy
from sympy import solve, expand,
SolutionForPi = (alpha*mu*(-gamma*l*rho + gamma*l - gamma*pi*rho + gamma*pi - l*rho - pi*rho)/(-rho/(rho - 1) + 1) + f*mu)-pi
SolutionForPi = solve(SolutionForPi, pi)
The Result is
[mu*(-alpha*gamma*l*rho**2 + 2*alpha*gamma*l*rho - alpha*gamma*l - alpha*l*rho**2 + alpha*l*rho - f)/(alpha*gamma*mu*rho**2 - 2*alpha*gamma*mu*rho + alpha*gamma*mu + alpha*mu*rho**2 - alpha*mu*rho - 1)]
Then I use sympy.expend function
ExpandSolution = expand(SolutionForPi)
But I get this error :
AttributeError: 'list' object has no attribute 'expand'
What I understand is this is a list not an equation so what should I do ?
Upvotes: 0
Views: 366
Reputation: 25093
If your solution is encapsulated in a list, access the (single) list member
ExpandSolution = expand(SolutionForPi[0])
Upvotes: 1