Q:

What is this function?

In python I made this function:
def f(x):
    eqStr = ''
    for y in range(int(x)):
        eqStr += 'x**%s + ' % (y)
    eqStr += '0'
    return eval(eqStr)

for those who can't read it, what it does is it takes in a number, x, and creates a string (a group of words). Now for y in a list from 0 to x-1 (inclusive) append x^y + onto the string. At the end add a zero to fix the last plus. Now compute the string and return it to me.
This is the plot of the function:

I don't know what this function is and would like to know if it has a name, and if there is a more mathematical way of writing my function.

A:

Unless there is some hidden Python-specific point to doing it as string manipulation instead of summing the powers directly, you're computing
$$ f(x) = x^0+x^1+\cdots +x^{x-1}$$
By the usual rule for a finite geometric series this is the same as
$$ f(x) = \frac{x^x-1}{x-1} $$
If $x$ is not necessarily an integer, round it appropriately in the exponent:
$$ f(x) = \frac{x^{\lfloor x\rfloor}-1}{x-1} $$

