Thank you for your help on substitutiion procedures, i managed to
rearrange my expressions properly
A questions about factoring out expressions in arrays: my aim is to factor out
each element in dotdensity array, defined below.
Each element in array dotdensity contains elements from array c.
I should be able to factor out each element in dotdensity with respect to every
elemnt in c, exept for the null ones.
As an example take the element (1,1):
(C11) dotdensity[1,1];
(D11) %I c cc V - %I cc c V
1 2 1 2
That should be factored into: %I V ( c cc - cc c )
1 2 1 2
Since i do not which c parameters appear in dotdensity[i,j], i tried to factor out
k
with respect to every c , using the listarray function, but no luck.
k
Listarray(c) yields
(C7) listarray(c);
(D7) [0, 0]
What is wrong?
Is there another way to get the same results?
thank you
Paolo Pumilia
------ ecnc
/* test on factoring out expressions in arrays */
/* paolo pumilia 1 jul 2001 */
n : 3$
/* Arrays have dimension n+2, including the elements 0 and n+1, */
/* required for the boundary conditions to be taken into account. */
c[0] : 0;
c[n+1] : 0 ;
cc[0] : 0;
cc[n+1] : 0 ;
for i : 1 thru n step 1 do (
dotc[i] : -%i*( omega0[i]*c[i] + V*(c[i-1] + c[i+1]) ),
dotcc[i] : %i*( omega0[i]*cc[i] + V*(cc[i-1] + cc[i+1]) ) ,
'c[i],
'cc[i]
)$
for i : 1 thru n step 1 do (
for j : 1 thru n step 1 do (
dotdensity[i,j] : dotcc[i]*c[j] + cc[i]*dotc[j] ,
dotdensity[i,j] : factorout(
expand(
dotdensity[i,j]),listarray(c),listarray(cc))
)
);
-------- end enc