Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Having trouble solving simultaneous questions

I'm trying to use sagemath cloud to solve simultaneous equations, but I'm having trouble. Can you please look at the code below and see what I'm doing wrong. sagemath cloud just stalls.

x, y, x2, y2, xa, ya, xb, yb = var('x y x2 y2 xa ya xb yb')

eq1 = (x-1)(x-2) + (y-3)(y-4) == 0

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

eq3 = x+x2 == 1+2

eq4 = y+y2 == 3+4

sols = solve([eq1,eq2,eq3,eq4],x,y,solution_dict=True)

for soln in sols: print "x: %s, y: %s x2: %s y2: %s"%(soln[x], soln[y],soln[x2],soln[y2])

Having trouble solving simultaneous questions

I'm trying to use sagemath cloud to solve simultaneous equations, but I'm having trouble. Can you please look at the code below and see what I'm doing wrong. sagemath cloud just stalls.

x, y, x2, y2, xa, ya, xb, yb = var('x y x2 y2 xa ya xb yb')

eq1 = (x-1)(x-2) + (y-3)(y-4) == 0

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

eq3 = x+x2 == 1+2

eq4 = y+y2 == 3+4

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

for soln in sols: print "x: %s, y: %s x2: %s y2: %s"%(soln[x], soln[y],soln[x2],soln[y2])

Having trouble solving simultaneous questions

I'm trying to use sagemath cloud to solve simultaneous equations, but I'm having trouble. Can you please look at the code below and see what I'm doing wrong. sagemath cloud just stalls.gives the following error:

Error in lines 7-7 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> KeyError: x

My code:

x, y, x2, y2, xa, ya, xb, yb y2 = var('x y x2 y2 xa ya xb yb')y2')

eq1 = (x-1)(x-2) + (y-3)(y-4) == 0

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

eq3 = x+x2 == 1+23

eq4 = y+y2 == 3+47

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

for soln in sols: print "x: %s, y: %s x2: %s y2: %s"%(soln[x], soln[y],soln[x2],soln[y2])