Reputation: 27
I have these two equation below. I want to solve this system parametrically.
1.182 * a == 4.0 * b + 4.0
a^2 == 4.0 * b * c + 4.0
It is possible to solve it via MATLAB with the function below. It solves b and c with respect to a.
sol = solve(prob,[b,c]);
result:
b: 0.2956 * a - 1.0
c: (5.629e+14 * a^2 - 2.252e+15) / (6.656e+14 * a - 2.252e+15)
How can I get the same result in python. I couldn't find a similar function.
Upvotes: 1
Views: 123
Reputation: 20450
Upon running
from sympy import Eq, solve, symbols
a, b, c = symbols('a, b, c')
soln = solve((Eq(1.182 * a, 4.0 * b + 4.0),
Eq(a ** 2, 4.0 * b * c + 4.0)),
(b, c))
print('\n'.join(sorted(map(str, soln[0]))))
we obtain:
0.2955*a - 1.0
500.0*(a - 2.0) * (a + 2.0) / (591.0*a - 2000.0)
Upvotes: 2