Is there a math function for $x + x^2 + x^3 + x^4 + x^5 + \cdots$? I'm a UI programmer and I've trying to calculate an effect related to mouse scroll.  The behavior I'm noticing is equivalent to
$$x + x^2 + x^3 + x^4 + x^5 + \cdots$$
For the purposes of my app, I only need to go to like $x^3$ before the result is close enough, but I'm wondering if there is a mathematical function or operator, ideally one build into common programming languages, designed for this kind of thing that has greater precision.
Thanks!
 A: It is a geometric series and it can be expressed as it follows (for $|x| < 1)$
\begin{align*}
& S(x)  = x + x^{2} + x^{3} + \ldots \Rightarrow xS(x) = x^{2} + x^{3} + x^{4} + \ldots \Rightarrow\\\\
& S(x) - xS(x) = S(x)(1 - x) = x \Rightarrow S(x) = \frac{x}{1-x}
\end{align*}
A: I am going to expand on the answer already posted.  Feel free to skip the details in my post and read the last line below.
If $x$ is a number between $-1$ and $1$, then you can calculate the infinite sum $x + x^{2} + x^{3} + \dots$.
If we set $$m =x + x^{2} + x^{3} + \dots \,\,\,\,\,\,\,\,\,\,\,\,\,\,(1)$$ then clearly, multiplying both sides of (1) by $x$, we get $$m\cdot x = x^{2} + x^{3} + \dots.$$  This means we can rewrite the original expression (1) as $m = x + m\cdot x$, and isolating the $m$ gives $m - m\cdot x = x$, i.e., $m(1 - x) = x$, so that we can solve for $m$:  $m = \frac{x}{1-x}$.
All of this to say if $x$ satisfies $-1 < x < 1$, then the infinite sum $x + x^{2} + x^{3} + \dots$ can be calculated simply as $\frac{x}{1 - x}$.
