Summation where upper bound is a function? 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?
 A: 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}$$
A: WAs proposed  result is  not  that   plausible, since we might rather assume in such cases $x$ being a real number.

According to rules when using the sigma-symbol $\sum$ we have for real  $x\geq 1$:
  \begin{align*}
\color{blue}{\sum_{n=1}^{x^2} n}&=\sum_{n=1}^{\lfloor x^2\rfloor} n\\
&=1+2+\cdots+\lfloor x^2\rfloor\\
&\,\,\color{blue}{=\frac{1}{2}\left\lfloor x^2\right\rfloor\left(\left\lfloor x^2\right\rfloor+1\right)}
\end{align*}
  where $\lfloor  a\rfloor$ is the greatest integer less or equal to $a$. See for instance   chapter 2: Sums , section 2.1 Notation in Concrete Mathematics
  by R.L. Graham, D.E. Knuth and O. Patashnik.

In the more general case we have, assuming $f(x)\geq 1$:
\begin{align*}
\sum_{n=1}^{f(x)}g(n)=\sum_{n=1}^{\left\lfloor f(x)\right\rfloor}g(n)=g(1)+g(2)+\cdots+g\left(\left\lfloor f(x)\right\rfloor\right)
\end{align*}
Note: We additionally have the rule $\sum_{n=a}^{b}f(n)=0$ if $b<a$ (see the referenced book).
A: The summation function works as the upper limit is an integer. In fact the sum is: $S_n=\frac{n(n+1)}{2}$. So if $n=f(x)$ then: $S_{f_{(x)}}=\frac{f_{(x)}(f_{(x)}-1)}{2}$.
