[SciPy-user] Matrix square root
Nils Wagner
nwagner at mecha.uni-stuttgart.de
Mon Oct 4 07:35:58 EDT 2004
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.
>>> 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
--
Dr.-Ing. Nils Wagner
Institut A für Mechanik
Universität Stuttgart
Pfaffenwaldring 9
D-70550 Stuttgart
Tel.: (+49) 0711 685 6262
Fax.: (+49) 0711 685 6282
E-mail: nwagner at mecha.uni-stuttgart.de
URL : http://www.mecha.uni-stuttgart.de
More information about the SciPy-User
mailing list