Functional differentiation on lattice

*To*: mathgroup at smc.vnet.net*Subject*: [mg39759] Functional differentiation on lattice*From*: Norbert Nemec <nobbi_at_theorie3.physik.uni-erlangen.de at NOSPAM.COM>*Date*: Thu, 6 Mar 2003 02:35:38 -0500 (EST)*Organization*: University of Erlangen, Germany*Sender*: owner-wri-mathgroup at wolfram.com

Hi there, I've just recently decided that the maths I have to do at the moment really demand the use of a CAS. I'm absolutely new to Mathematica, but the problem I have is probably a bit hard to get moving on. Perhaps someone can give me a simple solution to start out on? What I need to do could probably be called a "Functional differentiation on a lattice". To give one very simply example: I have the functional S[A] := sum_x (A(x+1)-A(x))^2 (where x is integer - in my case there are periodic boundaries, but that does not matter at that point) now I want to calculate dS/dA(y) which should result in - 2(A(y+1)-A(y)) + 2(A(y)-A(y-1)) or simplified -2A(y+1) + 4A(y) - 2A(y-1) Lateron, the whole thing will get 4-dimensional and A will get indices that will be summed over as well. Is there a simple way to do that in Mathematica? I would really appreciate a piece of code to get me started on. Thanks, Nobbi