kill(all)$

maxima: backsubst ( = list structure),version 1.0
peter.vlasschaert@gmail.com,06/12/2020

question : find a[10]=f(a[0])
=====================

→  trough backsubstitution

sx:reverse([a[8]=(5*a[6])/7,a[6]=(3*a[4])/5,a[4]=a[2]/3,a[2]=-a[0]]);

sx1:[a[2]=-a[0],a[4]=a[2]/3,a[6]=(3*a[4])/5,a[8]=(5*a[6])/7,a[10]=(7*a[8])/9];

i:1;

wk[i]:subst(sx[i],sx[i+1]);

wk[i+1]:subst([wk[i]],sx[i+2]);

→ solution problem

1e) first method
----------------------

k:5;

ws[1]:subst(sx1[1],sx1[2])$
for j:1 thru k-2 do
(
ws[j+1]:subst(ws[j],sx1[j+2])
)$

ws[k-1];

→ function( ":=",see below)

w1[zz,ks]:=(
wsa[1]:subst(zz[1],zz[2]),
for j:1 thru ks-2 do(
wsa[j+1]:subst(wsa[j],zz[j+2])
))$

rem :reverse list =sx1, 'see above '

optimized :code
============

grind(w1)$

w1[sx1,k];

wsa[k-1];

2e) second method
-------------------------

ratcoef(rhs(sx[1]),a[0]);

qq[l]:=ratcoef(rhs(sx[l]),a[2*(l-1)]);

qq[1];

qq[2];

coef :a[i],i=0,2,4,6 (k=5)

sw1:makelist(qq[z],z,1,k-1);

coef :a[i],i=8          (k=5)

sw2:ratcoef(rhs(sx1[k]),a[2*(k-1)]);

combine:two list,remove inside [],flatten

sw:flatten(cons(sw1,[sw2]));

product : sw list elements

swa:a[2*k]=product(sw[i],i,1,k)*a[0];