i'm trying to make a polinomial calculator in which i can insert the largest coefficient, problem is, the xizes variable, that would be the image of the function is coming as multiple arrays, therefore the function graphic (using matplotlib) is coming like this (this is a third degree polynomial(x³+x²+x¹+x^0)): https://i.sstatic.net/2NGz6.jpg
is there a way to sum up the elements of each array? that would solve the problem
Here's the code:
expoente = int(input("insira o grau do polinomio (numero inteiro): "))
expoente = expoente+1
intervalo_1 = float(input("insira o intervalo desejado \n(ponto inicial): "))
intervalo_2 = float(input("(ponto final): " ))
expoentes = range(0, expoente)
expoentes = [item*1 for item in expoentes]
quantidade = (intervalo_2 - intervalo_1)*500
x = np.linspace(intervalo_1,intervalo_2,num=quantidade,endpoint=False)
xizes = [item**expoentes for item in x]
plt.plot(x,xizes, label="Grafico do polinomio")
plt.xlim([intervalo_1,intervalo_2])
plt.show()