Sqrt

Matrix.Sqrt($M$) takes a quadratic matrix $M$ and returns $\sqrt{M}$, which is defined by the property $\sqrt{M}\sqrt{M} = M$.

M must be Hermitian and positive definite.

Example

Input

Example.Quanty
M = {{1,2*I},
    {-2*I,4}}
 
print("M:")
print(M)
sqrtM = Matrix.Sqrt(M)
print("sqrt(M):")
print(sqrtM)
print("sqrt(M)*sqrt(M)")
print(sqrtM*sqrtM)

Result

M:
{ { 1 , (0 + 2 I) } , 
  { (-0 - 2 I) , 4 } }
sqrt(M):
{ { 0.44721359549996 , (0 + 0.89442719099992 I) } , 
  { (0 - 0.89442719099992 I) , 1.7888543819998 } }
sqrt(M)*sqrt(M)
{ { 1 , (0 + 2 I) } , 
  { (0 - 2 I) , 4 } }

Table of contents

Print/export