Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts

Wednesday, March 4, 2009

some latex constructs

here are some common constructs i use that i find myself frequently looking up. the first is the parallel symbol used in the Kullback-Leibler divergence. just using a pair of vertical bars squeezes the arguments together, but the \parallel puts the necessary space before and after the bars. below is the definition of skewed Kullback-Leibler divergence.


D_{SKL}(p,q) = D_{KL}\left(p \parallel \gamma p + (1-\gamma)q\right)


a similar problem occurs with conditional probabilities. \mid takes care of that. the next example uses Bayes' theorem, with a little \frac business for flavor.


P(A \mid B)=\frac{P(B \mid A)P(A)}{P(B)}


i use an old homework to show how to used the cases environment. each line can have only 1 &, which separating the result and the condition. not that the "amsmath" package needs to be loaded, or else you'll get funky "Misplaced alignment tab character &" errors. i use the \text command to get normal script in the math environment. (in the homework, i was referring to Prototype-driven grammar induction, by Haghighi and Klein)


P(p_{ij} \mid X) =
\begin{cases}
0.6 & \text{if $p_{ij}=X$}\\
\text{uniform} & \text{otherwise}
\end{cases}


that's it for now. if any latex stuff comes up, and i think it's interesting (or that i might need it for future reference), i'll be posting.

Wednesday, February 25, 2009

latex

so, as a result of my total immersion approach to \LaTeX for the last couple of semesters, i've grown rather fond of the typesetting system.

actually, i've wanted to post a couple of items about latex, or at least that included latex. that blogger doesn't handle latex natively has held me back, though. that and laziness. (the internet was all the way over there, and i was all the way over here.)

but i finally searched and found something to facilitate the scratching of this itch. yourequations.com provides a javascript latex render. color me excited. so, here's me stretching my muscles:

{n \choose k} \left( r(1-r)^{g-1} \right)^k \left( \sum_{i=0}^{n-k} {n-k \choose i} (1-r)^{ig} \left( r^2(1-r)^{g-2} \right) ^{n-k-i} \right)


this added ability has also necessatated an update of the blog's look. i liked the black background, but i'll survive.

of course, i say that i'll post more often, but this is in no way suggestive of actual change, nor is it in any way legally binding.