Differences

This shows you the differences between two versions of the page.

Link to this comparison view

documentation:language_reference:objects:matrix:functions:sqrt [2018/09/25 13:12] – created Simon Heinzedocumentation:language_reference:objects:matrix:functions:sqrt [2018/09/26 15:02] (current) – Added Code Example Simon Heinze
Line 5: Line 5:
 Matrix.Sqrt($M$) takes a quadratic matrix $M$ and returns $\sqrt{M}$, which is defined by the property $\sqrt{M}\sqrt{M} = M$. Matrix.Sqrt($M$) takes a quadratic matrix $M$ and returns $\sqrt{M}$, which is defined by the property $\sqrt{M}\sqrt{M} = M$.
  
-At the moment this only works for Hermitian matrices.+At the moment this only works for Hermitian and positive definite matrices.
 ### ###
  
 ===== Example ===== ===== Example =====
- 
-### 
-Soon. 
-### 
  
 ==== Input ==== ==== Input ====
 <code Quanty Example.Quanty> <code Quanty Example.Quanty>
--- some example code+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)
 </code> </code>
  
 ==== Result ==== ==== Result ====
 <file Quanty_Output> <file Quanty_Output>
-text produced as output+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 } }
 </file> </file>
  
Print/export