0
$\begingroup$

I have enabled sympy on Anaconda to use it to solve basic linear equations, but whenever I try to type something up it gives me an error when defining the variables:

from sympy import *
x,y=symbols(’x,y’);
solution=solve((4*x-3*y-17,7*x+5*y-11),x,y);
P=(solution[x],solution[y]);
print(P);

This code gives me this error message:

  x,y=symbols(’x,y’);
                 ^
SyntaxError: invalid character in identifier

Does anyone know how I could fix this?

$\endgroup$
0
$\begingroup$

Just change the to " it works just fine, see:

from sympy import *
x,y=symbols("x,y");
solution=solve((4*x-3*y-17,7*x+5*y-11),x,y);
P=(solution[x],solution[y]);

print(P)
(118/41, -75/41)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.