MathGroup Archive 2000

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

Search the Archive

Matrix Differentiation in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23114] Matrix Differentiation in Mathematica
  • From: "Johannes Ludsteck" <ludsteck at zew.de>
  • Date: Wed, 19 Apr 2000 02:30:46 -0400 (EDT)
  • Organization: Zentr. f. Europ. Wirtschaftsforsch
  • Sender: owner-wri-mathgroup at wolfram.com

Dear MathGroup members,
I am wondering whether there are some Limitations to matrix-
differentiation in Mathematica.
I would like to get the partial derivative of expressions like
f[c.x], where c is a vector of constants and x a vector of variables.
I know it would be possible to do this after specifying c and x
(for example x = {x1,x2,x3}; c = {c1,c2,c3}), but
in my application it is much more elegant and efficient to do this 
with c and x unspecified. 
For the first derivative of this expression with respect to x 
Mathematica returns the right result:
D[f[c.x],x] /. Dot[___,0,___]->0
Out[1] = c.1 f'[c.x]
However - to the best of my knowledge - it is impossible to ask 
Mathematica to compute the derivative of this expression (the first 
derivative) with respect to the transpose of x.
D[%,x] /. Dot[___,0,___]->0
gives
(c.1)^2 f''[c.x]
This cannot be the right solution since Mathematica has no 
information on the dimension of x.
The right solution would be 
Outer[Times,c,c] f''[c.x].
Of course, I could correct this by hand, substituting (c.1)^2 by
Outer[Times,c,c]. But since the expression I want to differentiate is 
very complicated, this would come to the same thing as doing the 
computations by pencil and paper.

Thanks for any suggestions,
	Johannes Ludsteck 



Johannes Ludsteck
Centre for European Economic Research (ZEW)
Department of Labour Economics,
Human Resources and Social Policy
Phone (+49)(0)621/1235-157
Fax (+49)(0)621/1235-225

P.O.Box 103443
D-68034 Mannheim
GERMANY

Email: ludsteck at zew.de


  • Prev by Date: Comparison of Mathematica on Various Computers
  • Next by Date: best fit 3D vector to points with a miss-distance specified
  • Previous by thread: Comparison of Mathematica on Various Computers
  • Next by thread: Re: Matrix Differentiation in Mathematica