Assembing a Rational Number from Constituent Digit Vectors Relative to a Given Base

The Set-up

The given vectors are u,v,w, and the given base is b. In each case the subscripts on the coordinates of the digit vectors increase from left to right. For example, in base 10 if u=3,6,v=5,4,andw=1,2, then the indicated decimal expansion is 36.5412121212, and its representation as a quotient of coprime integers is 602931650.

Formulas:
result=r+s+twhere  r=j=1kujbkj s=j=1lvjbk t1=j=1mwjbmj t2=blbm1 t=t1t2 with k=lengthul=lengthvm=lengthw.

Exercise

Raise issues you find with the following code proposed for the task:

ratFromVecs := proc (u, v, w) local b, r, s, t, j, k, l, m, c1, c2, n;
u := [u[1],...,u[k]];
v := [v[1],...,v[l]];
w := [w[1],...,w[m]];
k := nops(u);
l := nops(v);
m := nops(w);
r := sum('u[j]*b^(k-j)', 'j' = (1 .. k));
s := Sum('v[j]*b^(-j)', 'j' = (1 .. l));
t1 := sum('w[j]*b^(m-j)', 'j' = (1 .. m));
t2 := b^l*(b^m-1);
t := t1/t2;
for j to k do n := r+s+t; end do;
n;
end;