this code not working

```
from sympy import*
x= symbols('x')
quadraticExpression = x**2 + x*2 + 10
print ("Act expression:{}".format(quadraticExpression)
```

this code not working

```
from sympy import*
x= symbols('x')
quadraticExpression = x**2 + x*2 + 10
print ("Act expression:{}".format(quadraticExpression)
```

There is a missing closing parenthese on the last line. Apart from that, the code merely prints the expression. You want to use the `solveset`

function described here:

https://docs.sympy.org/latest/tutorial/solvers.html

You can choose the complex or real domain. (In case you donâ€™t know what a complex number is, you want the real domain.)

```
Python 3.8.2+ (heads/3.8:3e72de9e08, Apr 16 2020, 12:25:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import *
>>> x = symbols('x')
>>> quadratic_expression = x**2 + 2*x + 10
>>> solveset(quadratic_expression, x)
FiniteSet(-1 - 3*I, -1 + 3*I)
>>> solveset(quadratic_expression, x, domain=S.Reals)
EmptySet
```

1 Like

Yes, it is the solution. The equation *x**2 + 2x + 10 = 0* has exactly two complex solutions, which are *-1 - 3i* and *-1 + 3i*. If you are not aware of mathematiciansâ€™ clever and for beginners very confusing invention of the so-called â€śimaginaryâ€ť number *i* such that *i**2 = -1*, just pass `domain=S.Reals`

. Complex numbers are a superset of real numbers: here, neither of the two complex solutions is a real number, so you get `EmptySet`

, which means that the equation has no real solution.

1 Like