Differences
This shows you the differences between two versions of the page.
documentation:language_reference:objects:matrix:functions:sqrt [2018/09/25 13:12] – created Simon Heinze | documentation: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 |
### | ### | ||
===== Example ===== | ===== Example ===== | ||
- | |||
- | ### | ||
- | Soon. | ||
- | ### | ||
==== Input ==== | ==== Input ==== | ||
<code Quanty Example.Quanty> | <code Quanty Example.Quanty> | ||
- | -- some example code | + | M = {{1,2*I}, |
+ | {-2*I,4}} | ||
+ | |||
+ | print(" | ||
+ | print(M) | ||
+ | sqrtM = Matrix.Sqrt(M) | ||
+ | print(" | ||
+ | print(sqrtM) | ||
+ | print(" | ||
+ | print(sqrtM*sqrtM) | ||
</ | </ | ||
==== 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 } } | ||
</ | </ | ||