Long formula looks bad - suggestions?

  • Context:
  • Thread starter Thread starter Jameson
  • Start date Start date
  • Tags Tags
    Formula Suggestions
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 3K views
Jameson
Insights Author
Gold Member
MHB
Messages
4,533
Reaction score
13
I'm currently writing up a homework assignment on a Hidden Markov Model. This involves long strings of conditional probability formulas and lots of subscripts. Here is an example of one that I think is really hard to read. Any ideas how I can condense the spacing in the subscripts or make it more readable?$\small{P[O,o_{1001}=6,q_{1001}=F] = \\
\Big( P[O,q_{1000}=F]P[q_{1001}=F|q_{1000}=F,\lambda]+ P[O,q_{1000}=L]P[q_{1001}=F|q_{1000}=L,\lambda] \Big) P[o_{1001}=6|q_{1001}=F,\lambda]\\= \Big(a\cdot 0.99+b\cdot 0.20\Big)\dfrac{1}{6} } $
 
Physics news on Phys.org
Anywhere you wish to reduce spacing you can use the \! command to introduce a negative thin space. I wrapped the equal signs within brackets with this command on either side:

$$\small{P[O,o_{1001}\!=\!6,q_{1001}\!=\!F] = \\
\Big( P[O,q_{1000}\!=\!F]P[q_{1001}\!=\!F|q_{1000}\!=\!F,\lambda]+ P[O,q_{1000}\!=\!L]P[q_{1001}\!=\!F|q_{1000}\!=\!L,\lambda] \Big) P[o_{1001}\!=\!6|q_{1001}\!=\!F,\lambda]\\= \Big(a\cdot 0.99+b\cdot 0.20\Big)\dfrac{1}{6} }$$

I'm not sure if that's what you're after though. :D
 
That helps! Thank you Mark.

I think I should investigate making the given line "|" more pronounced and perhaps making the [] brackets bigger. I'll try playing around with those and see what I find.

Another issue is that I would like to use an align environment to nicely stack the equations but since they get so long I can't think of an elegant way to do this. Does anyone think stacking these with the equals sign lining up would look better, even with line breaks within a step?
 
Seems to me much of the horizontal space is taken up by the long 1001, 1000 subscripts. Is there a way to condense those into shorter variables, especially since only two of the subscripted variables seem to be used? Then having each expression on a new line with the equals sign lined up would work fine, I think.

I mean, long formula going to be long, but if you can trim unnecessarily long variables that should be a win.
 
Something like this?

$$\begin{array}{ll} \small{P\Big[O,o_{1001}\!=\!6,q_{1001}\!=\!F\Big]} & \\ & =\small{\Bigg(P\Big[O,q_{1000}\!=\!F\Big]P\Big[q_{1001}\!=\!F\Big|q_{1000}\!=\!F,\lambda\Big]+ P\Big[O,q_{1000}\!=\!L\Big]P\Big[q_{1001}\!=\!F\Big|q_{1000}\!=\!L,\lambda\Big]\Bigg)P\Big[o_{1001}\!=\!6\Big|q_{1001}\!=\!F,\lambda\Big]}\\&= \small{\Big(a\cdot 0.99+b\cdot 0.20\Big)\dfrac{1}{6}} \end{array}$$
 
MarkFL said:
Something like this?

$$\begin{array}{ll} \small{P\Big[O,o_{1001}\!=\!6,q_{1001}\!=\!F\Big]} & \\ & =\small{\Bigg(P\Big[O,q_{1000}\!=\!F\Big]P\Big[q_{1001}\!=\!F\Big|q_{1000}\!=\!F,\lambda\Big]+ P\Big[O,q_{1000}\!=\!L\Big]P\Big[q_{1001}\!=\!F\Big|q_{1000}\!=\!L,\lambda\Big]\Bigg)P\Big[o_{1001}\!=\!6\Big|q_{1001}\!=\!F,\lambda\Big]}\\&= \small{\Big(a\cdot 0.99+b\cdot 0.20\Big)\dfrac{1}{6}} \end{array}$$
After a bit more tinkering, I get
$$\begin{aligned} P\big[O, &o_{1001}\!=\!6,q_{1001}\!=\!F\big] \\ &=\Big(P\big[O,q_{1000}\!=\!F\big]P\big[q_{1001}\!=\!F\,\big|\,q_{1000}\!=\!F,\lambda\big]+ P\big[O,q_{1000}\!=\!L\big]P\big[q_{1001}\!=\!F\,\big|\,q_{1000}\!=\!L,\lambda\big]\Big)P\big[o_{1001}\!=\!6\,\big|\,q_{1001}\!=\!F,\lambda\big] \\ &= \big(a\cdot 0.99+b\cdot 0.20\big)\tfrac{1}{6} \end{aligned}$$