Consider the following sentences which utilizes the mathematical factorial operation:
The answer is 5!.
or
The equation is given by
f(x) = (x+4)!.
Typically in mathematical writing, an expression in a sentence is treated as a word and is therefore punctuated accordingly. But in this case, a period following an exclamation point looks awkward. Would a period still be used here to indicate the end of the sentence?