\documentclass[12pt,titlepage]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{color}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage{xparse}
\usepackage{hyperref}
%----Macros----------
%
% Unresolved issues:
%
% \righttoleftarrow
% \lefttorightarrow
%
% \color{} with HTML colorspec
% \bgcolor
% \array with options (without options, it's equivalent to the matrix environment)
% Of the standard HTML named colors, white, black, red, green, blue and yellow
% are predefined in the color package. Here are the rest.
\definecolor{aqua}{rgb}{0, 1.0, 1.0}
\definecolor{fuschia}{rgb}{1.0, 0, 1.0}
\definecolor{gray}{rgb}{0.502, 0.502, 0.502}
\definecolor{lime}{rgb}{0, 1.0, 0}
\definecolor{maroon}{rgb}{0.502, 0, 0}
\definecolor{navy}{rgb}{0, 0, 0.502}
\definecolor{olive}{rgb}{0.502, 0.502, 0}
\definecolor{purple}{rgb}{0.502, 0, 0.502}
\definecolor{silver}{rgb}{0.753, 0.753, 0.753}
\definecolor{teal}{rgb}{0, 0.502, 0.502}
% Because of conflicts, \space and \mathop are converted to
% \itexspace and \operatorname during preprocessing.
% itex: \space{ht}{dp}{wd}
%
% Height and baseline depth measurements are in units of tenths of an ex while
% the width is measured in tenths of an em.
\makeatletter
\newdimen\itex@wd%
\newdimen\itex@dp%
\newdimen\itex@thd%
\def\itexspace#1#2#3{\itex@wd=#3em%
\itex@wd=0.1\itex@wd%
\itex@dp=#2ex%
\itex@dp=0.1\itex@dp%
\itex@thd=#1ex%
\itex@thd=0.1\itex@thd%
\advance\itex@thd\the\itex@dp%
\makebox[\the\itex@wd]{\rule[-\the\itex@dp]{0cm}{\the\itex@thd}}}
\makeatother
% \tensor and \multiscript
\makeatletter
\newif\if@sup
\newtoks\@sups
\def\append@sup#1{\edef\act{\noexpand\@sups={\the\@sups #1}}\act}%
\def\reset@sup{\@supfalse\@sups={}}%
\def\mk@scripts#1#2{\if #2/ \if@sup ^{\the\@sups}\fi \else%
\ifx #1_ \if@sup ^{\the\@sups}\reset@sup \fi {}_{#2}%
\else \append@sup#2 \@suptrue \fi%
\expandafter\mk@scripts\fi}
\def\tensor#1#2{\reset@sup#1\mk@scripts#2_/}
\def\multiscripts#1#2#3{\reset@sup{}\mk@scripts#1_/#2%
\reset@sup\mk@scripts#3_/}
\makeatother
% \slash
\makeatletter
\newbox\slashbox \setbox\slashbox=\hbox{$/$}
\def\itex@pslash#1{\setbox\@tempboxa=\hbox{$#1$}
\@tempdima=0.5\wd\slashbox \advance\@tempdima 0.5\wd\@tempboxa
\copy\slashbox \kern-\@tempdima \box\@tempboxa}
\def\slash{\protect\itex@pslash}
\makeatother
% math-mode versions of \rlap, etc
% from Alexander Perlis, "A complement to \smash, \llap, and lap"
% http://math.arizona.edu/~aprl/publications/mathclap/
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\def\mathllap{\mathpalette\mathllapinternal}
\def\mathrlap{\mathpalette\mathrlapinternal}
\def\mathclap{\mathpalette\mathclapinternal}
\def\mathllapinternal#1#2{\llap{$\mathsurround=0pt#1{#2}$}}
\def\mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}}
\def\mathclapinternal#1#2{\clap{$\mathsurround=0pt#1{#2}$}}
% Renames \sqrt as \oldsqrt and redefine root to result in \sqrt[#1]{#2}
\let\oldroot\root
\def\root#1#2{\oldroot #1 \of{#2}}
\renewcommand{\sqrt}[2][]{\oldroot #1 \of{#2}}
% Manually declare the txfonts symbolsC font
\DeclareSymbolFont{symbolsC}{U}{txsyc}{m}{n}
\SetSymbolFont{symbolsC}{bold}{U}{txsyc}{bx}{n}
\DeclareFontSubstitution{U}{txsyc}{m}{n}
% Manually declare the stmaryrd font
\DeclareSymbolFont{stmry}{U}{stmry}{m}{n}
\SetSymbolFont{stmry}{bold}{U}{stmry}{b}{n}
% Manually declare the MnSymbolE font
\DeclareFontFamily{OMX}{MnSymbolE}{}
\DeclareSymbolFont{mnomx}{OMX}{MnSymbolE}{m}{n}
\SetSymbolFont{mnomx}{bold}{OMX}{MnSymbolE}{b}{n}
\DeclareFontShape{OMX}{MnSymbolE}{m}{n}{
<-6> MnSymbolE5
<6-7> MnSymbolE6
<7-8> MnSymbolE7
<8-9> MnSymbolE8
<9-10> MnSymbolE9
<10-12> MnSymbolE10
<12-> MnSymbolE12}{}
% Declare specific arrows from txfonts without loading the full package
\makeatletter
\def\re@DeclareMathSymbol#1#2#3#4{%
\let#1=\undefined
\DeclareMathSymbol{#1}{#2}{#3}{#4}}
\re@DeclareMathSymbol{\neArrow}{\mathrel}{symbolsC}{116}
\re@DeclareMathSymbol{\neArr}{\mathrel}{symbolsC}{116}
\re@DeclareMathSymbol{\seArrow}{\mathrel}{symbolsC}{117}
\re@DeclareMathSymbol{\seArr}{\mathrel}{symbolsC}{117}
\re@DeclareMathSymbol{\nwArrow}{\mathrel}{symbolsC}{118}
\re@DeclareMathSymbol{\nwArr}{\mathrel}{symbolsC}{118}
\re@DeclareMathSymbol{\swArrow}{\mathrel}{symbolsC}{119}
\re@DeclareMathSymbol{\swArr}{\mathrel}{symbolsC}{119}
\re@DeclareMathSymbol{\nequiv}{\mathrel}{symbolsC}{46}
\re@DeclareMathSymbol{\Perp}{\mathrel}{symbolsC}{121}
\re@DeclareMathSymbol{\Vbar}{\mathrel}{symbolsC}{121}
\re@DeclareMathSymbol{\sslash}{\mathrel}{stmry}{12}
\re@DeclareMathSymbol{\bigsqcap}{\mathop}{stmry}{"64}
\re@DeclareMathSymbol{\biginterleave}{\mathop}{stmry}{"6}
\re@DeclareMathSymbol{\invamp}{\mathrel}{symbolsC}{77}
\re@DeclareMathSymbol{\parr}{\mathrel}{symbolsC}{77}
\makeatother
% \llangle, \rrangle, \lmoustache and \rmoustache from MnSymbolE
\makeatletter
\def\Decl@Mn@Delim#1#2#3#4{%
\if\relax\noexpand#1%
\let#1\undefined
\fi
\DeclareMathDelimiter{#1}{#2}{#3}{#4}{#3}{#4}}
\def\Decl@Mn@Open#1#2#3{\Decl@Mn@Delim{#1}{\mathopen}{#2}{#3}}
\def\Decl@Mn@Close#1#2#3{\Decl@Mn@Delim{#1}{\mathclose}{#2}{#3}}
\Decl@Mn@Open{\llangle}{mnomx}{'164}
\Decl@Mn@Close{\rrangle}{mnomx}{'171}
\Decl@Mn@Open{\lmoustache}{mnomx}{'245}
\Decl@Mn@Close{\rmoustache}{mnomx}{'244}
\makeatother
% Widecheck
\makeatletter
\DeclareRobustCommand\widecheck[1]{{\mathpalette\@widecheck{#1}}}
\def\@widecheck#1#2{%
\setbox\z@\hbox{\m@th$#1#2$}%
\setbox\tw@\hbox{\m@th$#1%
\widehat{%
\vrule\@width\z@\@height\ht\z@
\vrule\@height\z@\@width\wd\z@}$}%
\dp\tw@-\ht\z@
\@tempdima\ht\z@ \advance\@tempdima2\ht\tw@ \divide\@tempdima\thr@@
\setbox\tw@\hbox{%
\raise\@tempdima\hbox{\scalebox{1}[-1]{\lower\@tempdima\box
\tw@}}}%
{\ooalign{\box\tw@ \cr \box\z@}}}
\makeatother
% \mathraisebox{voffset}[height][depth]{something}
\makeatletter
\NewDocumentCommand\mathraisebox{moom}{%
\IfNoValueTF{#2}{\def\@temp##1##2{\raisebox{#1}{$\m@th##1##2$}}}{%
\IfNoValueTF{#3}{\def\@temp##1##2{\raisebox{#1}[#2]{$\m@th##1##2$}}%
}{\def\@temp##1##2{\raisebox{#1}[#2][#3]{$\m@th##1##2$}}}}%
\mathpalette\@temp{#4}}
\makeatletter
% udots (taken from yhmath)
\makeatletter
\def\udots{\mathinner{\mkern2mu\raise\p@\hbox{.}
\mkern2mu\raise4\p@\hbox{.}\mkern1mu
\raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern1mu}}
\makeatother
%% Fix array
\newcommand{\itexarray}[1]{\begin{matrix}#1\end{matrix}}
%% \itexnum is a noop
\newcommand{\itexnum}[1]{#1}
%% Renaming existing commands
\newcommand{\underoverset}[3]{\underset{#1}{\overset{#2}{#3}}}
\newcommand{\widevec}{\overrightarrow}
\newcommand{\darr}{\downarrow}
\newcommand{\nearr}{\nearrow}
\newcommand{\nwarr}{\nwarrow}
\newcommand{\searr}{\searrow}
\newcommand{\swarr}{\swarrow}
\newcommand{\curvearrowbotright}{\curvearrowright}
\newcommand{\uparr}{\uparrow}
\newcommand{\downuparrow}{\updownarrow}
\newcommand{\duparr}{\updownarrow}
\newcommand{\updarr}{\updownarrow}
\newcommand{\gt}{>}
\newcommand{\lt}{<}
\newcommand{\map}{\mapsto}
\newcommand{\embedsin}{\hookrightarrow}
\newcommand{\Alpha}{A}
\newcommand{\Beta}{B}
\newcommand{\Zeta}{Z}
\newcommand{\Eta}{H}
\newcommand{\Iota}{I}
\newcommand{\Kappa}{K}
\newcommand{\Mu}{M}
\newcommand{\Nu}{N}
\newcommand{\Rho}{P}
\newcommand{\Tau}{T}
\newcommand{\Upsi}{\Upsilon}
\newcommand{\omicron}{o}
\newcommand{\lang}{\langle}
\newcommand{\rang}{\rangle}
\newcommand{\Union}{\bigcup}
\newcommand{\Intersection}{\bigcap}
\newcommand{\Oplus}{\bigoplus}
\newcommand{\Otimes}{\bigotimes}
\newcommand{\Wedge}{\bigwedge}
\newcommand{\Vee}{\bigvee}
\newcommand{\coproduct}{\coprod}
\newcommand{\product}{\prod}
\newcommand{\closure}{\overline}
\newcommand{\integral}{\int}
\newcommand{\doubleintegral}{\iint}
\newcommand{\tripleintegral}{\iiint}
\newcommand{\quadrupleintegral}{\iiiint}
\newcommand{\conint}{\oint}
\newcommand{\contourintegral}{\oint}
\newcommand{\infinity}{\infty}
\newcommand{\bottom}{\bot}
\newcommand{\minusb}{\boxminus}
\newcommand{\plusb}{\boxplus}
\newcommand{\timesb}{\boxtimes}
\newcommand{\intersection}{\cap}
\newcommand{\union}{\cup}
\newcommand{\Del}{\nabla}
\newcommand{\odash}{\circleddash}
\newcommand{\negspace}{\!}
\newcommand{\widebar}{\overline}
\newcommand{\textsize}{\normalsize}
\renewcommand{\scriptsize}{\scriptstyle}
\newcommand{\scriptscriptsize}{\scriptscriptstyle}
\newcommand{\mathfr}{\mathfrak}
\newcommand{\statusline}[2]{#2}
\newcommand{\tooltip}[2]{#2}
\newcommand{\toggle}[2]{#2}
% Theorem Environments
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{prop}{Proposition}
\newtheorem{cor}{Corollary}
\newtheorem*{utheorem}{Theorem}
\newtheorem*{ulemma}{Lemma}
\newtheorem*{uprop}{Proposition}
\newtheorem*{ucor}{Corollary}
\theoremstyle{definition}
\newtheorem{defn}{Definition}
\newtheorem{example}{Example}
\newtheorem*{udefn}{Definition}
\newtheorem*{uexample}{Example}
\theoremstyle{remark}
\newtheorem{remark}{Remark}
\newtheorem{note}{Note}
\newtheorem*{uremark}{Remark}
\newtheorem*{unote}{Note}
%-------------------------------------------------------------------
\begin{document}
%-------------------------------------------------------------------
\section*{Blog - Petri net programming (part 4b)}
This page is a [[blog article in progress]], written by [[David Tanzer]]. To discuss this article while it's being written, visit the \href{http://forum.azimuthproject.org/discussion/1198/blog-petri-net-programming-part-3}{Azimuth Forum}. Please remember that blog articles need HTML, not Markdown.
{\tt \symbol{60}}/i{\tt \symbol{62}}
In this article, we will describe the ``rate equation'' for continuous deterministic Petri nets, which gives a formula for the rate at which the the population counts of the species change over time. But before getting into the details, I'd like to outline how we arrive at the notion of continuous deterministic Petri nets, which, on the surface, sound quite different from the stochastic Petri nets that we introduced two articles back.
This model of a continuous, deterministic Petri net is actually derived from the more fundamental model of a discrete, stochastic Petri net, which we introduced in a previous blog article. Think of chemical reactions, for example. To a good approximation, we can view the amounts of the various substances as continuously varying magnitudes (and then view them as real-valued of particles per unit volume), and the processes as continually occurring, at various concentration-dependent rates. But in reality, at a detailed level, there is actually a discrete, integer valued number of each of the particles, and the reaction events take place by separate, discrete, random events.
In a stochastic process, different ``runs'' of the experiment will produce different sequences of events, and the collection of all possible sequences will be distributed according to a probability distribution. Each sequence of events will lead to a corresponding sequence of states of the system. At every point in time, therefore, there will be a distribution of possible states of the system. We can then take the expected value of the state at each point int time, and form the for the stochastic process.
So, whereas the stochastic process consists of a non-deterministic collection of possible outcomes, all involving discrete integer states (in a stochastic Petri net, discrete population counts), the sequence of expected states is uniquely determined -- a deterministic process -- involving states with real-valued components -- which result from taking the means of the integer-valued components.
Furthermore, under certain statistical assumptions (cite John's recent paper), as the population counts get large, and the reaction rates increase, a law of large number will kick in, and the variations of the runs of the stochastic process around the mean will decrease (will cluster more tightly around the mean), so that the deterministic sequence of expected states will become a better and better approximation for the observed runs of the stochastic process.
Let's illustrate with a physical example. Consider an apparatus where we have a winding spiral pipe, with rough and irregular inner walls. At the bottom it opens into a large jar, and at the top we pour a cup containing small pebbles. Each pebble eventually (bounces) makes its way from the top of the pipe to the bottom and into the jar, but due to the irregularities of friction, etc., there may be a substantial variation in the time that each pebble takes to traverse the pipe.
The events are the arrivals of the pebbles in the jar, and the state at each point we will take to be the number of pebbles in the jar. If we graph the state (the pebble count) as a function of time, it will be a non-decreasing function, with integer values, and integer jumps as pebbles enter the jar. But the number of pebbles in the jar, as a function of time, will be an increasing, continuous function.
(We suppose the pipe is wide in comparison to the pebble sizes, so there are no clogging or queueing effects.)
Now consider what happens if, say, we multiply by ten the number of pebbles that we release. The results of the process will still be stochastic, but the overall process, as recorded by the rising count of pebbles in the jar, will be smoother, and closer to the averaged out sequence of expected pebble counts.
In fact, by increasing the pebble counts within each run of the experiment, we are performing a kind of averaging there: the effects of the slower pebbles will be offset by the effects of the faster pebbles -- the count in the jar reflects the aggregate effects of all the pebbles.
In the limiting process of a large number of pebbles, the behavior looks more like pouring sand into the pipe, which begins to look like a continuous fluid. The continuous fluid model is an even better approximation when we reach the scale of chemical reactions, which involve moles of chemical entities. As we pass to the theoretical limit, involving an infinite number of infinitesimal particles, we reach the fluid model for a continuous, deterministic process.
Now we are working in the continuous flow model for a reaction network.
Let's first look at the behavior for a reaction network that has just one transition. The transition is like a little pump, that drains fluid from its input containers, and emits fluid on its output containers. The rate at which the pump is running is proportional to the product of the amounts of fluid at each of its input containers. This is the mass action kinetics, which we described two articles back. The explanation for this law, in terms of a fluid of particles, is that a given amount of substance at one of the inputs to a reaction represents a given number of candidate particles for the reaction, and hence will contribute linearly to the probability of a reaction occurring within a small time interval, and hence will contribute linearly to the firing rate of the reaction.
Let's put a formula to it.
Let Ci be the ith container in the network. Let ai(t) be the amount of substance stored at the ith container, at time t.
Let R be one of the reactions in the network.
As we said before, the firing rate of R at time t is proportional to the amounts of each of its inputs ((times the rate constant for R)):
firingRate(R,t) = rateConstant(R) * Prod \{ai(t) | i in INPS(R)\}.
Let INPS(R) = the multiset of indicies i in \{1,\ldots{},n\} for the input connections to R.
(Note that if Ci is input multiple times to R, then i will appear multiple times in INPS(R), and the factor ai(t) will appear multiple times in this product.)
Next, what is the effect of the firing rate of R, at time t, on the amount ai(t) stored a container i at that time?
Well, each firing event of R causes one unit of fluid to be drained from each of the input containers, and one unit of fluid to be added to each of the output containers. So, when R has one output to Ci, then ((the rising fluid at Ci due to R is expressed by)):
d/dt ai(t) = firingRate(R,t)
And when R has in input to Ci, then ((The draining fluid at Ci due to R is expressed by)):
d/dt ai(t) = -firingRate(R,t).
In the general case, R may have multiple inputs to Ci, and also, possibly at the same time, multiple outputs to Ci -- so the effect of these drainings and infusions must be netted out.
The net change at Ci, per firing of R, is then:
OUT(R)(i) - INP(R)(i).
This gives us:
dai(t) / dt = FiringRate(R,t) (OUT(R)(i) - INP(R)(i)) =
RateConstant(R) * (PROD j in INP(R) aj(t)) * (OUT(R)(i) - INP(R)(i))
This is the rate equation, for a single transition.
The extension to the case of multiple transitions is straightforward, because at a given instant, the firings of each of the transitions are separately determined, as per the mass action law that we just described, and the contributions of each transition to the increasing or decreasing of the fluid at a given container, are addititve -- we have have to sum the rates of change given by the equation for a single transition:
dai(t) / dt = SUM(R in REACTIONS) (PROD j in INP(R) aj(t)) * (OUT(R)(i) - INP(R)(i)).
This is the general rate equation.
This is a system of differential equations, one for each container i in the network.
Let's write a(t) = (a1(t),\ldots{},an(t)) for the vector of all amounts stored in the containers, i.e., the complete state of the network.
((Explain how INP(R) can be both a multiset, and a function taking containers to natural numbers.))
We can then write the whole system of equations as a single equation involving vectors:
da(t) / dt = SUM (R in REACTIONS) RateConstant(R) * (PROD j in INP(R) aj(t)) * (OUT(R) - INP(R))
Here, OUT(R) and INP(R) designate the vectors:
OUT(R) = (OUT(R)(1), \ldots{}, OUT(R)(n)) INP(R) = (INP(R)(1), \ldots{}, INP(R)(n)),
which indicate the number of times that R outputs or inputs to each of the containers.
The difference OUT(R) - INP(R) is the vector that gives the net increase at each container, due to a single firing of the reaction R.
Looking at this equation, we see that it gives the direction and rate of change of the state of the system, by the vector of derivatives
da(t) / dt = (da1(t) / dt, \ldots{}, dan(t) / dt),
which is put as a function of the current state of the system a(t) = (a1(t), \ldots{}, an(t)); all the other terms on the right hand side of the equation, i.e., RateConstant(R), INP(R), and OUT(R), are constants that are fixed for a given reaction network. In a word, this equation gives the derivative of the system as a function of the state of a system.
Therefore, starting out at an initial state a(0), this equation will determine a unique trajectory for the system, as a function of time. (This is a theorem that follows from the structure of the differential equation.) It then gives a deterministic law of motion for the system -- this is the general meaning of the rate equation.
(And solving for da(t) / dt = 0 gives the conditions for system equilibrium.)
in the next article, we will look at specific examples of reaction networks, and apply the rate equation to them, to determine the structure of the evolution of the system, and their states of equilibrium. Then, for simple but basic systems, we will give graphical ``streamlines'' that show the evolution of the systems.
Let's consider an important, basic example: a pair of opposite reactions.
r: a1 --alpha--{\tt \symbol{62}} a2 s: a2 --beta--{\tt \symbol{62}} a1
INP(r) = \{1\} = (1,0) OUT(r) = \{2\} = (0,1) INP(s) = \{2\} = (0,1) OUT(s) = \{1\} = (1,0)
OUT(r) - INP(r) = (-1,1) OUT(s) - INP(s) = (1,-1)
RateConstant(r) = alpha RateConstant(s) = beta
da(t) / dt = (da1(t) / dt, da2(t) / dt)
RateConstant(r) * PROD(j in \{1\}) aj(t)) (-1,1) +
RateConstant(s) * PROD(j in \{2\}) aj(t)) (1,-1) =
alpha a1(t) (-1, 1) + beta a2(t) (1, -1) =
(- alpha a1(t) + beta a2(t), alpha a1(t) - beta a2(t))
Note that da1 / dt = - da2 / dt,
which makes sense, because whatever tokens are being lost on the one container must be being gained on the other.
Equilibrium is reached when da / dt = 0, which means that
alpha a1(t) = beta a2(t),
so a1/a2 = beta / alpha. Thus, beta/alpha gives the proportions of a1 and a2 at equilibrium.
category:blog
\end{document}