help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sqrt() of a Matrix in a DLD


From: Glenn Golden
Subject: Re: sqrt() of a Matrix in a DLD
Date: Sun, 07 Mar 2004 14:12:01 -0700

Vic Norton writes:
> Something is very peculiar about this, John. What does sqrt(m) mean anyhow?
> 

sqrt(x), where x is a matrix, computes element-by-element square root.
The DLD function sqrtm() computes the matrix square root.

Glenn



> For example suppose
> 
>     m = [1 -3; 0 2];
> 
> then, according to octave,
> 
>     sm = sqrt(m) =
> 
>     1.00000 + 0.00000i  0.00000 + 1.73205i
>     0.00000 + 0.00000i  1.41421 + 0.00000i
> 
> The complex elements are there alright, but
> 
>     sm^2 =
> 
>     1.00000 + 0.00000i  0.00000 + 4.18154i
>     0.00000 + 0.00000i  2.00000 + 0.00000i
> 
> is certainly not m.
> 
> In fact m is diagonalizable with positive diagonal elements
> 
>     m = inv(t) * d * t ,  t = [1 3; 0 1],  d = diag([1 2]).
> 
> It follows that
> 
>     rm = inv(t) * sqrt(d) * t =
> 
>     1.00000  -1.24264
>     0.00000   1.41421
> 
> does have the property that  rm^2 = m.
> 
> IMHO, rm is the square root of m.
> 
> 
> Regards,
> 
> Vic
> 
> 
> At 1:39 PM -0600 3/5/04, John W. Eaton wrote:
> >For example, if
> >you write
> >
> >   sm = sqrt (m);
> >
> >then sm will be complex if any element of m is negative.  Do you want
> >to preserve that behavior in your C++ function?
> >
> >jwe
> 
> 
> 
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]