VarD with dependent field

242 views
Skip to first unread message

Sjoerd

unread,
Mar 20, 2013, 5:04:14 AM3/20/13
to xa...@googlegroups.com
Dear all,

Suppose you have two scalar fields s1[] and s2[], with s2[] depending on s1[]. Because of this dependence, the variation of s2[] with respect to s1[] does not vanish. Let us denote that varition by vars2[].

I would like to calculate the variation of s1[]s2[] with respect to s1[].
The answer is s2[] + s1[]vars2[]

In Mathematica this can be enfourced by writing
VarD[s1[], PD][a___*s2[]*b___] := a vars2[] b + VarD[s1[], PD][a b]

After that the variation gives the right answer.
VarD[s1[], PD][s1[] s2[]]


Tensor fields can have the same kind of dependences. I would like to do something similar for a tensor with three indices.
As a warmup exercise, I tried make a similar variaton work for a vector. Allready there I am stuck.

Now we have two vector fields, v1[a] and v2[a]. The variation of v1[a]v2[-a] with respect to v1[a] must yield v2[-a] + v1[b] varv2[a, -b]
How can I write a rule for that?

Best,
Sjoerd

Sjoerd

unread,
Mar 20, 2013, 5:26:58 AM3/20/13
to xa...@googlegroups.com
P.S. Here it goes wrong:  In the vector case I try to use IndexRule, but a contruction like this does not work.

IndexRule[f[v1[a] v2[-a]], 1]

Leo Stein

unread,
Mar 20, 2013, 8:16:38 AM3/20/13
to Sjoerd, xa...@googlegroups.com
Hi Sjoerd,

To say that the variation of one tensor implicitly depends on another is handled by the function ImplicitTensorDepQ. You have to do some of this by hand. This could perhaps be automated with a function which would check index structure, etc., but at the moment here's how to do it.

Let's say I have v[a], w[a], and T[a,b], and I want to set δw[b]/δv[a] = T[-a, b]. Then I would write
  w /: ImplicitTensorDepQ[w, v] = True
to say that w depends implicitly on v (and associate this assignment with the symbol w). This much means that VarD will leave unevaluated expressions like
  VarD[v[a], covd ][ w[b], rest]
It might be useful to look at the code for VarD to see why there is a "rest" argument in VarD—that's how it implements the Leibniz rule. To give a value to this variation, you would write
  VarD[v[a_], cd_][w[b_], rest_] := T[-a, b] rest
VarD will take care of being linear over sums and scalars, integrating by parts, and changing derivatives. You only need the two assignments above.

Best
Leo



--
You received this message because you are subscribed to the Google Groups "xAct Tensor Computer Algebra" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xact+uns...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Sjoerd

unread,
Mar 20, 2013, 12:19:36 PM3/20/13
to xa...@googlegroups.com, Sjoerd
Hi Leo,

This is working great. Thank you.

Best,
Sjoerd
Reply all
Reply to author
Forward
0 new messages