ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 07 Nov 2015 07:19:22 -0600Having trouble solving simultaneous questionshttp://ask.sagemath.org/question/30528/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 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:
<code>
x, y, x2, y2 = var('x y x2 y2')
eq1 = (x-1)*(x-2) + (y-3)*(y-4) == 0
eq2 = (x2-1)*(x2-2) + (y2-3)*(y2-4) == 0
eq3 = x+x2 == 3
eq4 = y+y2 == 7
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])
</code>ameetnsharmaSat, 07 Nov 2015 07:19:22 -0600http://ask.sagemath.org/question/30528/