Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If I am right, these are the recurrence relations you want to deal with: $$ \begin{aligned} a_n(x) &= a_{n-1}(x+1) - a_{n-1}(x) + a_0(x+1)a_{n-1}(x) + b_{n-1}(x) \\ b_n(x) &= b_{n-1}(x+1) - b_{n-1}(x) + a_{n-1}(x)b_0(x+1) \end{aligned} $$ I have run the code below in a Jupyter notebook, assuming that $a_0(x)=Ax$ and $b_0(x)=B$:

var("A,B,x")
def a(n,x):
    if n==0:
        return A*x
    else:
        return a(n-1,x+1) - a(n-1,x) + a(0,x+1)*a(n-1,x) + b(n-1,x)
def b(n,x):
    if n==0:
        return B
    else:
        return b(n-1,x+1) - b(n-1,x) + a(n-1,x)*b(0,x+1)

for n in range(5):
    show(html(fr"$a_{{{n}}}(x)={latex(a(n,x).full_simplify())}$"))
    show(html(fr"$b_{{{n}}}(x)={latex(b(n,x).full_simplify())}$"))
    show(html("<hr>"))

This is the output:

$a_{0}(x)=A x$
$b_{0}(x)=B$


$a_{1}(x)=A^{2} x^{2} + A^{2} x + A + B$
$b_{1}(x)=A B x$
$a_{2}(x)=A^{3} x^{3} + 2 \, A^{3} x^{2} + 3 \, A^{2} + A B + {\left(A^{3} + 3 \, A^{2} + 2 \, A B\right)} x$
$b_{2}(x)=A^{2} B x^{2} + A^{2} B x + 2 \, A B + B^{2}$
$a_{3}(x)=A^{4} x^{4} + 3 \, A^{4} x^{3} + 7 \, A^{3} + 3 \, {\left(A^{4} + 2 \, A^{3} + A^{2} B\right)} x^{2} + 3 \, A^{2} + {\left(A^{2} + 4 \, A\right)} B + B^{2} + {\left(A^{4} + 13 \, A^{3} + 4 \, A^{2} B\right)} x$
$b_{3}(x)=A^{3} B x^{3} + 2 \, A^{3} B x^{2} + 5 \, A^{2} B + A B^{2} + {\left(2 \, A B^{2} + {\left(A^{3} + 5 \, A^{2}\right)} B\right)} x$
$a_{4}(x)=A^{5} x^{5} + 4 \, A^{5} x^{4} + 15 \, A^{4} + 2 \, {\left(3 \, A^{5} + 5 \, A^{4} + 2 \, A^{3} B\right)} x^{3} + 22 \, A^{3} + 2 \, A B^{2} + {\left(4 \, A^{5} + 34 \, A^{4} + 9 \, A^{3} B\right)} x^{2} + {\left(A^{3} + 16 \, A^{2}\right)} B + {\left(A^{5} + 39 \, A^{4} + 15 \, A^{3} + 3 \, A B^{2} + 3 \, {\left(2 \, A^{3} + 5 \, A^{2}\right)} B\right)} x$
$b_{4}(x)=A^{4} B x^{4} + 3 \, A^{4} B x^{3} + {\left(A^{2} + 6 \, A\right)} B^{2} + B^{3} + 3 \, {\left(A^{2} B^{2} + {\left(A^{4} + 3 \, A^{3}\right)} B\right)} x^{2} + {\left(11 \, A^{3} + 8 \, A^{2}\right)} B + {\left(4 \, A^{2} B^{2} + {\left(A^{4} + 20 \, A^{3}\right)} B\right)} x$

Of course, you can increase the final value of $n$ in the loop.