E(l, Vv, Uv) := block ( [],
if (l=0) then 
    1
    else ( 
        -(1/l)*sum(E(l-k,Vv, Uv)*sum(binomial(k,lambd)*Vv(k-lambd)*Uv(lambd), lambd, 0, k), k, 1, l)
    )
);

U(l):=u[l];V(l):=v[l];

E(0,V,U);E(1,V,U);

E(2,V,U);

expand(E(2,V,U));

expand(E(3,V,U));

Estar(l, Vv, Uv) := sum(E(k, Vv, Uv)*w[l-k], k, 0, l);

;

Estar(0, V, U);

expand(Estar(1, V, U));

expand(Estar(2, V, U));

expand(Estar(3, V,U));

Astar(Vv, iv,l, Uv):=  block ( [],
    if (l=0) then 
    w[0]
    else 
    (
        retVal: expand(Estar(l, Vv, Uv)),
        for j: 1 while j <= l do
        (
            retVal: ratcoef(retVal, Uv(j), iv(j))
        ),
        retVal
    )
);

ol(j):=0;

Bstar(l, m, Vv, Uv) := ratcoeff(expand(Astar(Vv, ol, l, Uv)), Uv(0), m);

Bstar(0,0, V, U);

Astar(V, ol, 1, U);

Bstar(1,0, V, U);

Bstar(1,1, V, U);

Bstar(2,0, V, U);Bstar(2,1, V, U);Bstar(2,2, V, U);

%/* Computing linear combinations of Bstar(l,m) presenting Astar_{i} */;

 /* l=1 */;

expand(Estar(1, V, U));

i1_1(j):= block([], 1);

Astar_1:Astar(V, i1_1, 1, U);

divide(Astar_1, Bstar(0,0, V, U),V(1));

/* l=2 */;

i01_2(j) := block ([], if (j=1) then 0 else (if (j=2) then 1 else -1));

Astar_01:Astar(V, i01_2, 2, U);

divide(Astar_01, Bstar(0,0, V, U),V(1));

i10_2(j) := block ([], if (j=1) then 1 else (if (j=2) then 0 else -1));

Astar_10:expand(Astar(V, i10_2, 2, U));

Bstar(1,1, V, U); Bstar(1,0, V, U);

H_10_1:divide(Astar_10, Bstar(1,1, V, U),w[1],w[0],V(1));

H_10_2:divide(H_10_1[2], Bstar(1,0, V, U),w[1]);

i20_2(j) := block ([], if (j=1) then 2 else (if (j=2) then 0 else -1));

Astar_20:Astar(V, i20_2, 2, U);

divide(Astar_20, Bstar(0,0, V, U),w[0]);

;

/* l=3 */
/* sum = 1*/;

%/* No Q[u_0,v_0]-linear combination Astar_100 = x[1]*Bstar(2,0)+x[2]*Bstar(2,1)+x[3]*Bstar(2,2)+ x[4]*Bstar(1,1)+x[5]*Bstar(1,0)+x[6]*Bstar(0,0);

 /* proof via polynomial division */;

i100_3(j) := block ([], if (j=1) then 1 else (if (j=2 or j=3) then 0 else -1));
Astar_100:expand(Astar(V, i100_3, 3, U));

Bstar(2,2, V, U);Bstar(2,1, V, U);Bstar(2,0, V, U);

H_100_1:expand(divide(Astar_100, Bstar(2,0, V, U), w[0],V(1),w[1],w[2]));

H_100_2:expand(divide(H_100_1[2], Bstar(2,2, V, U),w[0],w[1], V(1))) ;

H_100_3:expand(divide(H_100_2[2], Bstar(2,1, V, U),w[0],w[1], V(1))) ;

 /* proof via linear system solving */;

b[1] : ratcoeff(Astar_100, w[0]*v[2]);b[2] : ratcoeff(Astar_100, v[1]*w[1]);

e1:b[1]-x[2]*ratcoeff(Bstar(2,1, V, U), w[0]*v[2]);e2:b[2]-x[2]*ratcoeff(Bstar(2,1, V, U), w[1]*v[1]);

solve(e1, x[2]); solve(e2, x[2]); solve([e1, e2], x[2]);

%/* sum = 2 */;

i200_3(j) := block ([], if (j=1) then 2 else (if (j=2 or j=3) then 0 else -1));

Astar_200:expand(Astar(V, i200_3, 3, U));

H_200_1:divide(Astar_200, Bstar(1,0, V, U),V(1), w[0], w[1]);

H_200_2:divide(H_200_1[2], Bstar(1,1, V, U),V(1), w[0]);

i010_3(j) := block ([], if (j=2) then 1 else (if (j=1 or j=3) then 0 else -1));

Astar_010:Astar(V, i010_3, 3, U);

H_010_1:divide(Astar_010, Bstar(1,1, V, U),V(1), w[1],w[0]);

H_010_2:divide(H_010_1[2], Bstar(1,0, V, U),w[1]);

;

/* sum = 3 */;

i001_3(j) := block ([], if (j=3) then 1 else (if (j=1 or j=2) then 0 else -1));

Astar_001:Astar(V, i001_3, 3, U);

divide(Astar_001, Bstar(0,0, V, U),w[0]);

i300_3(j) := block ([], if (j=1) then 3 else (if (j=2 or j=3) then 0 else -1));

Astar_300:Astar(V, i300_3, 3, U);

divide(Astar_300, Bstar(0,0, V, U),w[0]);

i110_3(j) := block ([], if (j=1 or j=2) then 1 else (if (j=3) then 0 else -1));

Astar_110:Astar(V, i110_3, 3, U);

divide(Astar_110, Bstar(0,0, V, U),w[0]);