[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sqrt() of a Matrix in a DLD
From: |
Henry F. Mollet |
Subject: |
Re: sqrt() of a Matrix in a DLD |
Date: |
Sun, 07 Mar 2004 16:59:16 -0800 |
User-agent: |
Microsoft-Entourage/10.1.1.2418 |
octave:94> m = [1 -3; 0 2]
m =
1 -3
0 2
octave:95> sm = sqrt(m)
sm =
1.00000 + 0.00000i 0.00000 + 1.73205i
0.00000 + 0.00000i 1.41421 + 0.00000i
octave:96> sm.^2 % need element by element operator because sm^2 = sm*sm =
matrix multiplication.
ans =
1.00000 -3.00000
0.00000 2.00000
For example:
octave:101> (1.00000 + 0.00000i)*(0.00000 + 1.73205i)+(0.00000 +
1.73205i)*(1.41421 + 0.00000i)
ans = 0.00000 + 4.18153i %as per result for sm^2(1,2) given below.
Henry
on 3/7/04 12:44 PM, Vic Norton at address@hidden wrote:
> Something is very peculiar about this, John. What does sqrt(m) mean anyhow?
>
> 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
-------------------------------------------------------------