Visualization definitions

Drawing subroutines

eq1 = (x1 - cx)^2 + (y1 - cy)^2 == r^2 ; eq2 = (x2 - cx)^2 + (y2 - cy)^2 == r^2 ; eq3 = (x3 -  ... y}, Abs[r]} /. sol) /. {x1->x1s, x2->x2s, x3->x3s, y1->y1s, y2->y2s, y3->y3s} ;

eq4 = (x - cx1)^2 + (y - cy1)^2 == r1^2 ; eq5 = (x - cx2)^2 + (y - cy2)^2 == r2^2 ; <br /> sol ... y} /. sol2) /. {cx1->cx1s, cx2->cx2s, cy1->cy1s, cy2->cy2s, r1->r1s, r2->r2s} ;

DiskList[c_, r_, pr_, sty_] := Table[{sty[[i]], Disk[c, r, Take[pr, {i, i + 1}]]}, {i, 1, Length[pr] - 1}] ;

RowBox[{RowBox[{TransformVector[pr_], :=, RowBox[{RowBox[{(, RowBox[{2, Pi, RowBox[{(, RowBox[ ... , ~, Join, ~, Table[Plus @@ Take[pr, {1, i}], {i, 1, Length[pr]}]}], )}]}], )}], //,  , N}]}], ;}]

RowBox[{RowBox[{TextConvert[{{{cx_, cy_}, r_, {t1_, t2_}}, {i_, j_}}, offset_], :=, ,  ... os, ,, RowBox[{Background, ->, RowBox[{GrayLevel, [, 1., ]}]}]}], ]}]}]}], , ]}]}], ;}]

ArrowHead[{α_, β_, h_}, {{x_, y_}, θ_}] := Module[{l1, l2, pts}, ᡝ ...  ; ({{Cos[θ], -Sin[θ]}, {Sin[θ], Cos[θ]}} . # + {x, y}) & /@pts] ;

convert[{{{cx_, cy_}, r_}, θ_}] := {{cx + r Cos[θ], cy + r Sin[θ]}, θ} ;

getOption[name_, default_, opts___] := Module[{var}, If[NumberQ[var = (name /. {opts}) // N], var, default]] ;

getOption2[name_, default_, opts___] := Module[{var}, If[Length[var = (name /. {opts})] > 0, var, default]] ;

getOption3[name_, default_, opts___] := Module[{var}, If[(var = (name /. {opts})) == name, default, var, var]] ;

eliminateNulls[l_] := Delete[l, Position[l, Null]] ;

thirdPoint[{{x1_, y1_}, {x2_, y2_}}, α_] := Module[{dx, dy, θ, b}, d ... + α ;  {{x1, y1}, {x2, y2}, {x1 + b Cos[θ], y1 + b Sin[θ]}} // N] ;

arcAngles[{{cx_, cy_}, r_}, {{x1_, y1_}, {x2_, y2_}}] := Module[{dx, dy, t1, t2, tt1,  ... , tt1 = t2 ; tt2 = t1 + 2Pi, tt1 = t1 ; tt2 = t2] ;  {{cx, cy}, r, {tt1, tt2}} ] ;

selfAngles[{{cx_, cy_}, r_}, {{x1_, y1_}, {x2_, y2_}}] := Module[{dx, dy, t1, t2, tt1, ... , tt1 = t2 ; tt2 = t1 + 2Pi, tt1 = t1 ; tt2 = t2] ;  {{cx, cy}, r, {tt1, tt2}} ] ;

minDistance[{{{xi1_, yi1_}, {xi2_, yi2_}}, {x3_, y3_}}] := Module[{d1, d2}, d1 ... 2 = Sqrt[(x3 - xi2)^2 + (y3 - yi2)^2] ; If[d1 < d2, {xi1, yi1}, {xi2, yi2}] ] ;

FixTextInternal[gr_, l_] := Module[{gr2, s1, s2, i}, gr2 = gr ; Do[{s1 ... [[i]] ; gr2 = ReplacePart[gr2, s2, Position[gr2, s1]], {i, 1, Length[l]}] ; gr2] ;

FixText[gr_, l_] := Module[{gr2, t1, t2, t3}, t1 = {ToString[#[[1]]] <>ToString[ ... [#[[2]]] <>ToString[#[[1]]]} & /@ l ; Show[FixTextInternal[gr2, t3]] ] ;

SubstituteValue[gr_, {i_, j_}, s_] := ReplacePart[gr, s, Position[gr, Subscript["a", ToString[i] <>ToString[j]]]] ;

SubstituteValues[gr_, a_] := Module[{gr2, i, j, s}, gr2 = gr ; Do[> ... 2 = SubstituteValue[gr2, {i, j}, s], {i, 1, Length[a]}, {j, 1, Length[a]}] ; Show[gr2] ] ;

Markov model drawing function (DrawMarkov)

Description

DrawMarkov[A, opts] takes the state transition matrix   A and zero or more options opt, and draws the corresponding Markov model. When the Markov model is labeled, some subscripts may be reversed. In that case,  FixText[Graphic, {{i1,j1},{i2,j2},...}] will switch the {ik,jk} subscripts. The function SubstituteValues[Graphic, A] will substitute actual values of the matrix A into the Markov model plot.

Options:

* MarkovStyle → {Circular, Sequential}: arrange states  in a circle or in a line.
* AngularOffset → 0 Degree:  offset for circularly arranged Markov models.
* StateSize → 1/4: relative size of state circles.
* StateColor → GrayLevel[.75]: color of each state.
* LineThickness → 1/2 (point): default line thickness  for drawing.
* BendAngle → 20 Degree:  curvature of state-transition arcs.
* SelfCircleSize → 1/5: relative radius of self-connections.
* SelfCircleOffset → 1/3: relative offset of self-connections from center of states.
* ArrowAngleTop → 10 Degree: arrow tip spread angle.
* ArrowAngleBottom → 10 Degree: arrow tail  angle.
* ArrowLength → 0.075: relative length of arrows.
* TextOffset → 1.1: transition arcs offset for text labeling.
* SelfTextOffset → 0.1: self-transition arcs offset for text labeling.
* MarkovText → True: whether to label Markov model with text.
* FontSize → 12: what font size to use.
* FontFamily → "Times": what font family to use.
* FontSlant → "Italic": what font slant to use.

Definition

RowBox[{RowBox[{DrawMarkov[a_, opts___], :=, , RowBox[{Module, [, RowBox[{{at, c, n, & ... ;Automatic, Frame->False, PlotRangeAll, ImageSize400]}]}], , ]}]}], ;}]

Hidden Markov model drawing function (DrawHMM)

Description

DrawHMM[A, B, opts] takes the state transition matrix   A, observable matrix B zero, and zero or more options opt, and draws the corresponding hidden Markov model. When the Markov model is labeled, some subscripts may be reversed. In that case,  FixText[Graphic, {{i1,j1},{i2,j2},...}] will switch the {ik,jk} subscripts. The function SubstituteValues[Graphic, A] will substitute actual values of the matrix A into the Markov model plot.

Options:

* HMMStyle → {Circular, Sequential}: arrange states  in a circle or in a line.
* AngularOffset → 0 Degree:  offset for circularly arranged Markov models.
* StateSize → 1/4: relative size of state circles.
* StateColor → GrayLevel[.75]: color of each state.
* LineThickness → 1/2 (point): default line thickness  for drawing.
* BendAngle → 20 Degree:  curvature of state-transition arcs.
* SelfCircleSize → 1/5: relative radius of self-connections.
* SelfCircleOffset → 1/3: relative offset of self-connections from center of states.
* ArrowAngleTop → 10 Degree: arrow tip spread angle.
* ArrowAngleBottom → 10 Degree: arrow tail  angle.
* ArrowLength → 0.075: relative length of arrows.
* TextOffset → 1.1: transition arcs offset for text labeling.
* SelfTextOffset → 0.1: self-transition arcs offset for text labeling.
* MarkovText → True: whether to label Markov model with text.
* FontSize → 12: what font size to use.
* FontFamily → "Times": what font family to use.
* FontSlant → "Italic": what font slant to use.
* ObservableStyle → {Style1, Style2,...}:
* StateText → True: whether to label states.

Definition

RowBox[{RowBox[{DrawHMM[a_, b_, opts___], :=, RowBox[{Module, [, RowBox[{{at, bt, c, n, α ... ;Automatic, Frame->False, PlotRangeAll, ImageSize400]}]}], , ]}]}], ;}]

Draw observation sequence (DrawObservationSequence)

DrawObservationSequence[o_, styles_, opts___] := Module[{g1, g2, length}, length = 40  ... 371;Show[Graphics[{g1, g2}], AspectRatioAutomatic, ImageSize400, opts] ] ;

Draw observation sequence transpose (DrawObservationSequenceTranspose)

DrawObservationSequenceTranspose[o_, styles_, opts___] := Module[{g1, g2, length}, len ... 371;Show[Graphics[{g1, g2}], AspectRatioAutomatic, ImageSize400, opts] ] ;


Created by Mathematica  (October 20, 2003)