[Date Index]
[Thread Index]
[Author Index]
Re: Symbolic computation with vector fields and tensors
*To*: mathgroup at smc.vnet.net
*Subject*: [mg46809] Re: Symbolic computation with vector fields and tensors
*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
*Date*: Tue, 9 Mar 2004 04:30:52 -0500 (EST)
*Organization*: Universitaet Leipzig
*References*: <c2enl5$sr8$1@smc.vnet.net>
*Reply-to*: kuska at informatik.uni-leipzig.de
*Sender*: owner-wri-mathgroup at wolfram.com
Hi,
for your first problem try
Unprotect[Plus]
(lst_Plus)[args___] := #[args] & /@ lst
Protect[Plus]
And the linearity of Derivative[][] can be defined as
Unprotect[Derivative]
Derivative[pos__][args__Plus] := Derivative[pos][#] & /@ args
Derivative[pos__][a_*b__] := Derivative[pos][a]*b + a*Derivative[pos][b]
Protect[Derivative]
Regards
Jens
J Krugman wrote:
>
> 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[1]=
> f[x_] := x+1;
> g[x_] := 3x;
> h = f + g;
> h[x]
>
> Out[4]=
> (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[5]:=
> L[f_] := A[1] Derivative[1, 0][f] + A[2] Derivative[0, 1][f];
> M[f_] := B[1] Derivative[1, 0][f] + B[2] Derivative[0, 1][f];
> LD[L_, M_][f_] := Composition[L, M][f] - Composition[M, L][f];
> LD[L, M][f]//Expand//OutputForm
>
> In[5]:=
> L[f_] := A[1] Derivative[1, 0][f] + A[2] Derivative[0, 1][f];
> M[f_] := B[1] Derivative[1, 0][f] + B[2] Derivative[0, 1][f];
> LD[L_, M_][f_] := Composition[L, M][f] - Composition[M, L][f];
> LD[L, M][f]//Expand//OutputForm
>
> Out[8]//OutputForm=
> (0,1) (1,0) (0,1)
> -(B[2] (A[2] f + A[1] f ) ) +
>
> (0,1) (1,0) (0,1)
> A[2] (B[2] f + B[1] f ) -
>
> (0,1) (1,0) (1,0)
> B[1] (A[2] f + A[1] f ) +
>
> (0,1) (1,0) (1,0)
> A[1] (B[2] f + B[1] f )
>
> How can I get Mathematica to compute, for example, the first partial
> derivative of
>
> (0,1) (1,0)
> (A[2] f + A[1] 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[12]:=
> Expand[Derivative[1,0][a b + c d]]//OutputForm
>
> Out[12]//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.
Prev by Date:
**Re: Remote mathkernel through firewall behind NAT**
Next by Date:
**RE: Symbolic computation with vector fields and tensors**
Previous by thread:
**Symbolic computation with vector fields and tensors**
Next by thread:
**RE: Symbolic computation with vector fields and tensors**
| |