# need help inverting DerivVar array (Numpy/Scientific Python Q uestion)

Robin Becker robin at jessikat.fsnet.co.uk
Wed Jun 6 11:12:18 EDT 2001

```In message <C060A62E5A86D211A83B00A0C969649203B967C0 at dc_exchange2.howrey
.com>, PoulsenL at capecon.com writes
>Scientific provides a derivable object which can be operated upon.  The
>problem is that it does not implement an invert method and I was wondering
>if there was a workaround.
>
... well to avoid the inversion of formulaic matrices you could use the
direct approach for the differential of the inverse of a matrix

ie

d inv(A(x))/dx = - inv(A(x)) d A(x)/dx inv(A(x))

which derives from A(x)inv(A(x)) = I

that way you can find the pure numerical inverse and then just multiply
out with the derivative of the individual differentials you need. It's
unlikely that the inverse operation. A very long time ago I did in fact
do symbolic differentials of matrices (up to order 20 or 30), but it was
quite expensive in those days.

In the above if x is in fact the elements of A then the inner term
becomes trivial to compute and then you get a single non-zero element in
it. Then the differential wrt aij is the rank 1 matrix column i(invA)  *
row j(invA); for an order 30 matrix it takes around 7Mb to store the
numbers.
--
Robin Becker

```