I am have a problem when trying to solve an equation using sympy
.
Some of the variables have specific values assigned.
I am trying to solve the equation for b
,c
and d
.
This is my attempt:
from random import randint
import sympy
from sympy.abc import b,c,d,B,C,r,x
B=10
C=20
r=123
# Equation: x^3+b*x^2+c*x+d=x^3+(B−r)x^2+(C−B*r)x−C*r
equation = sympy.Eq(x**3+b*x**2+c*x+d,x**3+(B−r)*x**2+(C−B*r)*x−C*r)
print(sympy.solve(equation,"b"))
print(sympy.solve(equation,"c"))
print(sympy.solve(equation,"d"))
Python prints me the following error:
[user@user Python Scripts]$ python polygen.py
File "polygen.py", line 10
equation = sympy.Eq(x**3+b*x**2+c*x+d,x**3+(B−r)*x**2+(C−B*r)*x−C*r)
^
SyntaxError: invalid character in identifier
What am I missing?
*
there after(B-r)
?*
but the error is the exact same.*
after (C-B*r) too, python doesnt handle inference of multiplication with parenthesis**
and^
for power as expression doesn't change anything.