Solving $\frac{d f(x)}{dx} + f(x-1) = x^2$ Given following differential equation:
$$\frac{d f(x)}{dx} + f(x-1) = x^2$$
where $ f(x)=0 $ for $x \leq 0 $. How do I find the solution for $ x \geq 0 $ ?
I understand that for  $ 0 \leq x \leq 1 $ the solution is $ f(x)= \frac{x^3}{3} $.
 A: I think Laplace transform can help here. Let $F(p)={\cal L}(f)(p)$ be the Laplace transform of the unknown function $f$. The proposed equation becomes
$$pF(p)+e^{-p}F(p)=\frac{2}{p^3}$$
Hence
$$F(p)=\frac{2}{p^4}\frac{1}{1+e^{-p}/p}=2\sum_{n=0}^\infty(-1)^n\frac{e^{-np}}{p^{n+4}}$$
So, 
$$f(x)=2\sum_{n=0}^\infty\frac{(-1)^n}{(n+3)!}\left((x-n)^+\right)^{n+3}$$
where $(x-n)^+=\max(0,x-n)$.
A: On $[0,1]$, the differential equation reduces to $\frac{d}{dx}f(x)=x^2$, which can be solved: $f(x)=\frac13x^3+C$. If the solution is continuous, then $C=0$.
Then on $[1,2]$, the differential equation reduces to  $\frac{d}{dx}f(x)=x^2-\frac13(x-1)^3$. So $f(x)=\frac13x^3-\frac1{12}(x-1)^4+C$. To be continuous at $1$, $C$ must be $0$.
Now on $[2,3]$, the differential equation reduces to  $\frac{d}{dx}f(x)=x^2-\frac13(x-1)^3+\frac1{12}(x-2)^4$. And repeat. (Yielding $f(x)=\frac13x^3-\frac1{12}(x-1)^4+\frac1{60}(x-2)^5$.)
It would appear that on $[n,n+1]$, that $f(x)=\sum_{k=0}^{n}(-1)^n\frac{2}{(n+3)!}(x-k)^{k+3}$. Induction could formally prove this.
