TITLE: How can gravitational energy cancel out the rest energy of mass in the universe
QUESTION [1 upvotes]: I've heard that some physicists think that the net energy of the universe is zero. For this to happen, I would assume that the negative gravitational energy of a body ought to cancel out its rest energy. A back-of-the envelope calculation for the Earth gives me a rest energy around $10^9$ greater than its gravitational energy. I would assume that for other ordinary matter we get a disparity on the same order of magnitude. This means that the rest-energy of ordinary matter far outweighs its gravitational energy. Even if ordinary matter only contributes 4% of the gravitational energy in the universe, a claim I've heard, the rest energy of ordinary matter still far outweighs the total gravitational energy in the universe. So how is it still a plausible hypothesis that the net energy of the universe is zero? Where does the rest of the negative energy come from?

REPLY [2 votes]: I've heard that some physicists think that the net energy of the universe is zero.
Me too. They talk about gravitational energy being negative. But see Einstein talking about gravitataionl field energy here. It's positive.
For this to happen, I would assume that the negative gravitational energy of a body ought to cancel out its rest energy.
That's what they say, but IMHO like John Rennie said, it's wrong. When two bodies falls together, some of their rest-mass energy is converted into kinetic energy. They collide, and the kinetic energy is converted into heat and eventually gets radiated away. Then you'[re left with a mass deficit. But it's a mass deficit, not an energy deficit. Conservation of energy applies. You don't end up with less energy than what you started with.
A back-of-the envelope calculation for the Earth gives me a rest energy around $10^9$   greater than its gravitational energy...
Yes, gravitational field energy isn't much. Nor is the mass deficit.
So how is it still a plausible hypothesis that the net energy of the universe is zero?
IMHO it isn't. IMHO the people who say this sort of thing tend to be popscience cosmologists with a book to plug.


TITLE: Find $\iint_Ty^2dxdy$, where T is the triangle with vertices at (0,0),(2,2) and (3,0)
QUESTION [0 upvotes]: I have a feeling I am meant to split the integrals, but I am struggling to work out which limits to set for my integrals.
I think it should be something like:
$\int_0^x\int_0^2y^2dxdy + \int_0^?\int_2^3y^2dxdy$
I'm not sure what the "?" is meant to be, so if anyone could show me:

Whether I am on the right track?
How they have actually worked that "?" out?
And finally, what to do no next, and how they've gotten their answer.

I'd be awfully greatful!

REPLY [1 votes]: Let $O = (0,0), A = (2,2), B = (3,0)$. The equation of the line that passes through $O,A$ is:
$y = x$, and the equation of the line that goes through $A, B$ is: $y = -2x+6$. Thus:
$I = \displaystyle \int_{0}^2 \int_{y}^{\frac{6-y}{2}} y^2dxdy$


TITLE: Finding, not verifying, the limit of a sequence.
QUESTION [1 upvotes]: If I'm told to prove that $\lim \limits_{n \to \infty}{\frac{1}{n^2}} = 0$, I would do the following:
$|\frac{1}{n^2} - 0| = \frac{1}{n^2} < \epsilon \implies N(\epsilon) = \frac{1}{\sqrt{\epsilon}} < n$
Every $\epsilon > 0$ is defined, so $\frac{1}{n^2} \to \infty$.

However, what if I'm not told $L = 0$? How would I find that $L = 0$, without looking at graphs or testing increasingly larger $n$?
I used $a_n = \frac{1}{n^2}$ as a simple example. I'd prefer some method that works for other sequences, too.

REPLY [2 votes]: Finding/evaluating a limit requires the use of limit theorems like

algebra of limits
Squeeze theorem
Cesaro Stolz theorem
standard limits like $1/n \to 0$ as $n\to\infty$ which are proved using definition of limits.

Apart from these techniques sometimes we need to use theorems on existence of limits like a monotone and bounded sequence tends to a limit and then use the this fact to find the limit. Such solutions are often tricky. I show one example.
Let $a_n=x^{n}$ where $x$ is real. I deal with  the case when $0<x<1$. Clearly $a_n$ is monotone and bounded and hence it tends to some limit $L$.  Now we know that $a_{n+1}=xa_{n}$ and taking limits as $n\to \infty$ we see that $L=xL$ and hence $L=0$.
Your question about sequence $1/n^{2}$ can be solved by using product rule and the standard limit $1/n\to 0$. In fact we can generalize this and use the result $1/n^{a}\to 0$ for $a>0$ as a standard limit. Sometimes a combination of the techniques mentioned above may be required.
The above techniques exclusively deal with theorems related to sequences. Sometimes we also need results which deal with limits of functions of a real variable. Two such results which are popular are as follows:

If $a_n\to L$ and a function $f$ is continuous at $L$ then $b_n=f(a_n) \to f(L) $.
If $f(x) \to L$ as $x\to\infty$ then $f(n) \to L$ and if $g(x) \to L$ as $x\to 0$ then $g(1/n)\to L$.

Thus for example $n\sin(1/n)\to 1$ as $n\to\infty$.


TITLE: Is there another Analysis book that is based on the Cartesian space $\Bbb R^p$
QUESTION [3 upvotes]: I am in the middle of a slightly ambitious attempt to learn Analysis on my own. I skimmed through Rudin(Baby), Chapman Pugh, William Wade, Stephen Abbott and Strichartz and ended up preferring the Elements of Real Analysis by Bartle over the others. This might probably surprise you but I am someone who prefers the classics and I enjoy the systematic presentation and the enjoyable writing. More importantly I like the fact that the whole book is based on the space $\Bbb R^p$ and does not extend to general metric spaces which I think will help me in a first course (so that I can picture the arguments geometrically).
I only just finished the Topology chapter. But (maybe I'm wrong) looking at some questions posted on this site I can't help but wonder if there are enough exercises in Bartle's book or if the ones in it are sophisticated enough. I can't really go for another book for the problems since everything I've found is either based on metric spaces or just the real line.

So I would love it for someone who is familiar with Bartle to tell me
  if there is another supplementary text with more/ better exercises or if I actually
  need one?

REPLY [2 votes]: You might consider looking at "Analysis in Euclidean Space" by Kenneth Hoffman. The book concentrates attention on $\mathbb{R}^n$, and has some good exercises. Generalizations refer to normed linear spaces, generally $\mathbb{R}^n$ with some norm, or $\mathbb{C}$, the complex numbers. This is great preparation if you eventually decide to get into functional analysis, where complete, normed, linear spaces are a central topic.


TITLE: Harlan J. Brothers's approximation to $ e $ ad infinitum?
QUESTION [3 upvotes]: Consider the series generated by Harlan J. Brothers's method for the number $e$
http://en.wikipedia.org/wiki/List_of_representations_of_e
Can they be improved again and again or is there a limit so there exists a BEST approximation to $e$?

REPLY [2 votes]: It depends on what you mean by "improved" and  "BEST."  The paper @Martin referenced discusses "an algebraic assessment based on the decimal place accuracy (d.p.a.) that is gained from a given number of terms; the greater the d.p.a., the faster the series converges."  This is different from the run-time cost of the computation for which a smaller number of processor operations indicates that the algorithm is inherently more efficient.
While the combination of T terms results in new "compressed" terms containing a polynomial of degree T-1, the algorithm appears reasonably linear (to at least T=100).  Computing 30,000 terms with Newton's method achieves 121,287 correct digits.  Obtaining the same accuracy by computing 3,000 terms with t=10 requires very close to 1/10 the time - it's 9.9 times as fast (these computations are done in Mathematica 9).  Computing just 300 terms with T=100 is 96 times as fast.  However, for T=1000, things slow down - 30 terms are only 705 times as fast.  To my knowledge, there has been no evaluation of the true computational efficiency of the approach.
Personally, I find value in the aesthetic appeal of expressions resulting from combinations that use low values of T.  Here is a more comprehensive list of approximations that supplements the paper:
http://www.brotherstechnology.com/math/e-formulas.html
In short, Newton's series can indeed be algebraically improved again and again. The extent to which such "improvements" can continue to be of practical value is a different matter.  For proven efficiency, you can reference the work of the computational wizards cited here:
http://en.wikipedia.org/wiki/Binary_splitting


TITLE: Total number of unique symmetric random walk paths that return to the origin
QUESTION [0 upvotes]: I'm solving the below quoted problem, and I was wondering if there's actually an analytical closed form solution?

Suppose there are $n$ connected squares in a straight line. You start in the first square.
You can move to the right, or to the left of your first square, provided that your next step is still within the straight line of squares (e.g., in the first step you can't move left, and can only move right because moving left would make you go off-grid).
You traverse $m$ steps. How many unique paths are there such that you return to square 1?

I don't think there's an analytical closed form solution. I think you can define a recursion based on states, where the states are represented by the number of steps remaining and the square we're on.
Define $T(i, j)$ to be the number of unique paths to reach square $i$ from square 1 using $j$ steps. Our boundary condition is $T(1, 0) = 1$. We also know that $T(i, j) = 0$ if $i$ is odd (even) and $j$ is even (odd).
Our recursion is:
$$
T(i, j) =
T(i + 1, j - 1) + T(i - 1, j - 1)
$$
If any of the terms is out of bounds on the RHS, they just become zero. The recursion seems pretty simple, but is there a closed form solution for this?

REPLY [0 votes]: Provided that $m\leq 2n$, the paths you are looking for are equivalent to Dyck words. There are various well-known ways to prove that the number of Dyck words is given by the Catalan numbers. So in this case: $C_{m/2} = \frac{1}{m/2+1}\binom{m}{m/2}$, ($m$ should obviously be even).


TITLE: Relation between equivalence relation and cartesian product of two sets.
QUESTION [3 upvotes]: This is probably a rather stupid question, but I have looked at several different sources and still do not seem to understand this... I am teaching myself Group theory from a set of lecture notes, which have a section on equivalence relations on sets. In the notes, no mention whatsoever is made of the cartesian product of a set; it simply defines the equivalence relation, ~, on a set X as being a relation which is reflexive, symmetric, and transitive, and given examples of
"a)$X = Z$ the relation $\equiv _n$ defined as $a \equiv _n b \iff  n | b-a$"
"b) $X$ any set of groups, $\cong$ “isomorphic to” is an equivalence relation."
Now when I looked online (e.g. Wolfram Alpha) and in a book, they both define an equivalence relation in terms of a "subset, $R$, of $X \times X$".
Wikipedia has this quite concealed. It defines

a binary relation that is at the same time a reflexive relation, a symmetric relation and a transitive relation.

and I just learned from this that a binary relation is a collection of ordered pairs of elements of a set.
Now I have looked at some stack exchange posts (e.g. this one) in the hope that it may clarify something, but unfortuantely I am still confused. I don't get what some ordered pairs of a set have to do with a statement regarding the elements of the set itself (they are just ordered pairs, right?) unless the specific subset $R$ of the Cartesian product of the two sets is such that some relation between the two elements is satisfied, for example all of the ordered pairs have elements which are congruent modulo n. Or in the second example, the elements-here groups- in each pair in the subset $R$ are isomorphic.
Is this the right kind of idea? If it is, I am still struggling to see why the equivalence relation would be the 'some set of ordered pairs of elements' as opposed to the relation between them as it says in the lecture notes. I.e. in the lecture notes the 'irsomrphic to' and 'congruent modulo n' are said to be the equivalence relations, not the set of ordered pairs of elements satisying this!

REPLY [1 votes]: From an abstract point of view, a binary relation on a set X is indeed a pair $(R,X)$ such that $R\subset X\times X$. The link with the more intuitive notion is best explained with an example:
Consider the binary relation $\bmod_n$ on $\mathbf Z$ defined as
$$\bmod_n(x,y)\iff n\mid x-y$$
The corresponding subset $M\subset\mathbf Z\times\mathbf Z$ comprises the elements
\begin{align}
&(0,0),\, (0,n),\, (0,-n),\,(0,2n),\,(0,-2n),\,\dots\dots\\
&(1,0),\, (0,1+n),\, (0,1-n),\,(0,1+2n),\,\dots\dots\\
&\dots\dots\dots\dots\dots\dots\dots\dots\dots\dots\dots\dots\dots\dots..
\end{align}
Observe it is equivalent to define $\bmod_n(x,y)$ by a defining property (set comprehension) or by being a member of the list (set extension). Anyway $(x,y)\in M$ is a defining relation too.


TITLE: LHS where the argument of the function isn't explicit stated (vector equation)
QUESTION [2 upvotes]: The Lorentz force is given as
$$
\mathbf  F= q\left[\mathbf E(\mathbf r(t),t)+\mathbf v(t)\times \mathbf B(\mathbf r(t),t)\right] \tag 1
$$
where $\mathbf E, \mathbf B:\mathbb R^4\to\mathbb R^3$ are vector fields and $\mathbf r, \mathbf v:\mathbb R\to \mathbb R^3$ are vector-valued functions of one variable, $t\in \mathbb R$. And $q$ is a constant.
Question:
In books the argument of $\mathbf F$ is not explicit given, but why?
Does it mean it is a constant vector $\mathbf F\in \mathbb R^3$, i.e.
$$
\mathbf F=(F_x,F_y,F_z) \quad ? \tag 2
$$
Or, based on the right hand side, is $\mathbf F$ a vector-valued function, $\mathbf F: \mathbb R\to \mathbb R^3$, i.e.
$$
\mathbf F(t)=\big(F_x(t),F_y(t),F_z(t) \big) \quad ? \tag 3
$$
Or is it maybe a vector field, $\mathbf F: \mathbb R^4\to \mathbb R^3$, i.e.
$$
\mathbf F(\mathbf r(t),t)=\big(F_x(r(t),t)),F_y(r(t),t)),F_z(r(t),t)) \big ) \quad ? \tag 4
$$

REPLY [0 votes]: It is a vector valued function, but it is defined on $\mathbb R^7$, $\mathbf F: \mathbb R^7\to\mathbb R^3$, $$\mathbf F=\mathbf F(t, \mathbf r,\mathbf v)$$


TITLE: Are (semi)simple Lie groups some sort of "homotopy quotient groups" of their maximal tori?
QUESTION [24 upvotes]: Warning: non-specialist writing, some rubbish possible.
The formula $h^*(BG)\cong h^*(BT)^W$ valid for complex oriented cohomology of the classifying space of a compact Lie group $G$ with maximal torus $T$ and Weyl group $W$ suggests that it might come from some sort of equivalence like $G\sim T///W$ where "///" stands for some hypothetical homotopy quotient, like homotopy colimit but not in spaces but rather some sort of equivariant homotopy colimit in the category of topological groups or maybe rather in the category of homotopy associative H-spaces and homotopy coherent homomorphisms, or maybe  some sort of stacky quotient instead. Is there such a thing?
(Slightly later: comments by Ben Wieland show that what I wrote is not clear enough. Let me try to explain at least approximately: by $T$///$W$ I mean a universal object among topological group homomorphisms $f:T\to G$ together with homotopies between $f$ and $fw$ for each $w\in W$, where $w:T\to T$ is the action map. Presumably these homotopies must satisfy coherence conditions, and maybe I should require them to induce homomorphisms $T\to G^{[0,1]}$ or something similar, here I am not sure.)
My motivation (not counting that it might be useful to know such thing if it is true) comes from the fascinating paper "Root systems and elliptic curves" by Looijenga (Invent. Math. 38 (1976), pp. 17-32) where he constructs a "third invariant theory" using the Weyl group action on, in place of the Cartan subalgebra or maximal torus that are used for the "first", resp. "second" invariant theory, the abelian variety $A:=Q^\vee\otimes E$ where $Q^\vee$ is the lattice generated by the dual root system and $E$ is an elliptic curve. (Invariants are with respect to the $W$-action on sections of the line bundle over $A$ corresponding to the divisor formed by the fixed hypertori of $W$-reflections, and are expressed using certain theta functions.)
I wonder if some similar "homotopy quotient group" $A///W$ can be formed to yield some new kind of group-like object.
However I must admit that before this irresponsible "jump from second to third" it would be more appropriate to first understand the "first" case -- whether the corresponding Lie algebra $\mathfrak g$ might be realized as some sort of "homotopy quotient Lie algebra" $\mathfrak h///W$ of the Cartan subalgebra by the Weyl group...

REPLY [14 votes]: Here's the "answer" that I started writing, then put away for a while.  The short answer is: although "T//W" is not the same as G, they "look sort of the same" from the point of view of certain generalized cohomology theories.  If you replace the role of the maximal torus with "arbitrary abelian subgroups", this "looking the same" can be given homotopical meaning.  Finally, this data that your generalized cohomology (such as elliptic cohomology) "sees" can be encoded (according to Lurie) in terms of objects of derived algebraic geometry, which for elliptic cohomology you can think of as the "A///W" that you want to have.
...
As pointed out in the comments, $h^*(BG)\neq h^*(BT)^W$ for many compact simply connected $G$ and generalized cohomology theories (though equality does hold for $G=U(n)$ or $SU(n)$ and $h^*$ complex oriented).
If you try to naively make a "homotopical" version of this, by talking about classifying spaces, it gets even worse:  in general $BG \neq BT_{hW}$, where the right-hand side is the homotopy invariant quotient of $BT$ by the action of the Weyl group (in fact, $BT_{hW}= B(NT)$, the classifying space of the normalizer.)
What is true is if the appropriate set of primes is inverted in your cohomology theory, then you get an equivalence: e.g., if $|W|$ is inverted in $h^*$, then $h^*(BG)=h^*(NT)$ for connected $G$ (as Saal Hardali points out in the comments).  But it's not true integrally.
(It is true rationally.  Which you can then reinterpret as a statement of Chern-Weil theory: $H^*(BG;\mathbb{R}) = (\operatorname{Sym} \mathfrak{g}^*)^G$; i.e., seen by $\mathbb{R}$-cohomology, $BG$ "looks like" $\mathfrak{g}//G$.)
Another thing to do is to generalize from "maximal torus" to "arbitrary abelian subgroup".  So let $\mathcal{A}(G)$ be the category of "abelian subgroups of $G$": really, the category whose objects are $G/A$, the $G$-orbits with abelian isotropy group $A$, and whose maps are the space of $G$-equivariant maps between such orbits.  Note that for connected $G$ this category contains the object $G/T$ with $\mathrm{Aut}(G/T)=W$, so it really is a generalization of "$W$ acting on $T$".
Then we obtain a "better" approximation map:
$$ \mathrm{hcolim}_{G/A\in \mathcal{A}(G)} BA  = \mathrm{hcolim}_{G/A\in \mathcal{A}(G)} (G/A)_{hG}\to BG,$$
which actually makes sense for all compact Lie group $G$ (including finite groups).  This approximation actually turns out to be an equivalence (though not for deep reasons).  Note: $\mathrm{hcolim}$ is homotopy colimit, and $(-)_{hG}$ is homotopy orbits.
Side note: the above "formula" implies a spectral sequence for any cohomology theory $h^*$ for computing $h^*(BG)$.  This spectral sequence has as its "edge" map:
$$
h^*(BG) \to \operatorname{lim}_{G/A\in \mathcal{A}(G)} h^*(BA).
$$
Hopkins, Kuhn, and Ravenel proved that for a finite $G$, and a complex oriented $h^*$, this edge map becomes an isomorphism after inverting $|G|$.  This is one version of their famous "character theorem".
There are analogues of this that apply equivariant cohomology theories other than "Borel equivariant cohomology", in which case things are more subtle.  For instance, consider equivariant $K$-theory.  If for a $G$-space $X$ I let $K_G(X)$ denote the spectrum whose homotopy groups are the $G$-equivariant $K$-theory of $X$, then there is supposed to be an equivalence
$$
K_G(*) \approx \mathrm{hlim}_{G/A\in \mathcal{A}(G)} K_G(G/A) =\mathrm{hlim}_{G/A\in \mathcal{A}(G)} K_A(*).
$$
Here $G$ is any compact Lie group, including finite ones (in which case it is a kind of Artin induction theorem).  (This is basically asserted in Lurie's "Survey of Elliptic Cohomology", though I haven't seen a proof written out in full anywhere.  $\mathrm{hlim}$ is homotopy limit.)
In other words, equivariant $K$-theory "sees" $G$ (more precisely, $(*//G)$) as indistinguishable from a derived colimit of abelian subgroups $A$ (more precisely, $(*//A)$).  This is reminiscent of and related to (but distinct from and more complicated than) the observation that $RG=RT^G$ for representation rings of compact connected groups (because $\pi_0 K_G(*)=RG$).
Another equivariant cohomology theory you might try is elliptic cohomology.  If you had a "naturally occuring" example of an equivariant elliptic cohomology, you would conjecture that it satisfies an analogue of the above equivalence.  Or, if you're Jacob Lurie, you construct equivariant elliptic cohomology for arbitrary abelian compact Lie groups, then extend it to arbitrary compact Lie groups by  imposing an equivalence as above.
Thus, Lurie associates to each abelian compact Lie group $A$ an object $M_A$ in derived algebraic geometry, so that:

$M_{U(1)}$ is a "derived elliptic curve" $E$,
$M_{A\times B}=M_A\times M_B$, so in particular
$M_{U(1)\otimes Q} = E\otimes Q$ for a lattice $Q$, and
$M_{Z/n}= $ kernel of $[n]:E\to E$.

Then for an arbitrary compact Lie group $G$ you should set $M_G$ to be some sort of colimit of a functor on $\mathcal{A}(G)$ that you can construct which sends $G/A\mapsto M_A$. (Apparently it's delicate to know exactly what sort of geometric object $M_G$ will be, but for the purposes of extracting  an equivariant cohomology theory out of this business  it's probably not too important.  I'll pretend it is some kind of geometric object for the purposes of this discussion.)
For $G$ connected, you should think of $M_G$ as a derived and souped-up version of $E\otimes Q^{\vee}//W$ (souped-up because we use all abelian subgroups of $G$ and not just the torus with its Weyl group action).
As a bonus, Lurie can extend this set-up to Lie 2-groups $\widetilde{G}$ which are extensions of the form $1\to \mathbb{B}U(1)\to \widetilde{G}\to G\to 1$, associated to some cohomology class $c\in H^4(BG;\mathbb{Z})$.
Then $M_{\widetilde{G}}$ is (I think, and modulo things that I haven't said quite correctely) supposed to be the principal space of a line bundle over $M_G$, whose sections are to be (presumably) described by the theta-functions that Looijenga writes down in that paper you mention.  (As an aside, I have no idea what motivates Looijenga to do whatever it is he does in that paper.)
Unfortunately, I don't know much more, since most of this is only described in Lurie's "Survey" mentioned above, which is only an announcement.  (Versions of this story were perceived much earlier, most notably by Grojnowski in "Delocalized equivariant elliptic cohomology".)


TITLE: Proving that the square of a particular Brownian Motion approaches zero as its Quadratic Variation approaches 0?
QUESTION [1 upvotes]: I'm working on this problem for my stochastic analysis course:

For $t \geq 0,$ let $W_t$ be a Wiener process defined on $( \Omega, \mathcal F, \mathbb{P})$, and let $$Q_{\Pi} = \sum_{i=0}^{n-1} (W_{t_{i+1}}-W_{t_{i}})^3.$$
  Also, let $|| \Pi || = \text{max}_{0 \leq i \leq n-1}(t_{i+1}-t_i).$
Prove that as $|| \Pi || \rightarrow 0$, $\text{ } \mathbb{E}(Q_\Pi^2) \rightarrow 0.$

To be honest, I am not confident in my proof. Here is what I have so far; my strategy is to factor out a $(W_{t_{i+1}}-W_{t_{i}})^2$ and bound it by $||\Pi||$:
$$\mathbb{E}\big(Q_{\Pi}^2\big) = \mathbb{E}\bigg( \sum_{j=0}^{n-1} \sum_{i=0}^{n-1} (W_{t_{i+1}}-W_{t_{i}})^3(W_{t_{j+1}}-W_{t_{j}})^3 \bigg)$$
$$\leq \mathbb{E}\big((W_{t_{i+1}}-W_{t_{i}})^2\big) \mathbb{E}\bigg( \sum_{j=0}^{n-1} \sum_{i=0}^{n-1} (W_{t_{i+1}}-W_{t_{i}})(W_{t_{j+1}}-W_{t_{j}})^3 \bigg)$$
$$= (t_{i+1}-t_{i}) \cdot \mathbb{E}\bigg( \sum_{j=0}^{n-1} \sum_{i=0}^{n-1} (W_{t_{i+1}}-W_{t_{i}})(W_{t_{j+1}}-W_{t_{j}})^3 \bigg)$$
$$\leq ||\Pi|| \cdot \mathbb{E}\bigg( \sum_{j=0}^{n-1} \sum_{i=0}^{n-1} (W_{t_{i+1}}-W_{t_{i}})(W_{t_{j+1}}-W_{t_{j}})^3 \bigg),$$
which should approach zero as $||\Pi|| \rightarrow 0$.
How could I prove the implied statement in the problem? i.e., what am I missing? Is there a better way to approach this?
EDIT
Per Youem's suggestion in the comments, I've decided to Expectational value where i=j. This is what I get:
$$(Q^2_Π)=\sum_{i=0}^{n−1}((W_{t_{i+1}}−W_{t_i})^6)$$
Not entirely sure where to go from here.

REPLY [2 votes]: Let $\mu = \mathbb E [Z^6]$ for $Z\sim\mathcal N(0,1)$. Since $W_{t_{i+1}} - W_{t_i} \sim \mathcal N(0, t_{i+1} -t_i)\sim (t_{i+1} - t_i)^\frac12\mathcal N (0,1)$, $$\mathbb E \left[ \left( W_{t_{i+1}} - W_{t_i}\right)^6 \right] = \mu (t_{i+1}- t_i)^3 \le \mu \left\|\mathbb \Pi\right\|^2 (t_{i+1}-t_i)$$ then $$\sum_{i=0}^{n-1} E \left[ \left( W_{t_{i+1}} - W_{t_i}\right)^6 \right] \le \mu \left\|\mathbb \Pi\right\|^2 (t_{i+1}-t_i) = \mu \left\|\mathbb \Pi\right\|^2 \sum_{i=0}^{n-1}\left(t_{i+1} -t_i\right) = \mu\left\|\mathbb \Pi\right\|^2 (t_n - t_0)$$ then $$\mathbb E[Q_\Pi^2] \le \mu \Pi^2 (t_n -t_0) \le \mu \left\|\Pi\right\|^2 t$$


TITLE: Manipulating dot products
QUESTION [0 upvotes]: I know that vectors $a$ and $b$, $a \cdot b = b^Ta$.
So, for a $n \times  n$ matrix $A$, and vectors $x$ and $y$
$$ (Ax) \cdot (Ay) = (Ay)^T (Ax) =y^T (A^T Ax) = (A^T Ax) \cdot  y^T = (A^T A) (x \cdot  y^T)$$
Is this correct? In particular, I know $(ax) \cdot y = a (x \cdot y)$ for $a \in \mathbb{R} $, does this work for matrices?

REPLY [1 votes]: $$
\newcommand \trans {^\mathsf T}
v \cdot (Mw) = w\trans M\trans v = w\trans (M\trans v) = (M\trans v) \cdot w,
$$
now plug them in.


TITLE: Why $G/N$ is discrete?
QUESTION [4 upvotes]: I am reading the lecture notes. On page 15, Line -5, why $G/N$ is discrete? Thank you very much.

REPLY [5 votes]: Since by assumption $N$ is open, singletons in $G/N$ are open (the preimage of the singleton under the projection is a coset of $N$, and cosets of open sets are open), hence every subset of $G/N$ is open (as a union of singletons, which are open), so $G/N$ is a discrete space.

Alternative, more verbose explanation:
The quotient $G/N$ is endowed with the quotient topology, that means a subset $A \subset G/N$ is open if and only if $\rho^{-1}(A)$ is open in $G$, where $\rho \colon G \to G/N$ is the canonical homomorphism.
$\rho^{-1}(A)$ is a union of cosets of $N$, $$\rho^{-1}(A) = \bigcup_{x\in \rho^{-1}(A)} x\cdot N.$$
$N$ is open by assumption, and the translations are homeomorphisms in a topological group, hence $\rho^{-1}(A)$ is open in $G$ for every $A\subset G/N$, so every subset of $G/N$ is open.


TITLE: Examples of how to calculate $e^A$
QUESTION [5 upvotes]: I'm trying to learn the process to discover $e^A$
For example, if $A$ is diagonalizable is easy:
$$A =\begin{pmatrix}
        5 & -6 \\
        3 & -4 \\
        \end{pmatrix}$$
Then we have the canonical form $$J_A =\begin{pmatrix}
        2 & 0 \\
        0 & -1 \\
        \end{pmatrix}$$
because the auto-values are $2$ and $-1$.
Am I right? so I continue
$$e^A =P\begin{pmatrix}
        e^2 & 0 \\
        0 & e^{-1} \\
        \end{pmatrix}P^{-1}$$
Where $$P=\begin{pmatrix}
        2 & 1 \\
        1 & 1 \\
        \end{pmatrix}$$
Because the auto-vectors are (2,1) and (1,1).
If the auto-values the things become more complicated:
For example:
$$B =\begin{pmatrix}
        0 & 1 \\
       -2 & -2 \\
        \end{pmatrix}$$
The auto-values are $-1+i$ and $-1-i$, then the canonical form is:
$$J_B =\begin{pmatrix}
        -1 & -1 \\
        1 & -1 \\
        \end{pmatrix}$$
I don't know how to discover $e^B$ in the complex case. How do I have to proceed in this case?
I would like to know also if there are some pdfs or books with examples or problems with solutions about this subject.
I really need help
Thanks a lot.
EDIT
I found another example of a matrix whose some auto-values are complexes:
$$
        C=\begin{pmatrix}
        1 & 0 & -2 \\
        -5 & 6 & 11 \\
        5 & -5 & -10 \\
        \end{pmatrix}
$$
Its canonical form
$$
        J_C=\begin{pmatrix}
        1 & 0 & 0 \\
        0 & -2 & 1 \\
        0 & -1 & -2 \\
        \end{pmatrix}
$$
Why $J_A$ is the matrix $A$ in the canonical form? the author doesn't use complexes numbers, why? How do I find $e^A$ in this case? in the same way?
EDIT 2
The book I'm using says that the complex Jordan block related to the auto-value $a+bi$ is
$$
        \begin{pmatrix}
        a & b \\
        -b & a \\
        \end{pmatrix}
$$
The book also says that it's using the real Jordan canonical form in contrast with the complex Jordan canonical form (see answer below).

REPLY [4 votes]: You might want to have a look at Nineteen Dubious Ways to Compute the Exponential of a Matrix, Twenty-Five Years Later
Other references can be found in The matrix exponential: Any good books?
We have:
$$A = \begin{bmatrix}0 & 1 \\-2 & -2\end{bmatrix}$$
We want to find the characteristic polynomial and eigenvalues by solving
$$|A -\lambda I| = 0 \rightarrow \lambda^2+2 \lambda+2 = (\lambda+(1-i)) (\lambda+(1+i))= 0 \rightarrow \lambda_1 = -1+i, ~~\lambda_2 = -1-i $$
If we try and find eigenvectors, we setup and solve: $[A - \lambda I]v_i = 0$.
So, we have:
$$[A - \lambda_1 I]v_1 = 0 = \begin{bmatrix}1-i & 1\\-2 &-1-i\end{bmatrix}v_1 = 0$$
This leads to a RREF of:
$$\begin{bmatrix}1 & \dfrac{1}{2}(1 +1)\\0 & 0\end{bmatrix}v_1 = 0 \rightarrow v_1 = \left(1, -\dfrac{1}{2}(1 + i)\right)$$
Doing the same process for the second eigenvalue yields: $v_2 = \left(1, -\dfrac{1}{2} + \dfrac{i}{2}\right)$
From all of this information, we can write the matrix exponential using the Jordan Normal Form.
We have the diagonal form:
$$A = P \cdot J\cdot P^{-1} = \begin{bmatrix}-1/2+i/2 & -1/2-i/2 \\ 1 & 1\end{bmatrix} \cdot \begin{bmatrix}-1-i & 0 \\ 0 & -1+i\end{bmatrix} \cdot \begin{bmatrix}-i & 1/2-i/2 \\ i & 1/2+i/2 \end{bmatrix}$$
So, now we can take advantage of the diagonal form as:
$\displaystyle e^A = P \cdot e^J \cdot P^{-1} = \begin{bmatrix}-1/2+i/2 & -1/2-i/2 \\ 1 & 1\end{bmatrix} \cdot e^{\begin{bmatrix}-1-i & 0 \\ 0 & -1+i\end{bmatrix}} \cdot \begin{bmatrix}-i & 1/2-i/2 \\ i & 1/2+i/2 \end{bmatrix} = \begin{bmatrix}-1/2+i/2 & -1/2-i/2 \\ 1 & 1\end{bmatrix} \cdot \begin{bmatrix}e^{-1-i} & 0 \\ 0 & e^{-1+i}\end{bmatrix} \cdot \begin{bmatrix}-i & 1/2-i/2 \\ i & 1/2+i/2 \end{bmatrix} = \begin{bmatrix} (1/2+i/2) e^{-1-i}+(1/2-i/2) e^{-1+i} & (1/2) i e^{-1-i}-(1/2) i e^{-1+i} \\-i e^{-1-i}+i e^{-1+i} & (1/2-i/2) e^{-1-i}+(1/2+i/2) e^{-1+i} \end{bmatrix}$
Other methods are shown in that paper I referenced above.
If we compare this for the real case, the process is the same and we end up with:
$\displaystyle e^A = P \cdot e^J \cdot P^{-1} = \begin{bmatrix}1 & 2\\1 & 1\end{bmatrix} \cdot e^{\begin{bmatrix}-1 & 0\\0 & 2\end{bmatrix}} \cdot \begin{bmatrix}-1 & 2\\1 & -1\end{bmatrix}= \begin{bmatrix}1 & 2\\1 & 1\end{bmatrix} \cdot {\begin{bmatrix}e^{-1} & 0\\0 & e^2\end{bmatrix}} \cdot \begin{bmatrix}-1 & 2\\1 & -1\end{bmatrix} = \begin{bmatrix}\dfrac{-1+2 e^3}{e} & -\dfrac{2 (-1+e^3)}{e}\\ \dfrac{-1+e^3}{e} & \dfrac{2-e^3}{e}\end{bmatrix}$
It is also worth noting that things can also get very ugly, for example, see:
generalized eigenvector for 3x3 matrix with 1 eigenvalue, 2 eigenvectors


TITLE: Number of arcs in a planar graph
QUESTION [0 upvotes]: I have graph built just like in the image:
the red dots are the edges and the black lines are the arcs that connect them.
The only difference from the picture is that in my graph the arcs are double(two for each line in the picture).
My question is: whats the the formula that gives me the exact number of arcs from my graph if I know the number of the base dots and the height dots?
I thought it would be arcs=total_dots_number*16-{[(2*base_dots)+(2*height_dots)-4)]*6+4*10} but it is apparently wrong.

REPLY [0 votes]: Recall that the handshaking lemma states that $\sum_{v\in V}deg(v)=2e$, where $e$ is the number of edges (arcs), $V$ is the set of vertices (dots), and $deg(v)$ is the number of edges incident with vertex $v$.
Suppose you have $m$ vertices in each column and $n$ vertices in each row. The degree of each of the four corner vertices is $6$. The degree of a non-corner vertex along the side is $10$. There are $2(n-2)+2(m-2)$ of these. Finally, the degree of an internal vertex is $16$. There are $(n-2)(m-2)$ of these. Hence, the total number of edges is $$\frac{4(6)+10(2(n-2)+2(m-2))+16(n-2)(m-2)}{2},$$ which I'll leave for you to simplify.


TITLE: Integration of $\frac{dx}{x\sqrt{\ln x^2 +6\ln x}}$
QUESTION [1 upvotes]: $\require{cancel}$
Hello everybody so this is my integration question. I have reached a point in my picture. I don't know how to continue. I appreciate the help.
Also , am I going in the right direction ??
Please note, square root is over $\ln x^2 +6\ln x$.
\begin{align*}
\int\frac{1}{x\sqrt{\ln x^2+6\ln x}}dx\underset{\substack{\big| \\ u=\ln t \\ du=\frac{dt}{t}}}{=}{}&\int\frac{1}{\sqrt{u^2+6u}}du\underset{\substack{\big| \\ \text{Complete} \\ \text{square.}}}{=}\int\frac{1}{\sqrt{(u+5)^2-9}}du={} \\
{}\underset{\substack{\big| \\ s=u+5 \\ ds=du}}{=}{}&\int\frac{1}{\sqrt{s^2-9}}ds\underset{\substack{\big| \\ s=3\sec z \\ ds=3\tan z\sec zdz}}{=}\int\frac{1}{\sqrt{9\sec^2z-9}}3\tan z\sec zdz={} \\
{}\underset{\substack{\big| \\ \sec^2z-1=\tan^2z}}{=}{}&\int\frac{1}{\sqrt{9\tan^2z}}dz=\int\frac{3\tan z\sec z}{3\tan z}dz=\int\sec zdz={} \\
{}={}&\int\frac{\sec z(\tan z+\sec z)}{\tan z+\sec z}dz=\int\frac{\cancel{\sec z\tan z}+\sec^2z}{\cancel{\sec z\tan z}}dz=\int\sec^2zdz.
\end{align*}
Image of work by OP
Thank you.

REPLY [5 votes]: Set $t=\ln x$ and $dt=\frac{dx}{x}$
$$=\int\frac{dt}{\sqrt{t^2+6t}}\overset{\text{complete the square}}{=}\int \frac{dt}{\sqrt{(t+3)^2-9}}$$
Set $s=t+3$ and $ds=dt$
$$=\int\frac{ds}{\sqrt{s^2-9}}$$
Set $s=3\sec(p)$ and $ds=3\tan p \sec p dp$, then $\sqrt{s^2-9}=\sqrt{9\sec^2 p-9}=3\tan p$ and $p=\sec^{-1}\left(\frac s 3 \right)$
$$=\int \sec pdp=\ln(\tan p +\sec p)+\mathcal C=\dots$$

REPLY [1 votes]: Once you have the differential in the form $\frac{ds}{\sqrt{s^{2}-a^{2}}}$, the integral will be just the inverse hyperbolic cosine of $\frac sa$ plus a constant.


TITLE: Finding the eigenvalues and eigenfunctions to this sturm-liouville operator
QUESTION [1 upvotes]: I am asked to find the eigenvalues and eigenfunctions to the operator $A$, defined by
$$Au = -\frac{d^2u}{dx^2}-6\frac{du}{dx}$$
and also $0<x<L, \quad u(0) = u(L) = 0$.
Rewriting the operator to sturm-liouville form gives
$$Au = -\frac{1}{e^{6x}}(e^{6x}u')'.$$
To find the eigenvalues, eigenvectors I am solving
$$Au = \lambda u \iff -u''-6u'-\lambda u = 0$$
where the characteristic equation $x^2 + 6x + \lambda = 0$ has solution $x=-3\pm \sqrt{9-\lambda}.$
What can I say about $\lambda$ to further solve this? How do I proceed? And how do I incorporate the restrictions on $u$?
The solution is supposed to be
$$\lambda_k = 9 + (\frac{k\pi}{L})^2$$
$$u_k(x) = e^{-3x}\sin{\frac{k\pi}{L}x}, \ k=1,2,.....$$

REPLY [0 votes]: $$
             Af=\lambda f \iff -f''-6f'=\lambda f
$$
To normalize the solutions, set $f(0)=0$ and $f'(0)=1$. Assume that $f=e^{\alpha x}$. Then
$$
                 -\alpha^2-6\alpha=\lambda \\
                   \alpha^2+6\alpha=-\lambda \\
                  (\alpha+3)^2=9-\lambda\\
                 \alpha = -3 \pm \sqrt{9-\lambda}
$$
The solutions so far are
$$
        f(x)=e^{-3x}\frac{\sin(\sqrt{\lambda-9}x)}{\sqrt{\lambda-9}}
$$
Now the condition $f(L)=0$ determines the eigenvalues $\lambda$:
$$
              \frac{ \sin(\sqrt{\lambda-9}L)}{\sqrt{\lambda-9}}=0.
$$
$\lambda=9$ is not a solution because the limit of the above as $\lambda\rightarrow 9$ is non-zero. The solutions are
$$
            \lambda = 9+n^2\pi^2/L^2,\;\;\; n=1,2,3,\cdots.
$$
The resulting eigenfunctions are
$$
              f_n = e^{-3x}\frac{\sin(n\pi x/L)}{n\pi/L},\;\;\; n=1,2,3,\cdots.
$$


TITLE: Completing the proof for a combinatorics question from OIM 1994
QUESTION [4 upvotes]: The question states:
In every square of an $n × n$ board there is a lamp. Initially all the lamps are turned off. Touching a lamp changes the state of all the lamps in its row and its column (including the lamp that was touched). Prove that we can always turn on all the lamps and find the minimum number of lamps we have to touch to do this.
How do I complete the proof for the even case below?
My attempt:
If we spit the problem into odd $n \times n$ cases and even $n \times  n$ cases we see the following:
Odd:
We can turn every lamp on in a board by simply touching every lamp in one column. Suppose we sequentially touch every lamp in column $C1$. This turns on all lamps in each row (and since they are not affected by consequent moves remain on). The lamps in the column will eventually all be on too because they are affected an odd number of times.
Thus we have a strategy taking $n$ moves. We cannot affect all the lamps in fewer moves and this must be the best strategy for an odd $n$.
Even:
I present a strategy for turning on all lamps:
We can split any $n \times n$ board into blocks of $2\times 2$. For each $2 \times 2$ if we touch each lamp in a clockwise fashion, we turn on all the lamps in that block without affecting all other lamps. We can thus use this strategy for all blocks and turn on all lamps in $n^2$ moves.
Now I have a feeling we cannot beat this strategy (I get this sense because I cannot beat it in the 2x2 case) but am not sure how to prove this strategy cannot be beaten in a more general fashion.

REPLY [1 votes]: Suppose $n$ is even. You have shown that you can light up all $n^2$ bulbs by pressing each one. You want to show that there is no solution requiring fewer than $n^2$ presses.
It is easy to see that no minimal-number-of-presses solution involves pressing a bulb more than once, so your goal is to show that there is no solution where one or more bulbs is never pressed.
Denote a solution as a $0,1$ $n\times n$ matrix $P$ with $1$ indicating “pressed” and $0$ indicating “not pressed.” Suppose there is a solution where the bulb at position $i,j$ was not pressed, that is, a solution matrix $P$ has $P_{ij}=0$ for some particular $i$ and $j$. Then for bulb $ij$ to be on, there must be an odd number of $1$s in row $i$ and column $j$ combined. Consequently, in $P$, the row sum of row $i$ and column sum of column $j$ are of opposite parity and one of them is odd. Without loss of generality (you can transpose the grid and matrix), assume the $i$-th row sum is odd. For this to be true, row $i$ must contain an odd number of $1$s and an odd number of $0$s.
Now, with $i$ the row mentioned above (with row sum odd), consider the column sums of $P$. In a column $k$ where $p_{ik}=0$, there must be an even number of $1$s (think about how never-pressed bulb $(i,k)$ can be on). In a column $\ell$ where $p_{i\ell}=1$, there must be an odd number of ones.
Altogether, there must be an odd number of columns that contain an odd number of $1$s — one through each of the $0$s in row $i$. Thus the total number of $1$s in the entire matrix $P$ must be odd.
Now, each bulb press changes the parity of $2n-1$ bulbs, an odd number, so the assumed solution accomplishes an odd number of parity changes. However, the total change in parity from “all off” to “all on” must turn an even number of bulbs from off to on, which requires an even number of parity changes. This is a contradiction, so no bulb can be unpressed in a solution.


TITLE: A continuous bijection from $l_2 $ onto a subset of $l_2$ whose inverse is everywhere discontinuous.
QUESTION [7 upvotes]: I was reading an article from AMM, titled,
A continuous bijection from $l_2 $ onto a subset of $l_2$ whose inverse is everywhere discontinuous.
In this he constructed the function $T:l_2\rightarrow l_1$ as $T(x)=$$(\sigma(x_1)x_1^2, \cdots,\sigma(x_i)x_i^2, \cdots )$
And shown this function to be bijective, continuous whose inverse is everywhere discontinuous.
My question is, What's the motivation behind this example? Why did the author find this example? What's the importance of this example?

REPLY [3 votes]: Topological point of view. Any continuous bijection between compact Huasdorff spaces is a homeomorphism, that is its inverse is continuous. This example shows that compactness condition can not be dropped. Author's example shows necessity of compactness in a strong sense, because the inverse of $T$ is not merely discontinuous, its everywhere discontinuous.
Functional analytic point of view. By bounded inverse theorem any continuous linear bijection between Banach spaces is a linear homeomorphism. Again, the author's example shows necessity of linearity in that theorem, otherwise you can get inverse map which is discontinuous (and even more - discontinuous at every point).


TITLE: Evaluating $\lim_{\beta\to 0^-} \left(-\ln|\beta| + e^{\beta}\right) + \lim_{\beta\to 0^+} \left(\ln|\beta|\right)$?
QUESTION [2 upvotes]: Here is my problem:
$$\begin{align}
&\lim_{\beta\to 0^-} \left(-\ln|\beta| + e^{\beta}\right) + \lim_{\beta\to 0^+} \left(\ln|\beta|\right) \\
=& \lim_{\beta\to 0} \left(\ln|\beta| - \ln|\beta| + e^{\beta}\right) \\
=& \lim_{\beta\to 0} e^{\beta} = 1
\end{align}$$
First of all sorry i can't give the whole context since will consume a lot of time to type it by hands. So, in short i'm evaluating the integral using cauchy principal value and came up with this.
Is it legal to do that limit? Since i have an absolute value and if i split the first limit, the first term will be the same as the second limit and for convenience i change the limit goes to 0 (both sides)? Please help me to understand about limit. Or maybe if it's illegal you can tell me why. Thanks in advance!

REPLY [6 votes]: Unfortunately, this is not legal. Why? Well - when you say something like
$$
\lim_{\beta\to 0}\ln|\beta|
$$
we are talking about the number that this limit converges to. If it doesn't converge, it's not well defined. The property of limits that
$$
\lim_{x\to a}f(x)+g(x) = \lim_{x\to a}f(x) + \lim_{x\to a}g(x)
$$
(which is essentially what you used on the first line, or I guess, the reverse of this) only holds if the individual limits exist (in your case, they definitely don't).


TITLE: binomial distribution questions
QUESTION [0 upvotes]: I am stuck on the following question and am not sure where to go from what I have currently done.
Donald Trump has gone moose hunting. When he fires his gun at a moose he scores a hit with a probability of 0.8. On a typical hunt, he will fire his gun 30 times. Let X denote the number of shots that actually hit a moose.
I know i need to find out n, p and q. So n = 30, p = 0.8 and q = 0.2

i) What is the probability that at least 3 of the shots are misses?
For this do I need to find the probability that x=3, x=4, x=5 ... x=29, x=30?
that is all that I can think to do.

ii) What is the probability that more than 20 of the shots are hits?
for this one do I need to find the probability that x=20, x=21, ... x=30?

I know I have to put it into an equation, but I am not sure how to do that equation. any help will be great. thank you

REPLY [1 votes]: For this do I need to find the probability that x=3, x=4, x=5 ... x=29, x=30?
  that is all that I can think to do.

Yes, specifically you want to find $P(X \geq 3) = \sum_{x = 3}^{30}P(X = x)$ where we can add because the events are disjoint. However, there are two problems. First, that's a lot of work. You instead might want to consider the complement and do
$$P(X\geq 3) = 1- P(X<3).$$
Second, notice how $X$ was defined. It counts the number of hits (which are considered "successes"), but in part i., we want to count the number of misses. We consider the misses to be the "successes". So for clarity, define a new random variable $Y$ that follows the binomial distribution with $n = 30$ and $p = 0.2$, where $p$ is the probability of missing ("success") and compute
$$P(Y\geq 3) = 1-P(Y<3).$$
"More than 20" means strictly greater than 20. It does not include 20. Notice that here we are in fact counting the number of hits ("successes"). The number of hits is accurately described by $X$ as given in the problem, and $n = 30$ and $p = 0.8$ like you provided. Like you described, you want to find
$$P(X> 20) = \sum_{k = 21}^{30}P(X = k).$$

Finally, recall that for a random variable $X$ that follows the binomial distribution with $n$, $p$, the probability that $X = k$ for $0\leq k\leq n$ is
$$P(X= k) = \binom{n}{k}p^k(1-p)^{n-k}$$
where $\binom{n}{k}$ is the binomial coefficient and $p+q = 1$.


TITLE: How to model a transport problem as a flow problem?
QUESTION [0 upvotes]: I am working on the fellowing transport problem. Let assume a company want to accomplish daily a number of transports $T_1,\ldots,T_m$ between $n$ cities $C_1,\ldots,C_n$. We know the duration of every transport between every couple of cities for example $d_{i,j}$ the duration of a transport between cities $C_i$ and $C_j$. On the other hand for every transport we know the departure city, the arrival city and the time of departure. The company want to minimize the cost of all transports by using a minimum number of vehicles. How can I formulate this problem of finding the minimum number of vehicles as a problem of flow. I tried to consider a graph where two cities are connected if there exists a transport between them but unfortunately, I did not obtain a model where I can use a flow problem. Does anyone have any idea to help me ?

REPLY [0 votes]: What you have is probably an integer programming problem. The exact form requires a few more specifications, like :

Whether a vehicle can be affected to several trips, if these trips
need the same route or if vehicles can transport A->B, then go to C
and transport C->D.
Whether a vehicle has to be back to its starting
point at the end of the day, or to a given warehouse, or not
Whether you have time constraints (you presumably do)
etc.

The binary variables will likely include $x_{ij}=1$ if vehicle $i$ does transport $j$ and $=0$ otherwise. It can get quite complex depending on your constraints.
The underlying graph will be relevant but that is only part of the equation.
You may want to google "integer programming for transportation problems", the field is huge and has been researched for at least 30 years. Most of these problems are hard in the sense that obtaining an optimal solution takes a very long time for large $m$ and $n$ (google "NP-Hard").


text:
\begin{document}

\begin{frontmatter}

\title{Model predictive control of indoor microclimate: existing building stock comfort improvement}

\author[Skoltech]{A. Ryzhov}
\author[Skoltech]{H. Ouerdane \corref{mycorrespondingauthor}}
\cortext[mycorrespondingauthor]{Corresponding author}
\ead[url]{h.ouerdane@skoltech.ru}
\author[Skoltech]{E. Gryazina}
\author[Skoltech]{A. Bischi}
\author[MIT]{K. Turitsyn}

\address[Skoltech]{Center for Energy Systems, Skolkovo Institute of Science and Technology, 3 Nobel Street, Skolkovo, Moscow Region 143026, Russia}
\address[MIT]{Department of Mechanical Engineering, Massachusetts Institute of Technology, Cambridge, MA USA}

\begin{abstract}
Home retrofitting provides a means to improve the basic energy and comfort characteristics of a building stock, which cannot be renewed because of prohibitive costs. We analyze how model predictive control (MPC) applied to indoor microclimate control can provide energy-efficient solutions to the problem of occupants' comfort in a variety of situations principally imposed by external weather and room occupancy. For this purpose we define an objective function for the energy consumption, and we consider two illustrative cases: one building designed and built in recent times with modern HVAC equipment, and one designed and built several decades ago with poor thermal characteristics and no dedicated ventilation system. Our model includes various physical effects such as air infiltration and indoor thermal ''inertia mass'' (inner walls, floor, ceiling, and furniture), and also accounts for the impact of human presence essentially as heat and CO$_2$ sources. The influence on the numerical results of forecast horizons and of uncertainties due to inaccuracies in the weather and room occupancy forecasts, are analyzed. As we solve non-convex optimization problems using a linear and a nonlinear optimizer, full MPC performance is compared to both linearized MPC and a standard on/off controller. The main advantage of MPC is its ability to provide satisfactory solutions for microclimate control at the least possible energy cost for both modern and old buildings. As old buildings are usually not properly ventilated, we see  in light of our simulation results, that a supply ventilation system installation provides a solution for significant air quality improvement.
\end{abstract}

\begin{keyword}
Model predictive control \sep Indoor comfort \sep Building energy simulation \sep Residential building
\end{keyword}
\end{frontmatter}

\section{Introduction}
Buildings designed and built during the 20th century and before form the largest part of those in use today. Their basic characteristics in terms of energy efficiency, environmental impact and comfort are de facto below par with the present standards driven by low-carbon policies, sustainability and features of modern energy systems. Furthermore, aging of buildings is accelerated by poor/harsh weather conditions \cite{Sadauskiene2009,Liisma2015}, favoring wall degradation because of, e.g., penetration of moisture in cracks and cavities of the walls and around windows, which in turn enhances heat leaks. In fact, buildings that host people in general, either public offices or dwellings, pose particular design and engineering challenges, as the human presence entails particular requirements in terms of comfort and use of energy.

Generally speaking, comfort is usually characterized by a variety of ranges of measurable quantities such as temperature, humidity, concentration of CO$_2$ generated by occupants, other pollutants and particulate matter (PM), as well as lighting, and radiant heat. Given the complexity and interplay among these quantities, comfort constitutes an active field of research, which drives innovative design in the building sector by setting bounds on them \cite{Ortiz2017,ASHRAE}: indoor comfort temperatures typically lie between 19$^{\circ}$C and 25$^{\circ}$C, the relative humidity within the 45\% to 65\% range, and ideally CO$_2$ concentration should be kept to a minimum comparable to, e.g., the environmental level which is typically below 400 ppm \cite{MacFarlingMeure2006}. The standards set by the Russian government for microclimate in living apartments are more flexible \cite{RussianStandards}: for temperature, the range is from 18$^{\circ}$C to 26$^{\circ}$C, for humidity from 30\% to 65\%, and for ventilation there is no mention of a CO$_2$ concentration level, but rather the number of times air should be replaced in a room. Note that CO$_2$ concentration deserves particular attention: levels recorded in houses may reach values as high as 5000 ppm, which dramatically affects people's behavior as recently shown in dedicated studies \cite{Satish2012,Allen2016}; in fact, even at moderate levels of concentrations, say 2500 ppm, routinely reached in classes and conference rooms, intellectual activities like strategic thinking, initiative, information utilization, are negatively impacted.

Energy requirements of occupied buildings amount to 40\% of primary energy consumption, 70\% of electricity consumption, and 30\% of greenhouse gas emission \cite{Levine2007} with most of the energy consumption being due to heating, ventilation and air conditioning (HVAC) systems operation \cite{Nejat2015}. So, as traditional microclimate control solutions, like opening a window, are energy-intensive, a proper design and control of HVAC systems is crucial both from the energy saving and health viewpoints. Further, while the design of new buildings should account for their shape and the surface area of their envelope to minimize, so that energy efficiency is enhanced \cite{AlAnzi2009,Hwang2011}, a proper use of various tools used for commissioning in buildings \cite{Ginestet2013} and consideration of renewable energy options as solutions \cite{Rezaie2013} can provide a better control of energy consumption.

For the current large stock of existing buildings their shape is given and difficult to modify, so efficiency improvement can be reached only at moderate costs by the upgrading of the thermal insulation and the installation of recuperation systems for ventilation as well as the optimal control of microclimate. By doing so, the energy consumption can be minimized while maintaining an acceptable level of comfort \cite{Herrando2016,Zubiaga2016}. However, besides hardware (sensors, controllable actuators, information exchange between zones, computational facilities installed in every HVAC unit) challenges from the control viewpoint are many and include model accuracy, stochasticity in internal heat sources, and quality of forecast of external weather conditions.

In the present work, we are interested in indoor comfort through an accurate control of the smart systems setting the indoor microclimate with a focus on both high- and low-efficiency buildings. To that end, we use a model predictive control approach \cite{MorariWeForc12}. We aim to see how a sizable decrease of energy consumption may be efficiently achieved under various conditions: building characteristics, occupancy, and weather, while the desired level of comfort is maintained. More precisely, we consider a state-of-the-art 100 m$^2$ conference room located in a modern office building near Moscow (test case 1) and the typical urban Russian panel building series P44 (test case 2).

Most of Russian buildings are heated by district heating (DH) systems. If no access to DH exists, individual gas boilers are used. Some radiators are equipped with valves that can be manually tuned to control the heating level. Air conditioners are widely used in regions with warm summers and are controlled mainly by setting a desired temperature on on/off controllers. Natural ventilation dominates in dwellings which implies that windows must be opened even in winters despite its inefficiency and loss of comfort. Commercial buildings are equipped with air handling units (AHU) mostly based on constant air volume (CAV) technology resulting in uncontrollable ventilation rate while variable air volume (VAV) systems, which are more energy-efficient and provide a higher level of control of temperature and humidity, are not so much used because of their price.

Test cases 1 and 2, the detailed characteristics of which will be detailed in the main text, correspond to buildings submitted to the same weather conditions over the years, and harsh winters in particular; so their comparison provides quantitative information on the actual added value of the state-of-the-art technology and design, and also on the model predictive control approach we adopt. The article is organized as follows. In Section 2 we briefly review the main methods which can be applied to microclimate control, and discuss our choice for MPC in the context of the present work. In Section 3, we present our approach to the comfort and energy saving problem in buildings, based on the linear and model predictive control methods. In section 4, we implement numerically our approach to two illustrative test cases, and analyze and discuss the obtained results, considering also the possible presence of a supply ventilation system (SVS) in homes. The article ends with concluding remarks.

\section{\label{model}Overview of the main control methods}
Different control methods have been developed for HVAC systems, including rule-based, model predictive control \cite{Killian2016}, PI/PID and artificial neural networks-based approaches~  \cite{Afram2014,Wang2017,Hazyuk2014}. In Russia, on/off controllers are usually used in dwellings, while rule-based ones are used in commercial buildings.

\subsection{Rule-based control}
Rule-based control is widely used for temperature control on building scale and also taken as industry standard. Here all control inputs are taken from rules of the kind ``if \textit{condition} then \textit{action}'' \cite{report}. The main drawback of the method is that it needs tuning during operation with conditions changing to provide optimality. Unfortunately, this type of control may lead to temperature overshoots or synchronization effects \cite{GuptaCDC12} and hence may not provide optimal solutions from energy consumption viewpoint. Moreover, rule-based control strategies do not use predictions to perform better control actions.

\subsection{PI and PID controllers}
Various controllers for thermostats improve transient dynamics to reach the objectives set. Classical proportional-integral (PI), proportional-integrate-derivative (PID) controllers as well as fuzzy, adaptive, neural network  controllers \cite{Dounis2009} are capable to ensure that the desired temperature is reached and to exploit HVAC for providing demand response services \cite{HiskensDemandResponse16}. But the controllers performance is sensitive to the choice of the gains. Having tuned controller parameters for a particular objective like following a certain temperature, the designer looses the ability to reach other objectives such as minimization of an energy consumption, as well as to find a compromise among them. Besides, as the control goal is to maintain the prescribed air characteristics, comfort requirements dominate energy saving objectives. In other words PI and PID controllers cannot ensure optimal control or stability.

\subsection{Model predictive control}
Model predictive control \cite{MPCbook} provides a suitable framework for microclimate control as it ensures optimality using an appropriate strategy. Instead of operating on an infinite time horizon as in classical optimal control, MPC yields optimal results for finite prediction horizons. At each time-step, MPC solves an optimal control problem over a given prediction horizon and obtains the control parameters and states that satisfy both the dynamics and constraints. Finally, it synthesizes a control signal that minimizes objective functions (operation cost, energy consumption) and satisfies comfort constraints. Existing methods for predicting the energy consumption of households, commercial, industrial and municipal consumers, using mostly regression models, do not take into account the new technological capabilities of consumers and do not allow to predict a demand response in the event of a significant change in pricing policy. From a control perspective, MPC is capable to face all the requirements and possesses additional useful features such as: ability to use occupancy profile and incorporate weather forecast, moderating trade-off between preferences that may vary between thermal comfort and energy efficiency covering all intermediate solutions.

For MPC the formulation of an accurate microclimate dynamics model is a crucial problem \cite{Privara1stEx,HazyukPart1,HazyukPart2}. Linear models allow to use linear optimization solvers which are fast enough, but they provide suboptimal solutions due to lower accuracy. Bilinear models can also capture the airflow effect of ventilation: the heat flux is proportional to the mass flow rate (control variable) and the temperature difference (state variable) thus improving the model accuracy. In turn, sequential linear programming \cite{Storen95} solves bilinear optimization problems fast enough. The MPC approach has been implemented successfully for several problems pertaining to thermal comfort and microclimate control \cite{MorariCDC10,Sturzenegge2015,CastillaThermal14,Scherer2014}.

\subsection{Centralized and distributed control schemes}
MPC can also be used for multiple zones control as both centralized and decentralized control schemes exist \cite{Scherer2014}. The centralized ones are difficult to implement in practice due to the significant optimization variables space needed, high number of communications and sensitivity to local changes of HVAC. To avoid these difficulties decentralized versions are designed and implemented. For example, the system can be decomposed into several control systems. Local subsystems may operate autonomously (purely decentralized scheme) or exchange information between neighboring zones (distributed scheme) and send limited information to the higher-level system \cite{Afram2017,Zhang2017}.

\section{Formulation of the problem}
In the present work, we apply MPC to microclimate control in rooms equipped with DH radiators, air conditioners and an inflow ventilation. We simulate one generic day for three types of weather: cold, mild, and hot as defined further below. We thus set as an initial condition an ``effective temperature'', which amounts to neglecting the exact details of previous history that may have an impact if one wants to consider cases of sudden change of weather. In practice the effective temperature depends on the building usage/external conditions (absence days/ week ends / different weather etc.), thus leading to the simulation of different scenarios that may provide a set of initial conditions for a 1-day simulation and hence to a sensitivity analysis of the controller performance on the initial conditions, which is beyond the scope of the article. Note that the practical or experimental implementation of the controller does not allow to explicitly measure the effective temperature, but a measured room temperature gradient determined by thermal inertia, which can be evaluated during periods with the least possible amount of unpredicted factors, can instead be provided. This is very close to the approach we use, providing the model with an initial value of the effective temperature (21$^{\circ}$C in the present work.) The scheme of MPC and its testing using rolling horizon simulation is shown in Fig.~\ref{fig:Scheme} and explained as follows.

\begin{figure}
	\centering
	\includegraphics[width=120 mm]{scheme.eps}
	\caption{MPC and rolling horizon schemes.}
	\label{fig:Scheme}
\end{figure}

Our numerical simulations follow cycles, which first are based on the MPC block that consists of six logical parts necessary: the ``Forecast data'' part provides the outside temperature $T_{\rm out}$ and occupancy $N_{\rm oc}$ for the next 24 hours; the ``Initial conditions'' part provides the initial condition data to solve Eqs.~(\ref{eq:phys1}) and (\ref{eq:phys2}) below, for the microclimate dynamics: air temperature $T$, effective temperature of inertia mass $T^\star$, and CO$_2$ concentration taken to be equal to the environmental level in the beginning; note that when practically implementing MPC for HVAC control, the initial data correspond to the filtered temperature and CO$_2$ concentration values given by sensors installed in a zone; the ``Model of microclimate dynamics'' part provides the solutions ($T$, $T^\star$, CO$_2$) of Eqs.~(\ref{eq:phys1}) and (\ref{eq:phys2}), at the next time step based on forecast data, initial conditions, heating/cooling power $W_{\rm h/c}$, ventilation mass flow rate $Q_{\rm in}$; the ``Optimizer'' finds optimal values of $W_{\rm h/c}$ and $Q_{\rm in}$ accounting for both the ``goal function'' and ''constraints'' parts. The result of the MPC cycle is the ``Control vector'' containing the $W_{\rm h/c}$ and $Q_{\rm in}$ values at each control time step, taken as 1~hour in our cases. The control vector is then fed to the rolling horizon component of our simulation scheme, which undertakes a cycle external to the MPC block; when completed, we use the obtained microclimate data as updated initial conditions to run the next MPC cycle. The procedure is repeated until the simulated time reaches 24 hours.

\subsection{Model of a room microclimate}
The central part of the method is the microclimate physical model, which provides the time evolution of, e.g., the temperature and CO$_2$ concentration from the knowledge of the current state and action. In turn, this allows us to take into account the microclimate dynamics in optimal actions calculation which is the main advantage of MPC. From the principles of mass and energy conservation applied to a microclimate model \cite{Sturzenegge2015,Rincon2016}, we obtain the following set of differential equations:

\begin{eqnarray}
\nonumber
\label{eq:phys1}
mC_p \frac{{\rm d}T}{{\rm d}t} & = & U (T_{\rm out} - T) +U^{\star} (T^{\star} - T) +W_{\rm oc}N_{\rm oc}\\
&+&W_{\rm h/c} + C_p Q_{\rm in} (T_{\rm in} - T) + C_p m R_{\rm r} (T_{\rm out} - T)\\
m^{\star} C^{\star} \frac{{\rm d}T^{\star}}{{\rm d}t} & = & -U^{\star} (T^{\star} - T)
\label{eq:phys2}
\end{eqnarray}

\noindent where $t$ [h] is the time (which may be converted into seconds for some calculations); $W_{\rm h/c}(t)$ [W] is the time-dependent heating/cooling power; $Q_{\rm in}(t)$ [kg$\cdot$s$^{-1}$] is the time-dependent ventilation mass flow rate; $m$ [kg] is the mass of air in the room derived from the ideal gas equation of state: $m=PV/(RT)$, with $P=10^5$ Pa being the normal atmospheric pressure, $V$ the room volume, $R=287.03$ J$\cdot$kg$^{-1}\cdot$K$^{-1}$ is the value of the ratio of the ideal gas constant (8.314 J$\cdot$mol$^{-1}\cdot$K$^{-1}$) and the air molar mass (0.028966 kg$\cdot$mol$^{-1}$), and $T$ [$^{\circ}$C] the indoor air temperature (converted into kelvin for some calculations); $C_p=1$ kJ$\cdot$kg$^{-1}\cdot$K$^{-1}$ is the specific heat capacity of air at constant pressure; $U$ [W$\cdot$K$^{-1}$] is the linear heat transfer coefficient between the indoor and outside air at temperatures $T$ and $T_{\rm out}$ [$^{\circ}$C] respectively; $R_{\rm r}$ [h$^{-1}$] is the rate of air replaced by infiltrated air per one hour \cite{Solupe2014}; $m^{\star}$ [kg] is the ``inertia mass'', i.e. the accumulated mass of the walls, floor, ceiling and furniture of the room with $T^{\star}$ [$^{\circ}$C] being its effective temperature and $C^{\star}$ being its effective average heat capacity [J$\cdot$K$^{-1}$]; $U^{\star}$ [W$\cdot$K$^{-1}$] denotes the linear heat transfer coefficient between the inertia mass and the air in the room; $N_{\rm oc}$ is the number of persons occupying the room, each being a source of heat of average power $W_{\rm oc}$ [W]. The system of equations (\ref{eq:phys1}) and (\ref{eq:phys2}) is nonlinear because of the variation of the mass value $m$ over time and the presence of the term responsible for a heat exchange due to ventilation $C_p Q_{\rm in} (T_{\rm in} - T)$. In order to numerically integrate the equations, a first-order explicit method is used to discretize Eqs. (\ref{eq:phys1}) and (\ref{eq:phys2}):

\begin{eqnarray}
	\nonumber
	\label{eq:phys1disc}
	m_{i}C_p \frac{T_{i+1}-T_{i}}{\Delta t} & = & U (T_{{\rm out}, i} - T_{i}) +U^{\star} (T^{\star}_{i} - T_{i})+W_{\rm oc}N_{{\rm oc},i}\\
	&+&W_{\rm h/c, j} + C_p Q_{{\rm in},j} (T_{\rm in} - T) + C_p m R_r  (T_{{\rm out},i} - T_{i})\\
	m^{\star}_{i} C^{\star} \frac{T^{\star}_{i+1}-T^{\star}_i}{\Delta t} & = & -U^{\star} (T^{\star}_{i} - T_{i})
	\label{eq:phys2disc}
\end{eqnarray}

\noindent where ${i}$ denotes the current time step, ${i+1}$, the next time step, and ${j}$ the control step. The integration time step ${\bigtriangleup t}$ is chosen to be 1 min so that solution is not changed with its further decrease. The control time step is the interval where controlled parameters, i.e. $(W_{\rm h/c},Q_{\rm in})$ are fixed. For the test cases we present in the next section, the control time step is 1 hour, while the control horizon at which an objective function is minimized is varied: it is set to capture the microclimate dynamics sufficiently accurately while permitting the computation of the optimization problem solution in a reasonable time on a standard computer (less than one minute).

\subsubsection{Weather and occupancy forecasts}
One of the main advantages of MPC is its ability to take into account foreseeable exogenous factors for microclimate dynamics simulations. For the particular cases we address in the present work, these factors are the occupancy of rooms and the external weather. The room occupancy for the test cases is drawn from our knowledge of buildings usage (Fig.~\ref{fig:Noc}): office building occupancy statistics and private house usage based on general understanding of how apartments are used. The weather forecast can, for example, be downloaded from weather forecast websites. Examples of temperature profiles used are shown on Fig.~\ref{fig:Tout} and correspond to generic cold, mild, and hot days in Moscow. Our simulations are thus based on illustrative cases, for which the weather conditions are summarized as either ``typical'' hot, cold or mild days. To define these typical days, we used an on-line weather service and downloaded the weather data for the Moscow region for the last 5 years, with temperatures given every 3 hours for each day recorded; we then calculated averages of the hottest summer days (i.e. days with temperatures above the average over the whole summers), coldest winter days (i.e. days with temperatures below the average over the whole winters) and 100 mild days distributed over the months of May, June, August, and September months each year, during the last 5 years.

\begin{figure}[h!]
	\centering
	\includegraphics[width=70 mm]{Noc.eps}
	\caption{Occupancy variation forecast over 24 hours.}
	\label{fig:Noc}
\end{figure}

\begin{figure}[h!]
	\centering
	\includegraphics[width=70 mm]{Tout.eps}
	\caption{Outside temperature variations forecast over 24 hours corresponding to cold, mild, and hot days.}
	\label{fig:Tout}
\end{figure}

\subsection{Constraints}
Constraints impose the range of HVAC operational regimes and comfort. The lower limit of $W_{\rm h/c}$ represents the air conditioner maximum power (with a negative sign for an energy sink), and the upper limit, the heating maximum power. The ventilation upper limit corresponds to the air handling unit maximum performance. The lower limit depends on the room occupancy: for a fixed number of occupants $N_{\rm oc}$ one need to provide a minimum ventilation rate $Q_{\rm in}^{\rm min}$ in order not to exceed a certain comfort limit of CO$_2$ concentration $\nu_{{\rm CO}_2}^{({\rm max})}$. From the mass balance equation for the CO$_2$ fraction of air, we obtain:

\begin{equation}
Q_{\rm in}^{\rm min} = \frac{N_{\rm oc} \tilde{Q}_{{\rm CO}_2}}{\nu_{{\rm CO}_2}^{\star} - \nu_{{\rm CO}_2}^{({\rm max})}}
\label{eq:Qmin}
\end{equation}

\noindent where $\tilde{Q}_{{\rm CO}_2}$=0.000012 kg/s is the CO$_2$ mass exhausted by one person each second, $\nu_{{\rm CO}_2}^{\star}$=400 ppm is an average CO$_2$ concentration in the environment and $\nu_{{\rm CO}_2}^{({\rm max})}$ is taken to be 1000~ppm as a maximum comfort value.

Temperature limits are also important for the comfort: when there are no occupants inside, the lower and upper limits are 15$^{\circ}$C and 25$^{\circ}$C respectively. During daytime the limits are $T^{{\rm comf}}-1 <T<T^{{\rm comf}}+1$ (in $^{\circ}$C). The comfort temperature equals $T^{{\rm comf}}$=22$^{\circ}$C in our cases. Further, to measure a temperature comfort violation, the following penalty function over a 24-hour horizon is introduced in the present work: $T_{\rm penalty}=\sum_{1}^{24}(\delta T\delta t)$ [$^{\circ}$C$\cdot$h], where $\delta t$ is the time when the room temperature takes values outside the comfort interval, with corresponding value $\delta T$.

\subsection{Objective functions}
In the present work, the objective function $f_{\rm ec}$ represents the energy consumption for a room heating/cooling, ventilation air heating and propulsion:

\begin{equation}
f_{\rm ec} = \sum_{t=1}^{t_{\rm max}} \left[|W_{\rm h/c}(t)| + C_p Q_{\rm in}(t) |T_{\rm in} - T_{\rm out}(t)| + \alpha Q_{\rm in}^3(t)\right]
\end{equation}

\noindent where $W_{\rm h/c}(t)$ [W] is the heating/cooling power (controlled); $Q_{\rm in}(t)$ [kg$\cdot$s$^{-1}$] is the ventilation mass flow rate (controlled); $T_{\rm in}$ [$^{\circ}$C] is the inflow air temperature; $T_{\rm out}$ [$^{\circ}$C] is the outside air temperature; $\alpha = (2S_{\rm p}\rho)^{-2}$ [m$^2\cdot$kg$^2$] is a proportionality coefficient defined by the product of $S_{\rm p}$ [m$^2$], which is the cross section area of the air inflow device's pipe, and $\rho=1.2$ [kg$\cdot$m$^{-3}$], which is the air density; and $t_{\rm max}$ [h] is the control horizon. The function $f_{\rm ec}$ yields values given in [W$\cdot$h]. It is worth noticing that the function can easily be modified to correspond to a primary energy, total energy or price via multiplication of the function term by a specific constants or functions responsible for, e.g., pricing or efficiency.

\subsection{Optimizer}
For our purpose here, we use two optimizers, linear and nonlinear, to solve non-convex problems for which global optimatility is difficult if not impossible to prove.

\subsubsection{Nonlinear non-convex optimization}
The first controller, nonlinear MPC, is based on the nonlinear physical model given by Eqs.~(\ref{eq:phys1disc}) and (\ref{eq:phys2disc}), and requires a nonlinear non-convex optimization algorithm for an optimal control vector calculation. The main advantage of the method is its accuracy provided by the model. We used the optimization solver {\tt fmincon} for nonlinear constrained optimization with nonlinear constraints \cite{Waltz2006}; it is available as part of the Matlab package.

\subsubsection{Linear optimization}
Linear optimization is used to limit the computational burden, so we also developed a linear MPC version of our approach to check its relative accuracy and value as a tool for our work. This naturally entails the linearization of the physical model, Eqs.~(\ref{eq:phys1}) and (\ref{eq:phys2}); to this end, both the mass $m$ of air in the room and the effective temperature $T^{\star}$ are taken as constants at each control time step, assuming that it is sufficient to describe the slow air temperature dynamics, and for the ventilation control, we set $Q_{\rm in}(t)=Q_{\rm in}^{\rm min}(t)$. As a relative change of mass is rather small and the ventilation should work at the minimum possible power to decrease heat exchange with the environment we do not expect a significant decrease of the model accuracy due to the model linearization. An explicit first-order time-stepping is then used with an integration time step equal to the control time step, and we obtain a  linear equality constraints matrix that can be used for optimization computation. We used the {\tt CLP} optimization solver of the OPTI Toolbox package for Matlab. This solver is based on the primal simplex method and allows to solve linear optimization problems. \cite{Forrest2012}

\subsection{Rolling horizon}
We perform rolling horizon calculations to assess the efficiency of the MPC implemented according to the following sequence of steps:
\begin{enumerate}
\item Initial values for $T$ and $T^{\star}$ are chosen;
\item The MPC code is run to obtain control vectors at a set control horizon;
\item The first control values are used to simulate $T$ and $T^{\star}$ in 5 to 15 min;
\item The obtained $T$ and $T^{\star}$ are used as initial values for MPC, and the procedure restarts from step 1.
\end{enumerate}

\section{Test cases}
The MPC performance is tested on two cases with the predefined occupancy profiles shown on Fig.~\ref{fig:Noc}. We evaluate the efficiency of MPC by comparison with a standard on/off controller:
\begin{enumerate}
	\item State space for heating/cooling and ventilation is discretized so that HVAC devices can work at regimes from 0 (switched off) to 10 (maximum power);
	\item Setpoints for temperature correspond to comfort limits used in MPC;
	\item Setpoint for CO$_{2}$ concentration is 900 ppm with a deadband region of 100 ppm;
	\item When no people are inside in hot and normal days the heating/cooling equipment is switched off.
\end{enumerate}

For each test case we plot the time evolution of the temperature, heating/cooling, and ventilation utilization.

\begin{table}[h!]
	\centering
	\begin{tabular}{||l c c c||}
		\hline
		Parameter & Test case 1 & Test case 2 & Test case 2 + supply ventilation \\
		\hline\hline
		$U$ [W/K]          & 55  & 15 & 15  \\
		$U^*$ [W/K]        & 200 & 200& 200 \\
		$m^*C^*$ [MJ]    & 107 & 20 & 20  \\
		$V$ [m$^3$]     & 540 & 105& 105 \\
		$R_{\rm r}$ [h$^{-1}$]    & 0.1 & 0.2& 0.2 \\
		$T_{\rm t=0}$ [$^{\circ}$C]      & 21  & 21 & 21  \\
		$T^*_{\rm t=0}$ [$^{\circ}$C]    & 21  & 21 & 21  \\
		$W_{\rm h/c}^{\rm min}$ [kW] & $-$15 & $-$2 & $-$2  \\
		$W_{\rm h/c}^{\rm max}$ [kW] & 5   & 0.95 & 1.1 \\
		$W_{\rm oc}$ [kW] & 0.12   & 0.12 & 0.12 \\
		$Q_{\rm max}$ [kg$\cdot$s$^{-1}$]   & 0.55& -- & 0.05\\
		$T_{\rm in}$ [$^{\circ}$C]       & 21  & -- & 21  \\
		$S_{\rm p}$ [cm$^2$] & 500  & -- & 120  \\
		\hline
	\end{tabular}
	\caption{Test cases parameters.}
	\label{tab:Params}
\end{table}

\subsection{Test case 1: Skoltech campus room}
We consider a 100 m$^2$ room which is a standard lecturing room at the Skolkovo Institute of Science and Technology. The relevant physical parameters are derived using the room model assembled in TRNSYS \cite{TRNSYS} and are listed in Table \ref{tab:Params}. The building has a high thermal inertia. When the room occupancy is higher than 20-25 people during lectures, the air quality may deteriorate fairly quickly because of insufficient ventilation. In addition, during a large part of a typical daytime, when no student nor staff is inside, the ventilation system works on its nominal regime thus spending energy, which rather could be saved.

Rolling horizon simulations are performed for linear and nonlinear MPC. Here, the nonlinear physical model, Eqs. (\ref{eq:phys1}) and (\ref{eq:phys2}) is used to predict the evolution of the microclimate both for the linear (L) and nonlinear MPC. For the LMPC only heating is controlled while the ventilation mass flow ensures that the CO$_{2}$ concentration is less than 1000 ppm. This is confirmed by the nonlinear MPC simulations, where the optimal ventilation mass flow equals the minimum given by Eq. (\ref{eq:Qmin}).

\subsubsection{MPC vs. LMPC and on/off controller}
For a 24-hour time horizon, the optimization of the vector consisting of 24$\times$3 variables is performed. Here the variables are the temperature, heating/cooling power and ventilation flow for MPC, and the temperature, heating and cooling power only for LMPC to exclude the nonlinearities in the physical model, Eqs. (\ref{eq:phys1disc}) and (\ref{eq:phys2disc}).

\begin{table}[h!]
	\centering
	\begin{tabular}{||l | c c c | c c c||}
	  \hline
		&\multicolumn{3}{c}{Heating($+$)/Cooling ($-$) [kWh]} \vline & \multicolumn{3}{c}{Ventilation [kWh]} \vline \\
		\hline
		              Day type & MPC & LMPC  & on/off & MPC & LMPC  & on/off \\
	    \hline\hline
		Cold       & 36.8  & 34.6   & 62.0  & 61.7 & 61.7  & 70.4 \\
		Mild     & $-$2.8  & $-$3.9   & $-$6.1  & 2.0  & 2.0   & 2.4  \\
		Hot        & $-$11.4 & $-$13.9  & $-$16.1 & 18.7 & 18.7  & 21.7 \\
		\hline
	\end{tabular}
	\caption{Energy consumption for 24 hours of operation for the test case 1: MPC vs. LMPC vs. on/off control.}
	\label{tab:TC1_WQ}
\end{table}

\begin{table}[h!]
	\centering
	\begin{tabular}{||l | c c c | c c c||}
		\hline
		&\multicolumn{3}{c}{$T_{\rm penalty}$ [K$\cdot$h]} \vline  \\
		\hline
		Day type & MPC & LMPC  & on/off \\
		\hline\hline
		Cold       & 0.0  & 13.1   & 0.2  \\
		Mild     & 0.0  & 0.0    & 0.0  \\
		Hot        & 0.0  & 0.1    & 0.2  \\
		\hline
	\end{tabular}
	\caption{Temperature comfort violation for TC1.}
	\label{tab:TC1_Penalty}
\end{table}

On Fig. \ref{fig:Cold_MPCvsLMPC}, one can see from the temperature time evolution, that MPC allows a proper comfort level for harsh conditions while the LMPC underestimates the necessary heating level. The corresponding values of $T_{\rm penalty}$ are given on Table~\ref{tab:TC1_Penalty}. For both control methods the ventilation flow equals the lower limit. From the results displayed in Table~\ref{tab:TC1_WQ}, one can conclude that MPC is the most efficient in terms of energy spent for microclimate with the on/off controller being the worst among the tested approaches.

\begin{figure}
	\centering
	\includegraphics[width=122 mm]{TC1_LMPC_MPC_separated.eps}
	\caption{TC1. Comparison of MPC (solid line), LMPC (dots) and On/Off control (dashed line) for different weather conditions: cold (left column), mild (central column) and hot (right column).}
	\label{fig:Cold_MPCvsLMPC}
\end{figure}

\subsubsection{Forecast horizon influence}
To obtain the optimal time horizon for MPC, simulations of MPC with different horizons are performed. In practice the power of heating/cooling systems is limited and hence one cannot rapidly heat/cool the room to a desired level. Therefore heating/cooling equipment should be switched in advance. For example, the numerical results depicted on Fig. \ref{fig:Cold_2h_3h_4h_6h} are obtained for a cold weather with maximum heating power limited to 3.5 kW. Here, the control corresponding to the minimum of the objective function starts from horizon = 4 hours and no further change of control is observed. The corresponding objective functions are 184 kWh for horizon = 2 hours, 181 kWh for 3 hours and 180 kWh for larger horizon values.

\begin{figure}
	\centering
	\includegraphics[width=130 mm]{TC1_MPC_cold_horInfl.eps}
	\caption{MPC control with different prediction horizons under cold weather. Maximum heating power = 3.5 kW.}
	\label{fig:Cold_2h_3h_4h_6h}
\end{figure}

\subsubsection{Uncertainty influence}
In practice, as occupancy and weather forecasts are not perfectly accurate, errors in future states estimation are unavoidable. To account for this problem at every rolling horizon step, stochastic errors are added to initial values of occupancy, outside temperature, and room temperature. The disturbances are introduced as follows with means $\mu$ and standard deviation $\sigma$:

\noindent$T^{\rm (initial)}$: added normally distributed noise with $\mu=0$ and $\sigma=1$ K;\\
$N_{\rm oc}^{\rm (initial)}$: multiplied by uniformly distributed value from 0 to 2;\\
$T_{\rm out}^{\rm (initial)}$: added normally distributed noise with $\mu=0$ and $\sigma=1$ K.

\noindent Simulations are performed with MPC and LMPC for a normal day (see Fig. \ref{fig:Tout}). Different discretization time steps in rolling horizon are used: 1 hour, and 6 minutes. From the results displayed on Fig. \ref{fig:Norm_T_dist}, one can see that in general both MPC and LMPC provide rather good control in terms of comfort. But LMPC violates comfort boundaries more than MPC due to the loss accuracy of the physical model used. Corresponding temperature penalties values equal $T_{\rm penalty}^{\rm (MPC)} \approx 0.1$ and $T_{\rm penalty}^{\rm (LMPC)} \approx 0.8$.

\begin{figure}[h!]
	\includegraphics[width=130 mm]{TC1_LMPC_MPC_stoc.eps}
	\caption{Time evolution of temperature, heating/cooling power, and ventilation mass flow rate accounting for uncertainty, for the mild weather case. MPC (lines) and LMPC (dots).}
	\label{fig:Norm_T_dist}
\end{figure}

\begin{figure}
	\includegraphics[width=130 mm]{TC2_LMPC_MPC_separated_nobreezer.eps}
	\caption{TC2 without a supply ventilation system. Comparison of MPC (solid line), LMPC (dots) and On/Off control (dashed line) for different weather conditions: cold (left column), mild (central column) and hot (right column).}
	\label{fig:TC2nobr}
\end{figure}

\begin{figure}
	\includegraphics[width=130 mm]{TC2_LMPC_MPC_separated_breezer.eps}
	\caption{TC2 with a supply ventilation system. Comparison of MPC (solid line), LMPC (dots) and On/Off control (dashed line) for different weather conditions: cold (left column), mild (central column) and hot (right column).}
	\label{fig:TC2br}
\end{figure}

\subsection{Test case 2: Single-room apartments}
The second test case corresponds to a typical single-room apartment (Table \ref{tab:Params}). Buildings series P44 were the most popular panel house type build in 1980-1990, and up to date they are among the most widespread in some cities. One of the main drawbacks of these and most of other apartments is the absence of a proper ventilation system which together with low infiltration leads to inappropriate growth of carbon dioxide concentration when occupants are inside for a long period of time, e.g. at night (see Fig. \ref{fig:TC2nobr}). Formerly these apartments were equipped with rather low-quality windows not well fitted, thus leading to high air leakage; but in recent decades these outdated windows started to be replaced with modern leakproof plastic glass units that significantly decreased the overall infiltration rate of apartments. To allow fresh air to get into a room one can open a window. But in megacities like Moscow this also causes noise, excessive heat leakage, as well as pollutants like NO$_x$ and particulate matter penetration. This solution thus generates uncontrolled air flows in a flat, which may yield discomfort, nay health problems.

\begin{table}[h!]
	\centering
	\begin{tabular}{||l |c c c |c c c||}
	  \hline
		&\multicolumn{3}{l}{Heating(+)/Cooling (-), [kWh]} \vline & \multicolumn{3}{l}{Ventilation, [kWh]} \\
		\hline
	 	Configuration                & MPC   & LMPC  & on/off & MPC   & LMPC & on/off \\
		\hline\hline
		Cold day, with SVS       & 12.2  & 19.5   & 13.8  & 18.8   & 19.7  & 18.1  \\
		Cold day, no SVS         & 11.1  & 17.2   & 12.9  & --     & --    & --    \\
		Mild day, with SVS     & 0     & 0      & 0     & 0.6    & 0.6   & 0.6   \\
		Mild day, no SVS       & 0     & 0      & 0     & --     & --    & --    \\
		Hot day, with SVS        & $-$3.8  & $-$5.7   & $-$5.7  & $<$0.1 & $<$0.1& $<$0.1\\
		Hot day, no SVS          & $-$1.7  & $-$3.2   & $-$4.1  & --     & --    & --    \\
		\hline
	\end{tabular}
	\caption{Energy consumption for 24 hours of operation for the test case 2: MPC vs. on/off control.}
	\label{tab:TC2_WQ}
\end{table}

\begin{table}[h!]
	\centering
	\begin{tabular}{||l | c c c | c c c||}
		\hline
		&\multicolumn{3}{c}{$T_{\rm penalty}$ [K$\cdot$h]} \vline     \\
		\hline
		Day type                   & MPC  & LMPC   & on/off \\
		\hline\hline
		Cold day, with SVS     & 0.4  & 1.7    & 0.2    \\
		Cold day, no SVS       & 0.4  & 0.7    & 0.1    \\
		Mild day, with SVS   & 0.0  & 0.0    & 0.0    \\
		Mild day, no SVS     & 0.0  & 0.0    & 0.0    \\
	    Hot day, with SVS      & 0.0  & 0.7    & 0.0    \\
	    Hot day, no SVS        & 0.0  & 0.4    & 0.0    \\
		\hline
	\end{tabular}
	\caption{Temperature comfort violation for TC2.}
	\label{tab:TC2_Penalty}
\end{table}

Window opening is neither an energy efficient nor a comfort solution to deal with fuggy indoor environments. A centralized inflow ventilation system installation may be considered to the appropriate solution, but normally it is not for most of the popular series dwellings because of limited ceiling height. Another solution for house is the supply ventilation system, which is increasingly popular in Russia: a small box installed over an orifice on the wall that includes a compressor, filters and a heater. The maximum power of these devices is typically 1.5 kW, most of which being spent for the inflow air heating. SVS are also equipped with a filtering (NO$_x$, SO$_x$, etc.) and disinfecting system (viruses, bacteria). On Fig. \ref{fig:TC2br} one can see that the solution requires higher heating/cooling power available but this allows to limit carbon dioxide concentration at a desired level. Its advantages over windows opening are controlled fresh air mass flow rate that is needed for particular indoor conditions, air cleaning and outside noise reduction. As seen from table~\ref{tab:TC2_WQ} in the present test case, the MPC does not seem to be a necessary control solution as it neither allows to save energy nor is it able to improve the comfort level. The reason can be the quite limited thermal inertia of the room tested in TC2. From Table~\ref{tab:TC2_Penalty} one can conclude that all the control methods provide almost the same comfort level. However, if energy storage is going to be utilized or a significant change in prices for energy (both electric and thermal) are to be introduced MPC can become the solution able to significantly improve a microclimate efficiency.

\section{Concluding remarks}
The scope of our work is timely: as the majority of dwellings are highly dependent on fossil fuels for the provision of energy, either a thorough renewal of the housing stock or even their complete renovation up to nowadays best standards are prohibitive in terms of costs. Further, in a context where renewable energy sources cannot yet be seen as full substitutes for fossil fuels, even the strategies which promote low-power consumption and environment-friendly technologies (or ``best available technologies'' - BAT) have a major drawback known as the rebound effect \cite{FontVivanco2016}: as these BAT multiply to satisfy the ever growing public demand, the toll on standard energy sources is becoming unsustainable, especially when indoor comfort acquires a central role in people's daily life. Therefore on a short to mid-term time scale, only smart technologies can answer the challenges of quality indoor microclimate at a reasonable cost through home automation systems and control.

In this article, we studied how to control comfort and efficiency of energy utilization in buildings. The two test cases we presented serve different purposes, one is modern, one dates back to the early 1980s; their thermal and ventilation characteristics are quite different but both are subjected to the same high-amplitude yearly variations of the weather: twice a year the outside temperature undergoes a 70$^{\circ}$C change. This has a strong impact on the buildings, but also on the indoor microclimate needs, which require proper strategy definition for retrofitting where needed. Further, while the two actual test cases we treat are located in Moscow, our results and approach naturally extend to places, which have a similar climate. To contribute a solution, we developed a method based on model predictive control. MPC simulations for the modern building case study show the significant advantage that nonlinear MPC has over both linear MPC and standard on/off controller in providing comfort with lower energy consumption, coupled with the ability to operate the HVAC equipment in advance in order to prepare the desired microclimate at a given time; in other words MPC can utilize the capacity for shaving peaks in demand via pre-cooling or pre-heating the room at off-peak hours. In particular, for hot and cold seasons MPC allows to provide significantly higher levels of comfort than LMPC solutions. In addition, solutions which provide a good indoor environment also mitigate the detrimental effects of harsh weather conditions.

With the second test case corresponding to an old building, we showed that this type of apartments requires a ventilation system to be installed as, under standard conditions of use, the air quality is rather poor with, in particular, CO$_2$ concentrations much higher than what is advised by comfort norms. MPC for the HVAC control here, does not appear to provide acceptable solutions as we observe no significant reduction of energy consumption. This implies that direct application of one type of solutions, successful in some cases, is not a valuable strategy as the specific characteristics of buildings must be assessed and solutions adapated; this conclusion is in line with recent work putting forth the need for suitability assessment \cite{Geng2015}. Further, contextual factors influence the investment strategy for building or house management \cite{Nair2010}. Nevertheless, MPC can be a promising solution if a storage device is utilized as part of the whole system. The development of a multi-zone MPC controller with an adaptive data-driven approach to the microclimate dynamics model description and its practical implementation constitutes the next step of the present work.

\section*{Acknowledgments}
This work is supported by the Skoltech NGP Program (Skoltech-MIT joint project).

\section*{References}

\bibliographystyle{elsarticle-num}

config: arxiv