# Finding the integral for function with floor

I am trying to find the integral $$\int_0^n f(x)dx$$

where

$$f(x) = 2ax - {1 \over 2}a^2 - {1 \over 2} a$$

and

$$a = \left\lfloor {x \over \phi^2} \right\rfloor$$

and

$$\phi = {1 + \sqrt 5 \over 2}$$

I know how to do a basic integral, but I'm not sure how to handle the floor function.

Basically the floor function will make your function look like a step function with many discontinuities. I will assume that $\phi^2|n$.
The thing to do is to notice when the steps happen. That is every $\phi^2$ I believe. Therefore you need to split the region of integration in as many steps you will have for $x\in [0,n]$.
Then integrate each separately. You should notice that at each step, $a$ takes the values $0,1,2,3,...$.
So split the integral, find a general solution for any integer $a$ and then sum the solutions over all possible $a$ constant.
The general case will be: $$\int_{a\phi^2}^{(a+1)\phi^2} 2ax - \frac12a^2 - \frac12a \,dx = \phi^4(2a^2-a) - \frac12\phi^2(a^2+a) = f(a)$$
So the solution is $$\sum_{a=0}^Nf(a)$$ Where $N = \frac{n}{\phi^2}$. Generally, $\phi^2\not|n$ so will will have to add what hasn't been included to the sum.