[SciPy-user] Matrix square root

Nils Wagner nwagner at mecha.uni-stuttgart.de
Mon Oct 4 06:44:38 CDT 2004


Nils Wagner wrote:

> Stuart Murdock wrote:
>
>> Hi
>>
>> I am trying to calculate the matrix square root (lets say B) of a 
>> Matrix (A) which is an array.
>>
>> A = array([[1,2],[3,4]])
>>
>> such that
>>
>> A = matrixmultiply(B,B)
>>
>> are there any functions in SciPy to do that ?
>>
>> Thanks
>>
>> Stuart
>>
> AFAIK there is no direct support for sqrtm but you may use funm.

BTW, some algorithms for sqrtm can be found at

http://www.ma.man.ac.uk/~higham/pap-mf.html

This might be a starting point for an implementation of sqrtm in scipy.

Any comments ?

Nils

>
> >>> a = array(([1,2],[3,4]))
> >>> b = linalg.funm(a,sqrt)
> >>> b
> array([[ 0.55368857+0.46439416j,  0.80696073-0.21242648j],
>       [ 1.21044109-0.31863972j,  1.76412966+0.14575444j]])
> >>> dot(b,b)-a
> array([[  2.22044605e-16 -3.19839641e-17j,   0.00000000e+00 
> -2.83518868e-17j],
>       [  4.44089210e-16 -1.06821019e-16j,   0.00000000e+00 
> -1.69677640e-17j]])
> >>>
>
> HTH,
>               Nils
>


 




More information about the SciPy-user mailing list