Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

sagemath cloud is not solving simultaneous equations

Here's my code:

x1, y1, x2, y2 = var('x1 y1 x2 y2')

eq1 = (x1-1)(x1-2) + (y1-3)(y1-4) == 0

eq2 = (x2-1)(x2-2) + (y2-3)(y2-4) == 0

eq3 = x1+x2 == 3

eq4 = y1+y2 == 7

sols = solve([eq1,eq2,eq3,eq4],x1,y1,x2,y2,solution_dict=True)

for soln in sols: for varbl in soln: print "{0} : {1},".format(varbl, soln[varbl])

And here's my output:

x1 + x2 : 3,

(x1 - 1)(x1 - 2) + (y1 - 3)(y1 - 4) : 0,

(x2 - 1)(x2 - 2) + (y2 - 3)(y2 - 4) : 0,

y1 + y2 : 7,

I'm looking for any solutions, exact or numerical approximation. Appreciate any help. I can solve the problem by hand, but obviously that's not the point here. I'm trying to find out what I'm doing wrong and learn to use sagemath cloud properly.

sagemath cloud is not solving simultaneous equations

Here's my code:

x1, y1, x2, y2 = var('x1 y1 x2 y2')

eq1 = (x1-1)(x1-2) + (y1-3)(y1-4) == 0

eq2 = (x2-1)(x2-2) + (y2-3)(y2-4) == 0

eq3 = x1+x2 == 3

eq4 = y1+y2 == 7

sols = solve([eq1,eq2,eq3,eq4],x1,y1,x2,y2,solution_dict=True)

for soln in sols: for varbl in soln: print "{0} : {1},".format(varbl, soln[varbl])

And here's my output:

x1 + x2 : 3,

(x1 - 1)(x1 - 2) + (y1 - 3)(y1 - 4) : 0,

(x2 - 1)(x2 - 2) + (y2 - 3)(y2 - 4) : 0,

y1 + y2 : 7,

I'm looking for any solutions, exact or numerical approximation. Appreciate any help. I can solve the problem by hand, but obviously that's not the point here. I'm trying to find out what I'm doing wrong and learn to use sagemath cloud properly.

solving simultaneous equations

Here's my code:

 x1, y1, x2, y2 = var('x1 y1 x2 y2')

y2') eq1 = (x1-1)(x1-2) (x1-1)*(x1-2) + (y1-3)(y1-4) (y1-3)*(y1-4) == 0

0 eq2 = (x2-1)(x2-2) (x2-1)*(x2-2) + (y2-3)(y2-4) (y2-3)*(y2-4) == 0

0 eq3 = x1+x2 == 3

3 eq4 = y1+y2 == 7

7 sols = solve([eq1,eq2,eq3,eq4],x1,y1,x2,y2,solution_dict=True)

solve([eq1,eq2,eq3,eq4],x1,y1,x2,y2,solution_dict=True) for soln in sols: for varbl in soln: print "{0} : {1},".format(varbl, soln[varbl])

And here's my output:

x1 + x2 : 3,

3, (x1 - 1)(x1 1)*(x1 - 2) + (y1 - 3)(y1 3)*(y1 - 4) : 0,

0, (x2 - 1)(x2 1)*(x2 - 2) + (y2 - 3)(y2 3)*(y2 - 4) : 0,

0, y1 + y2 : 7,

7,

I'm looking for any solutions, exact or numerical approximation. Appreciate any help. I can solve the problem by hand, but obviously that's not the point here. I'm trying to find out what I'm doing wrong and learn to use sagemath cloud properly.