Re: matrix log and exp [message #30274] |
Thu, 18 April 2002 06:19 |
G Karas
Messages: 12 Registered: March 2002
|
Junior Member |
|
|
"Vince" <hradilv.nospam@yahoo.com> wrote in message
news:3cbde89e.197479700@news...
> On Wed, 17 Apr 2002 15:32:42 -0400, Paul Van Delst
> <paul.vandelst@noaa.gov> 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
>>
>> --
>> 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
>
> I think what the original post-er is looking for is:
>
> exp(A) = SUM{ (1/n!) * A^n } from 0 to infinity
>
> The only (other) advice I can give is to truncate the sum at some
> "reasonable" value (10?, 100?). 'couse you still have to deal with
> the A^n part %^{
Yes, exp(A) with the factorial is quite straightforward, a value of 60 or so
will do the trick, but to go back by using
the logarithm is a lot more complicated. Thanks for all
the advice though :)
|
|
|
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
|
|
|
Re: matrix log and exp [message #30289 is a reply to message #30276] |
Wed, 17 April 2002 14:52  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
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).
|
|
|
Re: matrix log and exp [message #30290 is a reply to message #30289] |
Wed, 17 April 2002 14:34  |
hradilv.nospam
Messages: 19 Registered: November 2001
|
Junior Member |
|
|
On Wed, 17 Apr 2002 15:32:42 -0400, Paul Van Delst
<paul.vandelst@noaa.gov> 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
>
> --
> 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
I think what the original post-er is looking for is:
exp(A) = SUM{ (1/n!) * A^n } from 0 to infinity
The only (other) advice I can give is to truncate the sum at some
"reasonable" value (10?, 100?). 'couse you still have to deal with
the A^n part %^{
|
|
|
Re: matrix log and exp [message #30297 is a reply to message #30290] |
Wed, 17 April 2002 12:32  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
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
--
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
|
|
|