We assume the mean of is zero, but replacing with to calculate the case for . foo11 is the same as poly(x)-a0, but with this substitution.
Obtain the canonical expression of the tensor usage, and redefine "rulepoly".
we can calculate as follows, and stored in foo14 up to terms.
Then, we take the expectation of foo14, calculating , and stored in foo15 below.
we take the log of foo15, and stored in foo18 up to terms below.
This is logeexppoly for b~=0.
ta0 + o*(sb[l1]*ta1[u1] + ta2[l1, u1] +
sb[l1]*sb[l2]*ta2[u1, u2] + 3*sb[l1]*ta3[l2, u1, u2] +
sb[l1]*sb[l2]*sb[l3]*ta3[u1, u2, u3]) +
o^2*((ta1[l1]*ta1[u1])/2 + 2*sb[l1]*ta1[l2]*ta2[u1, u2] +
ta2[l1, l2]*ta2[u1, u2] + 2*sb[l1]*sb[l2]*ta2[l3, u1]*
ta2[u2, u3] + 3*ta1[l1]*ta3[l2, u1, u2] +
6*sb[l1]*ta2[l2, u1]*ta3[l3, u2, u3] +
(9*ta3[l1, l2, u1]*ta3[l3, u2, u3])/2 +
3*sb[l1]*sb[l2]*ta1[l3]*ta3[u1, u2, u3] +
6*sb[l1]*ta2[l2, l3]*ta3[u1, u2, u3] +
3*ta3[l1, l2, l3]*ta3[u1, u2, u3] +
9*sb[l1]*sb[l2]*ta3[l3, l4, u3]*ta3[u1, u2, u4] +
6*sb[l1]*sb[l2]*sb[l3]*ta2[l4, u1]*ta3[u2, u3, u4] +
9*sb[l1]*sb[l2]*ta3[l3, l4, u1]*ta3[u2, u3, u4] +
(9*sb[l1]*sb[l2]*sb[l3]*sb[l4]*ta3[l5, u1, u3]*
ta3[u2, u4, u5])/2 + 3*ta4[l1, l2, u1, u2] +
6*sb[l1]*sb[l2]*ta4[l3, u1, u2, u3] +
sb[l1]*sb[l2]*sb[l3]*sb[l4]*ta4[u1, u2, u3, u4])
The following expression may be easier to read for us, but violating the summation convention rule of subscripts.