raindrops

## Math in raindrops

TeX (pronounced as teq or tec) is an invention of Prof Knuth (Stanford) who brought in typography into the mathematics, science, and engineering. Through Tex, he taught many of us beauty and aesthetics -- our first exposure to the creative arts. LaTeX is built on top of TeX

Raindrops has `MathJax`

integrated into it. You can type math inline, in a sentence by enclosing it with the dollar sign. For example,

```
It is well known that $\lim_{x->0}\sin(x)/x = 1$
```

It will be typeset as: $\lim_{x->0}\sin(x)/x = 1$

Sometimes, you may want to display the math. This comes out centered in a line of it own.

```
$$\int x^2 dx = x^3/3$$
```

$$\int x^2 dx = x^3/3$$

raindrops

```
Geometric mean would be $\sqrt{ab}$. Note the braces.
```

Geometric mean would be $\sqrt{ab}$.

```
And of course, $\alpha \beta \gamma$
```

And of course, $\alpha \beta \gamma$

```
What about sum? $\sum_{k=0}^{n} k = n(n+1)/2.$
```

What about sum? $\sum_{k=0}^{n} k = n(n+1)/2.$

It doesn't look too good. Let us try

```
$\sum\limits_{k=0}^{n} k = n(n+1)/2.$
```

And we get $\sum\limits_{k=0}^{n} k = n(n+1)/2.$ Which looks much better!

raindrops

```
You could also write $1+2+\cdots +n = n(n+1)/2$
```

to get $1+2+\cdots +n = n(n+1)/2$.

```
Or even $$1+2+ \cdots +n= \frac{n(n+1)}{2}$$ to get
```

$$1+2+ \cdots +n= \frac{n(n+1)}{2}$$

which looks grand.

**Equations** : You can also set equations like this.

```
\begin{equation}
\sum_{k=1}^n k^2 = 1+4+9+\ldots +n^2 = \frac{1{3}n^3 + \frac{1}{2}n^2 + \frac{1}{6}n
\end{equation}
```

to get \begin{equation} \sum_{k=1}^n k^2 = 1+4+9+\ldots +n^2 = \frac{1}{3}n^3 + \frac{1}{2}n^2 + \frac{1}{6}n \end{equation}

raindrops

Here is another equation. \begin{equation} \sum_{k=1}^n k = 1+2+3+\ldots +n = \frac{1}{2}n^2 + \frac{1}{2}n \end{equation}

Note: Using equation mode automatically numbers the equations correctly in the view. But unfortunately not in the preview. At least not yet.

Finally, you can use equation array as well. Just be careful on what constitutes backslash. You need to escape them.

```
\begin{eqnarray}
y &=& x^4 + 4 \nonumber \\\\
&=& (x^2+2)^2 -4x^2 \nonumber \\\\
&\le&(x^2+2)^2
\end{eqnarray}
```

\begin{eqnarray} y &=& x^4 + 4 \nonumber \\ &=& (x^2+2)^2 -4x^2 \nonumber \\ &\le&(x^2+2)^2 \end{eqnarray}

raindrops

**Macros** : How can we use macros within the raindrop? All we have to do is to include the macros within say the math mode. Here is an example.

```
$$
\newcommand{\mybold}[1]{\bf #1}
$$
```

$$ \newcommand{\mybold}[1]{\\bf #1} $$

And then `$\mybold{a}$`

gives $\mybold{a}$!

Here is a useful link that should tell you a lot about math mode in LaTeX.

Experiment away!