Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

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[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: Bug report for MathixExp applied to a matrix of more-than-machine-precision numbers.
  • Next by Date: Re: Mathematica to Word
  • Previous by thread: Converting to Standard LaTeX
  • Next by thread: Re: Symbolic computation with vector fields and tensors