I have constructed the following code using MATLAB:
numero=60;
a=zeros(numero,1)
b=zeros(numero+1,1)
for i=1:numero+1
a(i)=-cos(pi*(i-1)/numero)
end
figure
plot(a,b, '*')
It serves to calculate the nodes of a Chebyshev polynomial of order numero and store it in a vector called a.
I need to reproduce this in Python. My attempt at a solution is
from mpmath import chebyt, chop, taylor
import numpy as np
import sympy as sp
numero=60
nodes = []
for i in range(numero+2):
auxiliary=-np.cos(np.pi*(i-1)/numero)
nodes.append(auxiliary)
[float(i) for i in nodes]
nodes.sort()
print(nodes)
However, there are is an issue in python's output. The first is the fact that the second number of the list, -0.9986295347545738 appears twice, it is also the third element of nodes. I don't know why this happens and I would like to know if someone can tell me how to avoid this error.