The notion of multiplicity in algebraic geometry Let $A$ be a commutative ring. Let $f\in A\setminus\{0\}$ and $I\subseteq A$ any ideal. I would like to define the multiplicity of $f$ at $I$ as 
$$\mu_f(I):= \max\{\, d\ge 0 \mid f\in I^d\,\},$$
where $I^0:= A$. In the case where $A$ is Noetherian and either local or an integral domain, the Krull Intersection Theorem (Eisenbud, Corollary 5.4) implies that $\mu_f(I)$ is well-defined. Main scenario: $A$ is the local ring of a locally Noetherian scheme $X$ at some point $P$, $I$ is the corresponding maximal ideal and $f$ is locally representing a Cartier divisor on $X$. 
I have only seen this in Hartshorne, Page 388, for surfaces, but I do not see why the definition should be limited to surfaces. In general, I only know the following definition of geometric multiplicity, for locally Noetherian schemes $X$ and points $P\in X$ of codimension one: 
$$\bar\mu_f(P):=\mathrm{length}_{\mathcal O_{X,P}}(\mathcal O_{X,P}/(f))$$
Does this coincide with the above definition? If yes, why is $\bar\mu$ so prominent? After all, $\mu$ is more general.
 A: In addition to two good answers, maybe one case the question has a positive answer is when $(R,m)$ is a regular local ring and $f$ is a nonzero element. For a Noetherian local ring $A$ and ideal $I$ which is primary to the maximal ideal, let $e(I, A)$ denote the Hilbert-Samuel multiplicity of $A$ with respect $I$. Then $e(m/(f),R/(f)) = \hbox{ord} (f) e(m, R) = \hbox{ord} (f)$ where $\hbox{ord} (f) = \sup \{ i \mid f \in m^i \}$. Here $e(m, R) = 1$ since $R$ is a regular local ring.
The special case is when the dimension of a ring (not necessarily regular) $R$ is $1$ and $f$ is a non zero-divisor (but not a unit) of $R$. Assume that $R$ is Cohen-Macaulay (domain or reduced implies Cohen-Macaulyness in dim $1$). Then we have that length $(R/(f)) = e((f), R) \ge \hbox{ord} (f) e(m,R)$ where the last inequality follows from Theorem 14.10 in Matsumura's commutative ring theory. A positive answer to your question implies an equality in the formula and $e(m,R) = 1$. The latter condition is equivalent to $R$ being regular if $R$ is unmixed. Note that the associated graded ring is a polynomial ring over the residue field if a ring is regular. In particular, it is a domain. I believe that once $R$ is a regular local ring, then the equality follows.
I believe in Hartshorne's algebraic geometry book, a surface is a nonsingular (locally regular) projective surface over an algebraically closed field. This probably is a reason why it works well. I hope someone can add some geometric point of view. 
A: The definitions do not coincide for $P$ a cusp. That is, consider the ring $k[t^2,t^3]$ and $I=(t^2, t^3)$. Then if $f=t^4$ the length is $3$ but the power is true. It agrees when the local ring is a DVR.
A: One possible issue is that your multiplicity function is not in general a valuation. Indeed, for a noetherian ring $A$ and an ideal $I$ with respect to which $A$ is separated, $\mu_I$ is a discrete valuation of rank one if and only if the associated graded ring $\mathrm{gr}_I(A)$ is an integral domain. May be, one reason why the function becomes less interesting if this is not the case is that often one would like to understand the localization $A_I$ as the valuation ring with respect to $\mu_I$ (at least if $I$ is prime), but this is not always possible: given a regular ring $A$ and a maximal ideal $\mathfrak{m}$ in it, your function $\mu_\mathfrak{m}$ is a discrete valuation of rank 1 whenever $\mathfrak{m}\neq 0$ but if you drop these hypothesis this fails (as can be seen in Will Sawin's answer): moreover, the valuation ring is described explicitly as $A[\mathfrak{m}/x]_{(x)}$ for any $x\in\mathfrak{m}\setminus\mathfrak{m}^2$.
I suggest giving a look at chapter 6.7 of I. Swanson, C. Huneke Integral Closure of Ideals, Rings and Modules, London Math. Soc. Lecture Notes Series 336, which can be found  here . The above results are Theorems 6.7.8 and 6.7.9, respectively.
