Repository: sympy/sympy

Issue:
Incorrect result from minpoly(cos(pi/9))
I believe that sympy returns the incorrect answer for `minpoly(cos(pi/9))`.

sympy 1.8 and sympy gamma (as of 05/12/2021) return `8*x**3 - 6*x + 1`, but the correct answer is `8*x**3 - 6*x - 1` which I verified by hand and with [Wolfram Alpha](https://www.wolframalpha.com/input/?i=minpoly%28cos%28pi%2F9%29%29).

```py
In [1]: from sympy import *

In [2]: x=symbols("x")

In [3]: p=minpoly(cos(pi/9),x)

In [4]: p
Out[4]: 8*x**3 - 6*x + 1

In [5]: N(p.subs(x,cos(pi/9)))
Out[5]: 2.00000000000000

In [6]: p=8*x**3 - 6*x - 1

In [7]: N(p.subs(x,cos(pi/9)))
Out[7]: 0.e-124
```

I think the bug is [here](https://github.com/sympy/sympy/blob/82cc5a598f236b32b5f7adf530802503c121b080/sympy/polys/numberfields/minpoly.py#L440), the code should be `return 8*x**3 - 6*x - 1`

Discussion:

Patch:
diff --git a/sympy/polys/numberfields/minpoly.py b/sympy/polys/numberfields/minpoly.py
index 797a2af205..1b62e1e6b5 100644
--- a/sympy/polys/numberfields/minpoly.py
+++ b/sympy/polys/numberfields/minpoly.py
@@ -437,7 +437,7 @@ def _minpoly_cos(ex, x):
                 if c.q == 7:
                     return 8*x**3 - 4*x**2 - 4*x + 1
                 if c.q == 9:
-                    return 8*x**3 - 6*x + 1
+                    return 8*x**3 - 6*x - 1
             elif c.p == 2:
                 q = sympify(c.q)
                 if q.is_prime:


Test patch:
diff --git a/sympy/polys/numberfields/tests/test_minpoly.py b/sympy/polys/numberfields/tests/test_minpoly.py
index ee202b9146..e61cfe6152 100644
--- a/sympy/polys/numberfields/tests/test_minpoly.py
+++ b/sympy/polys/numberfields/tests/test_minpoly.py
@@ -273,7 +273,7 @@ def test_minpoly_compose():
             2816*x**6 - 1232*x**4 + 220*x**2 - 11
     assert minimal_polynomial(sin(pi/21), x) == 4096*x**12 - 11264*x**10 + \
            11264*x**8 - 4992*x**6 + 960*x**4 - 64*x**2 + 1
-    assert minimal_polynomial(cos(pi/9), x) == 8*x**3 - 6*x + 1
+    assert minimal_polynomial(cos(pi/9), x) == 8*x**3 - 6*x - 1
 
     ex = 2**Rational(1, 3)*exp(2*I*pi/3)
     assert minimal_polynomial(ex, x) == x**3 - 2