I was attempting to understand asymptotic expansions when I came across this simple expression: $$ \sum_{n=1}^{x^2}n. $$
Of course, being an amateur mathematician, I threw it into Wolfram to see what it would say. To my surprise, it spit out an equation: $\sum_{n=1}^{x^2} n = \frac{1}{2} x^2 (x^2 + 1)$! My question is how? I attempted to approximate this sum by an integral, but I didn't quite get the right results:
$$ \sum_{n=1}^{x^2}n \approx \int_1^{x^{2}} ndn \\ \int_1^{x^{2}} ndn = \frac{n^2} {2}|_{1}^{x^2} = \frac{1}{2}(x^4-1) $$
Is it applying the Euler–Maclaurin formula? Or is there some other formula or simple manipulation I just don't see?
Furthermore, as an aside, what can we say about functions of the form $$ \sum_{n=1}^{f(x)}g(n)? $$
Do they have simple expansions? What can we say about them?
It is known that $$\sum_{n=1}^{u} n = \frac{u(u+1)}{2}$$
Plugging in $u = x^2$, we have that $$\sum_{n=1}^{x^2} n = \frac{x^2(x^2+1)}{2}$$