\documentclass[12pt]{article}
\usepackage{fancyhdr,fancybox,amssymb,epsfig,amsmath,latexsym,bm}
\usepackage{enumerate}
\usepackage{tikz}
\usepackage[all]{xy}
\usepackage[numbers,square,sort&compress]{natbib}
\usepackage{bibentry}
\usepackage{stackrel}
\usepackage[]{hyperref}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}

\tikzset{big arrow/.style={decoration={markings,mark=at position 0.6
      with {\arrow[scale=2]{>}}}, postaction={decorate}, shorten >=1pt}}

% Code to make an augmented matrix (Usage: \begin{bmatrix}[ccc|c])
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
  \hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{#1}}
\makeatother

\topmargin=-.5in
\headsep=0.2in
\oddsidemargin=0in
\textwidth=6.7in
\textheight=9.2in
\footskip=.5in

% Change this line to \def\bold{\mathbf} for ``upright boldface.''
\def\bold{\bm}

\newcommand{\F}{\mathbb{F}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\def\0{\bold{0}}
\def\u{\bold{u}}
\def\v{\bold{v}}
\def\x{\bold{x}}
\def\<{\langle}
\def\>{\rangle}
\def\hat{\widehat}

%def\And{\wedge}
%def\Or{\vee}
%def\Not{\overline}



\def\And{\wedge}
\def\Or{\vee}
\newcommand{\Not}[1]{\overline{#1}}
\DeclareMathOperator{\old}{old}
\DeclareMathOperator{\Span}{Span}
\DeclareMathOperator{\rank}{rank}
\newcommand{\vv}[2]{\begin{bmatrix} #1 \\ #2 \end{bmatrix}}
\newcommand{\vvv}[3]{\begin{bmatrix} #1 \\ #2 \\ #3 \end{bmatrix}}

\newcommand{\ds}{\displaystyle}

\renewcommand{\footrulewidth}{1pt}
\newenvironment{proof}[1][Proof.]{\smallskip\begin{trivlist}
    \item[\hskip \labelsep {\sffamily #1}]}{\qed\end{trivlist}\bigskip}
\newenvironment{sol}[1][Solution.]{\smallskip\begin{trivlist}
    \item[\hskip \labelsep {\sffamily #1}]}{\qed\end{trivlist}\bigskip}
\newenvironment{fminipage}
{\setlength{\fboxsep}{15pt}\begin{Sbox}\begin{minipage}}
{\end{minipage}\end{Sbox}\fbox{\TheSbox}}
\newcommand{\qed}{\hfill \ensuremath{\Box}}
\newcommand{\disp}{\displaystyle}


\pagestyle{fancy} \lhead{{\sf Homework 9 $|$ Due April 22 (Friday)
}} \rhead{\thepage} \cfoot{{\sf Math 4500 $|$ Mathematical Modeling
    $|$ Spring 2022 $|$ M.~Macauley}}


\begin{document}

%$\;$ \vspace{-4mm}

%\noindent \textbf{Read}. \emph{Mathematical Concepts in Modern
%  Biology}, Chapter 1: Mechanisms of gene regulation: Boolean network
%models of the lactose operon in \emph{Escherichia coli}, by R.~Robeva,
%B.~Kirkwood, and R.~Davis, pages 1--35. \\

%\noindent \textbf{Do}. Familiarize yourself with either Macaulay2,
%Singular, or Sage. \\

%\noindent \textbf{Exercises}. \\ 

\begin{enumerate}


\item Recall the $3$-variable ODE model of the
  \emph{lac} operon proposed by Yildirim and Mackey in 2004, where
  $M(t)=$ mRNA, $B(t)=$ $\beta$-galactosidase, and $A(t)=$ allolactose
  (concentrations), respectively.
  \begin{align*}
    \frac{dM}{dt}&=
    \alpha_M\frac{1+K_1(e^{-\mu\tau_M}A_{\tau_M})^n}
          {K+K_1(e^{-\mu\tau_M}A_{\tau_M})^n}
    -\widetilde{\gamma_M}M
    \\ \frac{dB}{dt}&=\alpha_Be^{-\mu\tau_B}M_{\tau_B}-\widetilde{\gamma_B}B
    \\ \frac{dA}{dt}&=
    \alpha_AB\frac{L}{K_L+L}-\beta_AB\frac{A}{K_A+A}-\widetilde{\gamma_A}A
  \end{align*}
  Suppose the exponential decay constants are estimated from the
  literature to be $\widetilde{\gamma_M}=.441$,
  $\widetilde{\gamma_B}=.031$, and
  $\widetilde{\gamma_A}=.55$.
  %%                                                                           
  \begin{enumerate}
  \item Compute the half life for $M$, $B$, and $A$.
  \item Justify the following Boolean model by explaining the logical
    expression defining each transition function:
    \[
    \begin{array}{ll}
    f_M=A & f_{B_{\old}}=\overline{M}\And B
    \\ f_B=M\Or\left(B\And\overline{B_{\old}}\right)\hspace{10mm} &
    f_A=(B\And L_m)\Or L
  \end{array}
  \]
  What is a reasonble assumption of the approximate timestep assumed by this model? (There are multiple feasible solutions, but you need to justify your answer.)
  \item Find the fixed points of this model using computational algebra.
    Use the variable order $(M,B,B_{\old},A)=(x_1,x_2,x_3,x_4)$, and include
    your code from Macaulay2.
  \item Does this model exhibit bistability? Justify your answer. \medskip
\end{enumerate}
  
  
\item Draw the wiring diagram of the Boolean model
  \[
  f=(f_1,f_2,f_3,f_4,f_5,f_6)=(x_6,\;x_1,\;x_2,\;\overline{x_3},\;x_4,\;\overline{x_5})
  \]
  and then reduce it by eliminating the variables in the order
  $x_6,x_5,\dots$. Do each step by hand (i.e., show your work), an at
  each step along the way, write out the functions and draw the wiring
  diagram. \medskip

\item Consider the following Boolean network model of the \emph{lac}
  operon:
  \[
  \begin{array}{llll}
    f_1=x_4\And\overline{x_5}\qquad &&& f_7=x_6\Or x_8\Or x_9 \\
    f_2=x_1 \qquad &&& f_8=x_2\And x_{10}\And\overline{x_{11}} \\
    f_3=x_1 \qquad &&& f_9=(x_8\Or x_{10})\And\overline{x_{11}} \\
    f_4=\overline{x_{11}} \qquad &&& f_{10}=x_{10}\\
    f_5=\overline{x_6}\And\overline{x_7} &&& f_{11}=x_{11} \\
    f_6=x_3\And x_8 &&&
  \end{array}
  \]
  \begin{enumerate}
  \item Use Macaulay2 to reduce this Boolean network, as much as possible,
    starting from the last variable.
  \item Draw the wiring diagram of the reduced network. Find its fixed
    point(s) and use these to determine the fixed point(s) of the original
    network by back-substitution. \medskip
  \end{enumerate}

\newpage
  
\item Consider the hidden Markov model of the \emph{occassionally dishonest casino} that we saw in class, with the following probability parameters:
  \begin{center}
%    \includegraphics[width=.38\textwidth]{casino.jpg}
 \tikzstyle{v}=[circle,draw=blue!50,fill=blue!20,thick, inner
    sep=0pt,minimum size=4mm]
  \begin{tikzpicture}[->, >=stealth, auto, semithick, every loop/.style={},scale=1.6]
    \begin{scope}[shift={(0,0)}, shorten >=1pt, shorten <=1pt,]
      \node at (-.45,-.4) {\footnotesize\bf Fair};
      \node at (2.55,-.4) {\footnotesize\bf Unfair};
      \node (F) at (-.4,.45) {};
      \node (U) at (2.6,.45) {};
      \draw (-.9,-.2) rectangle (0,.5);
      \node[anchor=east] at (0,.3) {\footnotesize $W$: 2/3};
      \node[anchor=east] at (0,0) {\footnotesize $L$: 1/3};
      %%
      \draw (2.1,-.2) rectangle (3,.5);
      \node[anchor=east] at (3,.3) {\footnotesize $W$: 0.4};
      \node[anchor=east] at (3,0) {\footnotesize $L$: 0.6};
      %%
      %\node (U) at (3,0) {$U$};
      %\path (F) edge [bend left=20] node {$0.05$} (U);
      %\path (U) edge [bend left=20] node {$0.1$} (F);
      \path (F) edge [loop above] node {\footnotesize $0.6$} (F);
      \path (U) edge [loop above] node {\footnotesize $0.7$} (U);
      %%
      \node (FF) at (-.1,.1) {}; \node (UU) at (2.2,.1) {};
      \path (FF) edge [bend left=20] node {\footnotesize $0.4$} (UU);
      \path (UU) edge [bend left=20] node {\footnotesize$0.3$} (FF);
    \end{scope}
  \end{tikzpicture}
  \end{center}
  Suppose that upon playing this dice game four times, the result is $x=x_1x_2x_3x_4=WLLW$. Assume there is an equal chance of starting at the fair vs. unfair state. In this problem, you will carry out the steps of the decoding and evaluation problems; see Chapter 9 of Robeva/Hodge. Please show your work, including intermediate steps, and include a state diagram with the W/L states and times, just like what was done in class.
  \begin{enumerate}
  \item Use the \emph{Viterbi algorithm} to compute the most likely hidden path $\pi=\pi_1\pi_2\pi_3\pi_4$ to emit $x$. That is, compute
    \[
     \pi_{\max}=\arg\max_\pi P(\pi\mid x)=\arg\max_\pi P(x,\pi).
    \]
  \item Use the \emph{forward algorithm} the compute the \emph{probability}
    $P(x)$ of emitting $x$.
  \item Use the \emph{backward algorithm} to compute the \emph{posterior
    probabilities} $P(\pi_t=k\mid x)$.
  \end{enumerate}
  
  
%%---------------------------------------------------------------------  

\end{enumerate}


\end{document}


