Construct a specific function for a given sequence Given the sequence $A_n=n$, I want to construct a function $f : R \to R$, such that for every $x \in N$:


*

*$f(x)=A_x$

*$\int\limits_{0}^{x}f(t)dt=\sum\limits_{i=0}^{x}A_i$


How can do that?
Thanks
 A: Baisically, you need  for every $x\in\mathbb{N}$ that:
$$\int_{0}^x f(y) dy=\sum_{i=0}^xA_i=\frac{x(x-1)}{2}$$
Choose $f(x)$ to be $x-\frac{1}{2}$ (I got that by differentiating). Finally t satisfy the condition $\forall x\in \mathbb{N} [f(x)=A_x]$ $\,\,\,$just change the value of $f(x)$ to be $x$ for every $x\in \mathbb{N}$. This will not change the integral of $f$ since $\mathbb{N}$ as a subset of $\mathbb{R}$ has a Lebesgue measure of zero.
A: It is enough to construct $f$ such that $f(n)=A_n$ for $n=0,1,2,...$ and 
$$\int_{n}^{n+1} f(t)\, dt=A_{n+1}\quad \hbox{for all}\; n\geq 1 $$
Let $(c_n)$ be a sequence of real numbers to be chosen later, and define $f$ as follows: on every interval $[n,n+1]$, $f$ is the unique polynomial function of degree $2$ such that $f(n)=A_n$, $f(n+1)=A_{n+1}$ and $f(n+\frac 12)=c_n$.
The explicit formula for $f$ on $[n,n+1]$ is (Lagrange's interpolation formula)
$$f(t)=2A_n (t-n-1/2)(t-n-1)-4c_n (t-n)(t-n-1)+ 2A_{n+1}(t-n)(t-n-1/2)\, .$$
So we have 
$$\int_{n}^{n+1} f(t)\, dt = \alpha_n \, c_n +\beta_n\, ,$$
where $\alpha_n$, $\beta_n$ do not depend on $c_n$. The coefficient $\alpha_n$ is equal to 
$$\alpha_n=\int_n^{n+1} (t-n)(t-n-1)\, dt\, , $$
and it is not hard to check that $\alpha_n\neq 0$. So one can choose $c_n$ in such a way that
$$\alpha_n c_n+\beta_n=A_{n+1}\, .$$
Then your function $f$ has all the required properties.
Note that the actual value of $A_n$ is irrelevant because the coefficients $\beta_n$ do not depend on the $A_n$.
Note also that $f$ is continuous. With a little more work, one could produce a $\mathcal C^\infty$ function $f$ satisfying the requirements.
