Testing latex on discourse

I want to see if I can write equations in discourse.
For example:
a=b^2
$$\sum_{i=1}^n a_i = S_n$$

It should work now.

$y = x^2$

$\left\langle a \right\rangle = a[n - 1:0]$

$ (A + B) =  (A \wedge B) = (A \mathrm{~OR~} B)$

renders as

y = x^2

\left\langle a \right\rangle = a[n - 1:0]

(A + B) = (A \wedge B) = (A \mathrm{~OR~} B)

$$

y = x^2\\
\left\langle a \right\rangle = a[n - 1:0]

$$

renders as

y = x^2\\ \left\langle a \right\rangle = a[n - 1:0]

trying:
\sum_{i=1}^n x_i = S_n
$$\sum_{i=1}^n x_i = S_n$$

Double dollar signs work only if the expression and the $$ are on different lines. For inline you need to you single $.