Re: Algorithm for calculating matrix exponential
- From: Chip Eastham <hardmath@xxxxxxxxx>
- Date: Sun, 27 Apr 2008 12:22:03 -0700 (PDT)
On Apr 27, 2:51 pm, LiorFains...@xxxxxxxxx wrote:
You have a fast reaction time in this group. That's great.
I am a programmer and I will like most of all to see an algorithm,
that I can write in code.
Is there some simple formula, I can use for 2x2 case? I also need a
solution for larger matrices, but that's a separate question.
On Apr 27, 9:46 pm, Jannick Asmus <jannick.n...@xxxxxx> wrote:
On 27.04.2008 20:43, LiorFains...@xxxxxxxxx wrote:
I need an algorithm for calculating an exponential of a small matrix,
with size of at most 6x6. 2x2 case is of particular interest and a
simple and efficient algorithm for this case will be welcome.
I tried using Taylor series expansion. It works for some matices, but
for others it produces wrong results, possibly due to rounding errors.
Thanks
Could diagonalizing the matrix - if possible - or the Cayley-Hamilton
theorem be of some help?
--
Best wishes,
J.
What do you know in advance about the 2x2 matrix?
Is it real? Symmetric? Does it have necessarily
two distinct eigenvalues? Is it nonsingular?
If you don't know these things in advance and are
not keen on doing a bit of case logic to determine
the answers and take advantage where possible, the
Taylor series approach is probably a good one.
You said that you'd gotten some errors, possibly
due to roundoff, in implementing that. It's
possible that your matrix entries are fairly big
and that scaling the matrix will reduce effects
of roundoff error.
Suppose that A is your original matrix. Find
a power of 2 that makes the absolute sum of
entries in A not more than 1, i.e.
B = 2^-k A
where SUM |B(i,j)| <= 1.
Then apply the Taylor series approach to exp(B),
and exp(A) = exp(2^k B) = exp(B)^(2^k), which
can be computed by repeated squarings.
For the best accuracy, Jannick's suggestion of
diagonalizing the matrix should be considered.
That is, suppose A is similar to a diagonal
matrix D, i.e.
D = P A P^-1
for some nonsingular matrix P. Then exp(D) can
be computed by applying the scalar exponential
function to each diagonal entry, and this gives:
exp(A) = P^-1 exp(D) P
by similarity. Not every 2x2 matrix can be
diagonalized, but if A is real symmetric or has
two distinct eigenvalues, then A can be.
regards, chip
.
- Follow-Ups:
- Re: Algorithm for calculating matrix exponential
- From: LiorFainshil
- Re: Algorithm for calculating matrix exponential
- References:
- Algorithm for calculating matrix exponential
- From: LiorFainshil
- Re: Algorithm for calculating matrix exponential
- From: Jannick Asmus
- Re: Algorithm for calculating matrix exponential
- From: LiorFainshil
- Algorithm for calculating matrix exponential
- Prev by Date: Re: Trignometry
- Next by Date: Re: Field extensions and Galois correspondence
- Previous by thread: Re: Algorithm for calculating matrix exponential
- Next by thread: Re: Algorithm for calculating matrix exponential
- Index(es):
Relevant Pages
|