0

I am trying to compute derivative for something like back-propagation analytically, using Maxima. So I write:

declare(N,[scalar,integer]);
declare(i,[scalar,integer]);
declare(j,[scalar,integer]);
declare(m,[scalar,integer]);
declare(n,[scalar,integer]);
assume(N>10);
assume(i<=N,j<=N,m<=N,n<=N);
x1(i):=f(sum(w[i,j]*x0[j],j,1,N));

Now I am trying to evaluate:

diff(x1(i),w[i,m])

and it returns zero, while it is supposed to return

f(...) * x0[m]

Moreover, I've noticed that x1(j) returns

sum_j=1^N w[j,j] * x0[j]

while I would expect it to change the internal index from j to some other letter, say j1 and return

sum_j1=1^N w[j,j1] * x0[j1]

Is there any way to make maxima slightly "smarter" in this regards, i.e. to make it compute derivatives with respect to certain indeces and to automatically change the letter when there is a conflict with the input?

alex
  • 256
  • 1
  • 13

1 Answers1

1

About stuff like diff(x1(i),w[i,m]), unfortunately Maxima can't handle it. I have made some progress on differentiating with respect to indexed variables, but it only works for one index, not two, as you have here. If I have time I will work on extending it to two indices, but the short answer is, I'm afraid, it can't be done.

Robert Dodier
  • 16,905
  • 2
  • 31
  • 48