# Generalization of a rule to N arguments

I am trying to apply a series expansion on a function x[t1,t2,...tn], with an expansion parameter a. For n=2, the function is x[t1,t2], and this is my series expansion:

solRule2 = x -> (Sum[a^i Subscript[x, i][#1, #2], {i, 0, 2}] &);
x[t1, t2] /. solRule2


The result is given correctly as

Subscript[x, 0][t1, t2] + a Subscript[x, 1][t1, t2] + a^2 Subscript[x, 2][t1, t2]

This works also with derivatives, and this matters to me:

(x^(2,0))[t1,t2]/.solRule2


(Subscript[x, 0]^(2, 0))[t1, t2] + a (Subscript[x, 1]^(2,0))[t1, t2] + a^2 (Subscript[x, 2]^(2, 0))[t1, t2]

Now, I can manually extend the rule to n = 3,

solRule3 = x -> (Sum[a^i Subscript[x, i][#1, #2, #3], {i, 0, 3}] &);


but what I want to do is to extend it to the generic n. I tried this

solRuleN = x -> (Sum[a^i Subscript[x, i][##], {i, 0, Length[{##}]}] &);


This works well with the function x[t1,t2] and in general with x[t1,t2, ..., tn], but it fails with the derivatives:

(x^(1, 1))[Subscript[t, 1], Subscript[t, 2]]/.solRuleN


gives output 0. I don't understand why this happens.

-
Have a look at Sequence. –  b.gatessucks Jul 9 '13 at 12:19