substituting function in diff



David Webb wrote:

> The trouble is that I have to keep count.  With a term like:
>   z^2*(d/dz)wv(x,y,z,t), 
> I want to replace each z and wv by a separate fourier expansion with a 
> different set of indices.  Thus in the above equation, the z's need to be 
> transferred to functions ht(kx,ky,t) and the wv's to the corresponding 
> function with wavenumbers all with separate sets of indices.  Thus the above 
> becomes
>   
>   ht(kx1,ky1,t)*exp(i*(kx1*x+ky1*y))*
>   ht(kx2,ky2,t)*exp(i*(kx2*x+ky2*y))*
>   wv(kx3,ky3,t)*exp(i*(kx3*x+ky3*y))*(d/dz)cosh(k3*(z+H))/cosh(k3*H)
....
> There may be a more elegant method using buildq - I am not into macros but 
> I'll read further.

Is it possible that a pattern matching and substitution solution would 
help you here? I don't really understand what you're trying to do, but 
for example in some code that I have that automatically 
nondimensionalizes a PDE, I have a set of macros that look for various 
derivative terms containing various dimensional variables, and replace 
those dimensional variables with expressions involving my nondimensional 
variables. When these occur within a "diff" expression, i substitute the 
diff with a new function called "nondimensionaldiff" or something like 
that, which automatically does further expansion once the pattern 
matching is done.