By default, Maxima doesn't recognize that such derivatives are nonzero
(as pointed out elsewhere in this thread). I have worked on some
simplification rules for this problem -- see this message & its attachments:
http://permalink.gmane.org/gmane.comp.mathematics.maxima.general/42356
Here's what I get after loading the scripts attached to that message.
(If it seems suboptimal, please bear in mind it's a work in progress.)
> #1
> a(x):=sum(w[i]*x[i],i,0,inf);
> diff(a(xx), xx[1]);
(%i4) a(x):=sum(w[i]*x[i],i,0,inf);
(%o4) a(x):=sum(w[i]*x[i],i,0,inf)
(%i5) diff(a(xx), xx[1]);
(%o5) 0
Oh -- the function diff got to the summation before the rule for 'diff
(obscure and convoluted business about nouns and verbs, evaluation and
simplification necessary here).
(%i6) 'diff(a(xx), xx[1]);
(%o6) 'diff('sum(w[i]*xx[i],i,0,inf),xx[1],1)
Hmm, it didn't simplify. Try resimplifying.
(%i7) ''%;
(%o7) 'diff('sum(w[i]*xx[i],i,0,inf),xx[1],1)
Nope. Oh, I see the upper limit is inf -- diff_sum works only for
finite summations (dunno if it really needs to be so conservative).
Let's pretend the upper limit is N instead of inf.
(%i8) subst (inf=N, %);
(%o8) if 1 <= N then w[1] else 0
Ta da!
> #2
> declare(layer_size, constant);
> a(x):=sum(w[i]*x[i],i,0,layer_size);
> diff(a(xx), xx[1]);
Same deal here -- needs 'diff instead of diff, and resimplification.
(%i9) declare(layer_size, constant);
(%o9) done
(%i10) a(x):=sum(w[i]*x[i],i,0,layer_size);
(%o10) a(x):=sum(w[i]*x[i],i,0,layer_size)
(%i11) diff(a(xx), xx[1]);
(%o11) 0
(%i12) 'diff(a(xx), xx[1]);
(%o12) 'diff('sum(w[i]*xx[i],i,0,layer_size),xx[1],1)
(%i13) ''%;
(%o13) if 1 <= layer_size then w[1] else 0
Ta da!
> #3
> a(x):=sum(w[i]*x[i],i,0,2);
> diff(a(xx), xx[1]);
(%i14) a(x):=sum(w[i]*x[i],i,0,2);
(%o14) a(x):=sum(w[i]*x[i],i,0,2)
(%i15) diff(a(xx), xx[1]);
(%o15) w[1]
OK, that's fine. Let's have some fun with simplification instead.
(%i16) 'sum(w[i]*x[i], i, 0, 2);
(%o16) 'sum(w[i]*x[i],i,0,2)
(%i17) 'diff (%, x[1]);
(%o17) 'diff('sum(w[i]*x[i],i,0,2),x[1],1)
(%i18) ''%;
(%o18) if true then w[1] else 0
(%i19) ''%;
(%o19) w[1]
Ta da!
HTH
Robert Dodier