Artificial intelligent assistant

Is there something wrong with my interchanging of sums and integrals? > Is there something wrong with my interchanging of sums and integrals? Consider $$\sum_{n\leq x}a_n(x-n)=\int_1^xA(t)dt,$$ where $A(x)=\sum_{n\leq x}a_n$. If I choose $a_n=2n$, then $A(x)=x(x+1)$ assuming x is a positive integer and $$\sum_{n\leq x}a_n(x-n)=xA(x)-2\sum_{n\leq x}n^2=\frac{1}{3}x^3-\frac{1}{3}x$$ and $$\int_1^xA(t)dt=\int_1^x(t+1)tdt=x^3/3+x^2/2-5/6.$$ I don't know what went wrong.

The error is in the integral. When you use partial summation, you work with integers. So, in your case$$\int_{1}^{x}A\left(t\right)dt\
eq\int_{1}^{x}\left(t+1\right)tdt$$ but, since you're working now in an continuous context,$$\int_{1}^{x}A\left(t\right)dt=\int_{1}^{x}\left(\left\lfloor t\right\rfloor +1\right)\left\lfloor t\right\rfloor dt$$ where $\left\lfloor t\right\rfloor$ is the integer part of $t$ (or floor function). As copper.hat suggested, working with $x$ real makes problem because you are obligated to work with the floor function even out of the integral (note that in the integral case is inevitable).

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy fb2bb93a182e01b4f13185405ce97fc7