Integrating the step-wise integer function 1/[x]

758 Views Asked by At

I'm trying to find the integral, respective to $x$, of a function that utilizes the step-wise integer (or floor) function.

$$\displaystyle z = \int {1 \over [[x]*1.1^{[y]}]+1}$$

It's for modelling a game simulation, but it's more of a math than programming question. I'm confused because there isn't exactly a direct correlation between an integral for a regular function of x and an integer[x] function of x.

For example, the integral of $[x]$ is $ \displaystyle ([x]^2-[x])\over 2$ (which is the summation).

I know that the integral of $1/x$ is $ln(x)$, but it isn't straightforward for $1/[x]$. I mean- it seems like the integral of the harmonic series, $ln(x+1)$, should be my starting point (since this is a general harmonic series)- but the corresponding table doesn't work out.

It doesn't even work out for $1/x$ in a way that makes any sense to me- IE, $1/1+1/2 = 3/2 \not= ln(2+1)$

Under normal integration rules I should get this (i think)- $\displaystyle \frac{ln([[x]*1.1^{[y]}]+1)} {1.1^{[y]}} + C$, but it doesn't line up. I need to make a pretty 3d-graph, so generating a summation table for salient values of $x$ ($1$ to $20$ or so) isn't helpful (at least- my 3d grapher won't smooth it). How can I accurately represent this as a function for graphing purposes? Any recommended software?

Or am I going in completely the wrong direction? IS this not an integration problem?

Thanks!

1

There are 1 best solutions below

3
On

Generally the floor will convert the integral to a sum, as you hint at in your question, because the function will be constant over a unit range of $x$. So assuming $a,b$ naturals, $\int_a^b \frac 1{\lfloor x \rfloor} dx=\sum_{i=a}^{b-1} \frac 1i=H_{b-1}-H_{a-1}$ where the $H$'s are harmonic numbers. In two dimensions the same thing happens: each square has the floors of $x$ and $y$ fixed, so you can just compute the value and sum all those. If your boundary doesn't follow lattice lines, you have to figure out how much of each square is included.