[Date Index]
[Thread Index]
[Author Index]
Re: Functional differentiation on lattice
*To*: mathgroup at smc.vnet.net
*Subject*: [mg39806] Re: Functional differentiation on lattice
*From*: "Carl K. Woll" <carlw at u.washington.edu>
*Date*: Fri, 7 Mar 2003 03:42:15 -0500 (EST)
*Organization*: University of Washington
*References*: <b46uaf$92m$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
Hi Norbert,
Here is one possibility. The approach I am suggesting is restricted to sums
of a single index. It is not difficult to extend the approach to sums of
multiple indices, but it gets a little messier.
I will use the notation
d[t_,f_,x_]
to represent the functional derivative of t with respect to f[x]. Also, I
will use delta to represent the Kronecker delta, although in mathematica it
would look more natural to use the Greek letter delta. Then, the definition
of the functional derivative is
d[t_, f_, x_] :=
D[t, f[x], NonConstants -> {f}] /.
D[f[y_], f[x], NonConstants -> {f}] :> delta[x, y]
Of course, when applied to sums we don't want to use the above definition,
so we need to add another definition to handle this case:
d[sum[t_, x_], f_, y_] := sum[Expand[d[t, f, y]], x]
Here I expand the functional derivative of t to make sure the summand is a
sum of terms with the form of an expression times a delta function.
Finally, we want to add a few rules to sum so that the sum collapses when
Kronecker delta functions are present:
sum[t_Plus, x_] := sum[#, x] & /@ t
sum[t_. delta[y_, z_], x_] := t /. Solve[y == z, x][[1, 1]]
The first definition puts the summand into the form needed for the second
definition. The second definition collapses the sum. If the sum has multiple
indices this definition will need to be smarter in order to figure out which
index can be collapsed. Let's test this approach on your simple example:
In[56]:=
d[sum[(A[x + 1] - A[x])^2, x], A, y]
Out[56]=
-2 A[-1 + y] + 4 A[y] - 2 A[1 + y]
Well, that's the answer you wanted. Try it out, and feel free to email me if
you need help extending this approach.
Carl Woll
Physics Dept
U of Washington
"Norbert Nemec" <nobbi_at_theorie3.physik.uni-erlangen.de at NOSPAM.COM> wrote
in message news:b46uaf$92m$1 at smc.vnet.net...
> 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
>
Prev by Date:
**RE: Emergent Help: NSolve Problems!**
Next by Date:
**RE: RE: Re: Is Sort stable?**
Previous by thread:
**Re: Functional differentiation on lattice**
Next by thread:
**Mathlink problem with binary.tm in Linux**
| |