Question: Seq behaves funny within a program

I am trying to do some algebra with the derivatives of some variables within a program. As a result i need to relable them before i feed them into solve.

To relable them i create vectors and use subs. one of these vectors behaves differently within a proc to how it behaves outside it. This is weird.

TimefullBehavesFunny := proc (nPars, nVars)
local nDiffs, timefull, timeless;
nDiffs := nPars;
timefull := [seq(dx[j, i] = diff(x[i](t), `$`(t, j)), i = 1 .. nVars)];
timefull := [seq(op(timefull), j = 0 .. nDiffs), seq(x[i] = x[i](t), i = 1 .. nVars)];
timeless := `~`[`=`](`~`[rhs](timefull), `~`[lhs](timefull));
timefull, timeless, nDiffs;
end proc

When i run the above for (3,3) i get a differet result to when i run the following
nVars:=3;
nDiffs := 3;
timefull := [seq(dx[j, i] = diff(x[i](t), `$`(t, j)), i = 1 .. nVars)];
timefull := [seq(op(timefull), j = 0 .. nDiffs), seq(x[i] = x[i](t), i = 1 .. nVars)];
timeless := `~`[`=`](`~`[rhs](timefull), `~`[lhs](timefull));

and similarly for other numbers.

any ideasas to why?

Please Wait...