fork download
  1. import sympy as sp
  2. Aa, Pa, Qa, Ra, Ab, Pb, Qb, Rb, Ac, Pc, Qc, Rc, Ad, Pd, Qd, Rd, P = sp.symbols('Aa, Pa, Qa, Ra, Ab, Pb, Qb, Rb, Ac, Pc, Qc, Rc, Ad, Pd, Qd, Rd, P', real = True, positive = True)
  3. f = Pa * Qa + Pb * Qb + Pc * Qc + Pd * Qd - P
  4. g = (Qa + Aa) / Ra - (Qb + Ab) / Rb
  5. h = (Qb + Ab) / Rb - (Qc + Ac) / Rc
  6. i = (Qc + Ac) / Rc - (Qd + Ad) / Rd
  7. solution = sp.solvers.solve((f, g, h, i), (Qa, Qb, Qc, Qd))
  8. for var in solution:
  9. print(var, ' = ', sp.simplify(solution[var]))
Runtime error #stdin #stdout #stderr 0.11s 23356KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
ModuleNotFoundError: No module named 'sympy'