Symbolic computation with vector fields and tensors
- To: mathgroup at smc.vnet.net
- Subject: [mg46767] Symbolic computation with vector fields and tensors
- From: J Krugman <jkrugman345 at yahbitoo.com>
- Date: Sun, 7 Mar 2004 01:33:45 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I'm trying to set up a symbolic computation involving covariant and contravariant vector fields, and second-order covariant tensors. Mathematica is probably the best tool for this, but I'm having a hard time getting past square one. My first problem is in getting Mathematica to recognize the standard algebra of functions, whereby "f + g" denotes the function whose value at x is f[x] + g[x], etc. For example: In= f[x_] := x+1; g[x_] := 3x; h = f + g; h[x] Out= (f+g)[x] I know that I can always define h "pointwise" with the statement h[x_]:=f[x]+g[x], instead of the "functional" approach I use above, but I want to avoid this if possible. I'm also aware of Through, but I want Mathematica to perform these conversions automatically (e.g. in respond to Expand) without prompting from me. A trickier problem is illustrated by the following. L and M are two differential operators, and the map LD returns the differential operator obtained from the commutator (in the sense of composition) of its two arguments: In:= L[f_] := A Derivative[1, 0][f] + A Derivative[0, 1][f]; M[f_] := B Derivative[1, 0][f] + B Derivative[0, 1][f]; LD[L_, M_][f_] := Composition[L, M][f] - Composition[M, L][f]; LD[L, M][f]//Expand//OutputForm In:= L[f_] := A Derivative[1, 0][f] + A Derivative[0, 1][f]; M[f_] := B Derivative[1, 0][f] + B Derivative[0, 1][f]; LD[L_, M_][f_] := Composition[L, M][f] - Composition[M, L][f]; LD[L, M][f]//Expand//OutputForm Out//OutputForm= (0,1) (1,0) (0,1) -(B (A f + A f ) ) + (0,1) (1,0) (0,1) A (B f + B f ) - (0,1) (1,0) (1,0) B (A f + A f ) + (0,1) (1,0) (1,0) A (B f + B f ) How can I get Mathematica to compute, for example, the first partial derivative of (0,1) (1,0) (A f + A f ) and do so automatically (e.g. in response to Expand). In fact, how can I get Mathematica to acknowledge the linearity of the derivative and Leibniz's rule? In:= Expand[Derivative[1,0][a b + c d]]//OutputForm Out//OutputForm= (1,0) (a b + c d) (Incidentally, I need Derivative, and not D, because I want to be able to specify partial derivatives in terms of sets of subscripts/superscripts.) I wish I had better technical documentation for Mathematica. The Mathematica Book is basically a large collection of examples, which, however clever or illuminating, is no substitute for formal APIs. The number of important details that the Mathematica Book, despite its heft, leaves unsaid is vast. As a result, I end up figuring out these details by sheer trial and error. (I know that Mr. Wolfram is very enthusiastic about "computer experimentation", but I trust that he is not trying to promote it by making the Mathematica's documentation cryptic.) In some cases, like those that lead to this post, my trial and error gets me nowhere. Is there anything better as far as technical reference material for Mathematica goes? Thanks! jill P.S. To send me mail, splice out the string bit from my address.