What is the dimension of the variety of chain complexes? Let $V_0, V_1, \dots, V_n$ denote a series of finite-dimensional vector spaces. We write $v_i : = \dim V_i$ for $i=0, 1, \dots, n$. I am thinking of these as real vector spaces, but I think the answer to my question ultimately doesn't depend on that.
Consider the affine space $A^N := \oplus_{i=0}^{n-1} \mbox{Hom}(V_{i+1},V_i)$. In $A^N$, consider the variety $W$ of $n$-tuples of linear maps $(\phi_1, \phi_2, \dots, \phi_n)$ such that $\phi_i \circ \phi_{i+1} =0$ for every $1 \le i \le n-1$. Here, every point in $W$ represents a chain complex on the given vector spaces.
What is $\dim W$, as a function of $v_0, v_1, \dots, v_n$?
Here is what I know so far. For every $n$-tuple of non-negative integers $(r_1, r_2, \dots, r_n)$, we can consider $W(r_1, r_2, \dots, r_n)$ defined to be the subvariety where $\mbox{rank} \, \phi_i = r_i$ for every $1 \le i \le n$. It is not hard to see that this subvariety is nonempty if and only if $r_i + r_{i+1} \le v_i$ for $i=0, 1, \dots$, so we will make this assumption going forward. (We make the convention that $r_0 =r_{n+1} = 0$.)
There are formulas for the dimensions of these subvarieties. In particular,
$$ \dim W(r_1, r_2, \dots, r_n) = \sum_{i=0}^n (v_i-r_{i+1})(r_i+r_{i+1}).$$
This can be found, for example, as Lemma 2.3 in the paper "On the Variety of Complexes", by De Concini and Strickland, which appeared in Advances in Mathematics in 1981. They say that this is a well-known result, and they are including a proof for the sake of completeness. (Comment: they actual consider the subvarieties where $\mbox{rank} \, \phi_i \le r_i$, but these have the same dimension, so the above formula still holds.)
So one way to answer my question is that
$$ \dim W = \max \{ \dim W(r_1, \dots, r_n)\},$$
as $(r_1, \dots, r_n)$ ranges over all possible values. However, this is a little bit unsatisfying. It reduces the question to a quadratic optimization problem, over integer points in the convex polytope cut out by the linear inequalities:

*

*$0 \le r_i$ for every $i$

*$r_i + r_{i+1} \le v_i$
We observe that $\dim W(r_1, r_2, \dots, r_n)$ is strictly increasing in each $r_i$. However, this observation does not solve the optimization problem by itself. In fact, there may be many subvarieties that have equal, maximum dimension.
For example, if $(v_0, v_1, \dots, v_6) = (10,10,10,10,10,10,10)$, then the ranks that maximize dimension are $(7,3,4,6,2,8)$, $(7,3,5,5,2,8)$, $(7,3,5,5,3,7)$, $(8,2,5,5,2,8)$, $(8,2,5,5,3,7)$, and $(8,2,6,4,3,7)$.
In special cases, I can solve this exactly. For example, it seems more tractable when the dimensions of the vector spaces are all equal $v_0 = v_1 = \dots = v_n$, although even then the cases of $n$ even and $n$ odd seem to work out quite differently.
I am curious if there are some things that make $\dim W$ more amenable to computation than this, in the general setting. Is there either something that greatly simplifies the quadratic optimization problem, or another way entirely to compute $\dim W$?
De Concini and Stickland mention at the beginning of their paper that the varieties $W$ and $W(r_1, \dots, r_n)$ are called Buchsbaum–Eisenbud varieties of complexes.
 A: There is a general special case where the problem has a nice answer. The situation is when the dimensions of the vector spaces are equal in pairs, or in other words $\dim V_{2i}=\dim V_{2i+1}$ for $0\le i\le \lfloor (n-1)/2 \rfloor$.
For convenience, we keep the auxiliary $r_{0}=r_{n+1}=0$, and in the case of even $n$, we also add $r_{n+2}=v_{n}$ and $v_{n+1}=v_n$. One can regroup the terms in the formula for $\dim W(r_1, r_2, \dots, r_n)$ as follows:
$$\dim W(r_1, r_2, \dots, r_n) = \sum_{i=0}^n (v_i-r_{i+1})(r_i+r_{i+1})$$
$$=\sum_{i=0}^{\lfloor n/2\rfloor} v_{2i} v_{2i+1}-
\frac12\sum_{i=0}^{\lfloor n/2\rfloor}(r_{2i}-r_{2i+2})^2-\sum_{i=0}^{\lfloor n/2 \rfloor}(v_{2i+1}-r_{2i}-r_{2i+1})(v_{2i}-r_{2i+1}-r_{2i+2})
+\frac{1}{2}r_{2\lfloor\frac{n}{2}\rfloor+2}^2.$$
However, in our special case, the third summation is equal to $$\sum_{i=0}^{\lfloor n/2 \rfloor}(v_{2i+1}-r_{2i}-r_{2i+1})(v_{2i}-r_{2i+1}-r_{2i+2})=\sum_{i=0}^{\lfloor n/2 \rfloor}(v_{2i}-r_{2i}-r_{2i+1})(v_{2i+1}-r_{2i+1}-r_{2i+2}),$$
and we know that this must vanish at a maximum of $\dim W(r_1, r_2, \dots, r_n)$, by the observation that our dimension is monotonic in each $r$, and thus, for each $i$, either $r_{2i}+r_{2i+1}\le v_{2i}$ or $r_{2i+1}+r_{2i+2}\le v_{2i+1}$ turns into an equality (otherwise you could increase $r_{2i+1}$ by a small amount).
Hence, our problem reduces to minimizing the expression
$$\sum_{i=0}^{\lfloor n/2\rfloor}(r_{2i}-r_{2i+2})^2 \tag{*}$$
subject to our restrictions. This can be done by applying Cauchy-Schwarz, which tells us that the differences $r_{2i}-r_{2i+2}$ would have to be as close as possible to each other.
When $n$ is odd, the maximum can be achieved by taking $r_0=r_2=\cdots=r_{n+1}=0$, and the remaining values will be $r_{2i+1}=v_{2i}=v_{2i+1}$ for $0\le i\le \frac{n-1}{2}$.
When $n$ is even we have $r_0=0$ and $r_{n+2}=v_n$. We can visualize our restriction as saying that the data points $(i, r_{2i})$ must lie below the points $(i,\min(v_{2i}, v_{2i-1}))$ for $1\le i\le \frac{n}{2}$ together with endpoints $(0,0)$ and $(\frac{n}{2}+1,v_n)$. Applying Cauchy-Schwarz in intervals shows that the (real) maximum is achieved when the points $(i,r_{2i})$ are on the Newton polygon (convex hull) of the points $(i,\min(v_{2i}, v_{2i-1}))$, and the integral maximum is obtained by taking $r_{2i+2}-r_{2i}$ to be as close as possible to the slope of the corresponding edge of the Newton polygon.
There will be choices of taking either the ceiling or the floor of the slope, but we must make sure the final sum of all assigned values to the $r_{2i+2}-r_{2i}$'s comes out to $v_n$. In the example of $(v_1,v_2,\dots,v_6)=(10,10,\dots,10)$, we want $r_{2i+2}-r_{2i}$ to be as close as possible to the slope $10/4=2.5$ so we can choose either $2$ or $3$, since the final sum is $10$ the choices have to be some ordering of $2,2,3,3$, and each of the $6$ orderings corresponds to one of the maxima you listed.
