Shafarevich, in Basic Algebraic Geometry I, makes the following definition, which I'm having trouble understanding in a concrete example. Let $X$ be a variety, nonsingular in codimension 1, and let $C$ be an irreducible codimension 1 subvariety. Let $U$ be some affine open subset of $C$, which consists of nonsingular points, and such that $C$ is defined by some local equation in $U$. Then the ideal of $C$ in $k[U]$ is $(\pi)$. On the way to defining the divisor associated to a rational function $f \in k(X)$, he defines $\nu_C(f)$ to be the nonnegative integer $r$ such that $f \in (\pi^r)$ but $f \not\in (\pi^{r+1})$, and proves that this is well-defined and independent of the choice of affine neighborhood.
I'm trying to understand this definition in a concrete example. Let $C$ be the prime divisor $Z(x_0)$ in $\mathbb{P}^n$, and let $f \in k[D(x_0)]$ have degree $d$. Then a local equation of $C$ in $D(x_i)$ is $x_0/x_i$, so to calculate $\nu_C(f)$, I need to find an integer $r$ such that $(x_0/x_i)^r$ divides $f$ in $k[D(x_i)]$. But looking at explicit $f$ makes this not seem possible to me. For instance, how could $f \in k(\mathbb{P}^2)$ defined by $f=\frac{x_1^2+x_1x_2}{x_0^2}$ be expressed as a multiple of $(x_0/x_1)^r$ in $k[D(x_1)]$? Am I confusing the definition?
Exactely, if $f$ is a rational function over $C$, then $\nu_C(f)$ is defined as $\nu_C(h)-\nu_C(g)$ where $f=\frac{h}{g}$ and $h,g$ are both regular funtions over $X$.
In your case, we can write $f$ as $(1+\frac{x_2}{x_1})/(\frac{x_0}{x_1})^2$, so $\nu_C(f)$ is $-2$.