MathGroup Archive 2007

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

Search the Archive

Re: Fold and Cross

  • To: mathgroup at
  • Subject: [mg83885] Re: Fold and Cross
  • From: Szabolcs Horvát <szhorvat at>
  • Date: Mon, 3 Dec 2007 07:09:38 -0500 (EST)
  • References: <fj0moc$ifi$>

Peter Breitfeld wrote:
> to teach Cross how die differentiate I did:
> Unprotect[Cross];		
> (1) Cross/: D[Cross[u_,v_],x_]:=Cross[D[u,x],v]+Cross[u,D[v,x]];
> (2) Cross/: D[Cross[u_, v_], {x_, n_}] :=
>          Sum[Binomial[n, k] Cross[D[u, {x, k}], D[v, {x, n - k}]], {k, 0, n}];
> Protect[Cross];
> This works very well für things like D[(u x v), t] or D[(u x v), {t,3}].
> Now I tried to implement a tag for D[(u x v),x,y,...] and did the
> following:
> Unprotect[Cross];
> (3) Cross /: D[Cross[u_, v_], x_, y__] := Fold[D, Cross[u, v], Flatten[{x, y}]];
> Protect[Cross];
> But this doesn't do what I expected. It seems that tag (1) is not used,
> so there remain term with Derivative[n,m][Cross][...].
> What I am doing wrong?

Unfortunately I don't have a solution for you ... but the problem is 
that D[] does not work in a way that one would naively expect:  D[a[x] + 
b[x], x] does not seem to evaluate to D[a[x], x] + D[b[x], x].  So even 
with definition (1), D[Cross[a[x],b[x]] + Cross[c[x],d[x]], x] will not 
work (Derivative[m,n][Cross] will appear).  Another problem is that D[] 
assumes that all your functions and variables are scalars, e.g. 
D[f[g[x]], x] evaluates to f'[g[x]] g'[x].  So I don't believe that it 
is possible to get D[] to work *symbolically* with vectors/tensors.  You 
could write your vectors explicitly as {x,y,z}, and D[] will work 
perfectly with them, but this may not be what you want.  Another 
solution is to define your own set of operations for vectors and 
scalars, and your own derivation function.  I haven't used them, but I 
know that there are some tensor manipulation and quantum mechanics 
packages for Mathematica---they might (or might not) provide some 


  • Prev by Date: Re: how draw box with open front
  • Next by Date: Re: plotting vectors
  • Previous by thread: Fold and Cross
  • Next by thread: Re: Fold and Cross