I have problem with integration an differentiation. I've tried to plot the differentitaion of x^2
plt.plot(0.5*(x[:-1]+x[1:]), np.diff(x**2, 1)/np.diff(x, 1))
And it worked. After I wanted to find the integral of x^2 times differentiation of x^2:
x = np.linspace(0, 1, 1000)
result = spi.simps(x**2 * np.diff(x**2/np.diff(x,1)), x)
print(result)
But i got a ValueError: operands could not be broadcast together with shapes (1000,) (999,)
And I've also tried instead of x = np.linspace(0, 1, 1000) use x = 0.5*(x[:-1]+x[1:]), but no chance.
Any help would be appreciated.