Re: matrix log and exp [message #30276 is a reply to message #30274] |
Thu, 18 April 2002 05:43   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
James Kuyper wrote:
>
> Paul Van Delst wrote:
>
>> G Karas wrote:
>>
>>> Hi group,
>>> one quickie and possibly difficult:
>>>
>>> IDL does not have a matrix logarithm logm and matrix
>>> exponent expm function. I was thinking of calling lapack
>>> routines which do it, but have no experience with lapack
>>> or FORTRAN. Anyone with any tips on this one?
>>
>>
>> Yes. Use ALOG() and EXP().
>>
>> paulv
>
> He's talking about matrix logarithm and exponent, not the
> element-by-element logarithm and exponent. When you calculate
> exp(matrix), it produces a new matrix, each of whos elements is exp() of
> the corresponding element of the input matrix.
>
> That's very different from the matrix exponential function of x, which
> is defined only for square matrices. It uses the same Taylor series
> expansion:
>
> 1 + x + x^2/2! + x^3/3! + x^4/4! ...
>
> but interprets '1' as the identity matrix of the appropriate size, and
> x^n as the matrix multiplication of x by itself n times.
>
> For instance:
>
> IDL> A = [[0,1],[1,0]]
> IDL> print, exp(A)
> 1.00000 2.71828
> 2.71828 1.00000
>
> Since, for matrix multiplication, A^n = A if n is odd, and
> A^n=[[1,0],[0,1]] if n is even, the diagonal elements pick up the even
> terms of the exponential series, and the off-diagonal terms pick up odd
> terms. Those series are easily summed analytically, giving a matrix
> exponential of A as:
>
> IDL> print, [[cosh(1),sinh(1)],[sinh(1),cosh(1)]]
> 1.54308 1.17520
> 1.17520 1.54308
>
> Which is quite a bit different from exp(A).
Huh. How 'bout that? Thanks very much for the explanation. Much appreciated.
paulv
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|
|
|