Some languages have long sentences with lots of commas, but English does not have the grammar to support this. Rather, sentences should be short and sharp. Russians say that English people sound like barking dogs. A common fear is to avoid losing the context by finishing the sentence, leading the author to put a comma and run on with another one. There is no need to be afraid of that because words will still remain active for a short while after the period.
Commas are especially important but hard to give rules for.
Very often a fresh sentence would be better. Try not to begin or end a sentence with a math symbol. More precisely, try to avoid math symbols clashing with textual punctuation. The exception to this is displayed equations, where the general rule is to put commas and if necessary a final period, so that one can read through the displayed equation like text. The displayed equation is half-way to a table so should be laid out for visual clarity and without unnecessary text.