MHB Long formula looks bad - suggestions?

Click For Summary
SUMMARY

This discussion focuses on improving the readability of long conditional probability formulas used in Hidden Markov Models. Participants suggest using the \! command to reduce spacing in subscripts and consider aligning equations for better presentation. They also discuss the potential of condensing long variable names to enhance clarity. The final recommendation includes using the aligned environment for stacking equations while maintaining alignment of equal signs.

PREREQUISITES
  • Understanding of Hidden Markov Models
  • Familiarity with LaTeX typesetting
  • Knowledge of conditional probability notation
  • Experience with mathematical formatting and alignment techniques
NEXT STEPS
  • Explore LaTeX commands for spacing adjustments, specifically the \! command
  • Learn about the align environment in LaTeX for equation formatting
  • Investigate strategies for variable name reduction in mathematical expressions
  • Research best practices for presenting complex mathematical formulas clearly
USEFUL FOR

Students, researchers, and educators working with Hidden Markov Models, as well as anyone involved in mathematical typesetting and presentation of complex formulas.

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}$$
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 107 ·
4
Replies
107
Views
19K
  • · Replies 42 ·
2
Replies
42
Views
11K
  • · Replies 16 ·
Replies
16
Views
7K
  • · Replies 102 ·
4
Replies
102
Views
11K
  • · Replies 175 ·
6
Replies
175
Views
26K
  • · Replies 28 ·
Replies
28
Views
7K
  • · Replies 48 ·
2
Replies
48
Views
12K