Modular property of indefinite degenerate theta series Is there anything known about the (mock)modular properties, if any, of the following theta series,
$\sum_{n\in {\mathbb Z}^r_+} e^{2\pi i \langle b, n\rangle} q^{\frac12 \langle n,n\rangle}$,
where $\langle x, y\rangle$ might be degenerate. For example,
$\sum_{\lambda,\mu,\nu=0}^\infty q^{\lambda+\mu+\nu+\lambda(\mu+\nu)}$,
is related to the quasimodular function $E_2(\tau)$. 
 A: For indefinite theta series of higher signature than (1,1) (which as Jeff mentions above are studied in Zwegers' thesis), in general there will be non-holomorphic completions which are modular. These will generically be  "higher depth" mock modular forms, which were considered by Zagier and Zwegers and by Raum, and are defined in Raum's paper here: http://arxiv.org/ftp/arxiv/papers/1207/1207.5603.pdf. Essentially, the mock modular forms of higher depth d are defined inductively be saying that a function transforming as a modular form has depth d if its image under the lowering operator (or equivalently the \xi operator) is a linear combination of products of modular forms and a mock modular form of depth d-1 (where one factor in each factor needs to have a complex conjugate). 
When the form is degenerate, this lowers the amount of "mockness". For example, in this paper of Bringmann, Zwegers, and I: http://arxiv.org/pdf/1506.07833v2.pdf, we write some examples of indefinite theta series of signature (1,2) in terms of products of modular and mock modular objects. In particular, take a look at (1.1) there. These formulas take some work to find explicitly, but the reason it works is the degeneracy of the indefinite theta function. Explicitly, (1.1) of our paper says that
$$
q^{-\frac18}\zeta_1^{-\frac12}\zeta_2^{\frac12 }\zeta_3^{\frac12}\left(\sum_{k>0,\ell,m\geq0}+\sum_{k\leq0,\ell,m<0}\right)(-1)^kq^{\frac{k(k+1)}2+k\ell+km+\ell m}\zeta_1^k\zeta_2^{\ell}\zeta_3^m=i\vartheta(z_1)\mu(z_1,z_2)\mu(z_1,z_3)-\frac{\eta^3\vartheta(z_2+z_3)}{\vartheta(z_2)\vartheta(z_3)}\mu(z_1,z_2+z_3)
,
$$
where I suppressed the dependence on $\tau$. Examples of some of these higher depth forms, which are analogous to the displayed equation above, are also discussed in Section 4 of Raum's paper cited above, where he explains how to restrict generalized objects transforming as Jacobi forms to torsion points in order to obtain many examples of higher depth forms satisfying the definition given above.
