0

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?

1 Answers1

0

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)
TwinPenguins
  • 4,249
  • 3
  • 19
  • 53