1 | initial version |
1) When you type code, mark it as such by selecting it and using the "1 0 1 0 1 0" button of the damn' editor...
2) the following one-liner does what you want:
[[u.lhs()==u.rhs().n() for u in S] for S in solve([7.0==a*sqrt(16)/(1+b/16.0),22==a*sqrt(4)/(1+b/4)],a,b)]
[[a == 1.36686390532544, b == -3.50295857988166]]
3) I seriously question the need to get floats (i. e. inexact values). I'd try to keep exact values as far as possible (including in the equations):
sage: solve([7==a*sqrt(16)/(1+b/16),22==a*sqrt(4)/(1+b/4)],a,b)
[[a == (231/169), b == (-592/169)]]
2 | No.2 Revision |
1) When you type code, mark it as such by selecting it and using the "1 0 1 0 1 0" button of the damn' editor...
2) the following one-liner does what you want:
[[u.lhs()==u.rhs().n() for u in S] for S in solve([7.0==a*sqrt(16)/(1+b/16.0),22==a*sqrt(4)/(1+b/4)],a,b)]
[[a == 1.36686390532544, b == -3.50295857988166]]
3) I seriously question the need to get floats (i. e. inexact values). I'd try to keep exact values as far as possible (including in the equations):
sage: solve([7==a*sqrt(16)/(1+b/16),22==a*sqrt(4)/(1+b/4)],a,b)
[[a == (231/169), b == (-592/169)]]
EDIT: I didn't see tmonteil's excellent answer, which was more or less simultaneous. It differs fro mine, but is better on certain aspects(use of solution dictionaries...).