When writing in math, do you use a comma or colon preceding an equation? This is a general question about mathematical writing especially for writing research papers and the like.


  Question: Do you precede an equation with a comma or colon?


Example A:


The following equation is the Yosida-Hawking-Penrose-Dantzig function
\begin{equation}
f(x) = \frac{1}{2} D_\alpha(x,y)
\end{equation} 
The following equation is the Yosida-Hawking-Penrose-Dantzig function,
\begin{equation}
f(x) = \frac{1}{2} D_\alpha(x,y)
\end{equation} 
The following equation is the Yosida-Hawking-Penrose-Dantzig function:
\begin{equation}
f(x) = \frac{1}{2} D_\alpha(x,y)
\end{equation} 


Example B:


In fact, we can express the earlier function using a much simpler expression
\begin{equation}
f(x) = \varphi(x,y) 
\end{equation} 
where $\varphi(x,y)$ is the Demiane functional
In fact, we can express the earlier function using a much simpler expression,
\begin{equation}
f(x) = \varphi(x,y) 
\end{equation} 
where $\varphi(x,y)$ is the Demiane functional
In fact, we can express the earlier function using a much simpler expression:
\begin{equation}
f(x) = \varphi(x,y) 
\end{equation} 
where $\varphi(x,y)$ is the Demiane functional


Can anyone comment on which one is the best practice?
Generally, I would treat the equation as if it were any ordinary noun phrase, and use the usual rules for comma, colon, or no punctuation.

A colon is used if the equation is an elaboration, or an item.  So, just as you might write


  Lips are characterized by the following properties: fleshy, paired, red.


you would write


  An ellipse is characterized by the following equation:
  
  $$ \frac{x^2}{a^2}+\frac{y^2}{b^2} = 1 $$


A comma precedes a non-restrictive clause (one that describes rather than identifies the noun phrase), so by analogy with


  The line can be assigned to a simpler character, Polonius.


we might write


  A line can be described with a simpler equation,
  
  $$ y = mx+b $$


In comparison, with a restrictive clause, we use no comma, so just as we would write


  From this, the oiler obtained the formula CH$_3$C$_6$H$_4$C$_2$H$_5$.


we would also write


  From this, Euler obtained the formula
  
  $$ e^{i\pi}+1 = 0 $$


I suspect there aren't any hard and fast rules for this, however.  Whatever you choose to do, be consistent and reasonable.



ETA: You'll notice that I have no periods at the ends of these equations.  The papers I have generally (though not universally) observe this pattern.  However, in other fields, equations may have ending punctuation depending on how they occur within a sentence.  It may be useful for a writer to consult the publication's style guide, if applicable, or at least examine previous articles within the same publication or outlet.
I was told to use correct punctuation as defined by grammatical rules, but to always place the equation or formula on a line of its own, even if this meant starting a line with a punctuation mark. Even though the layout may look a little odd there can be no confusion as to the meaning. While it would be very rare for a comma to be misconstrued imagine the confusion an exclamation mark would cause.