Hp50 Version 6: nth-root of a (real/complex) matrix or matrix^(p/q), n,p,q real
03-11-2023, 10:47 PM (This post was last modified: 03-17-2023 02:05 PM by Gil.)
Post: #1
 Gil Senior Member Posts: 586 Joined: Oct 2019
Hp50 Version 6: nth-root of a (real/complex) matrix or matrix^(p/q), n,p,q real
For real or complex Matrixes M
calculates, when diagonalization is possible,

one real or complex
Matrix for M ^ x
(x= real, fraction or integers, positive or negative).

Use
Original Matrix in stack level 2
x power or xth root in level 1
& Run the program.

Example of M ^ x

M ^ 1/2,
M ^ -1/2,
M ^ 1/3,
M ^ 3/2
M ^ -3/2
M ^2, M^7, M^1/7, M ^ -1/7, etc.

Observations
1) When the diagonalization of the initial Matrix is feasible, the program does not give all the possible answers (real or complex Matrixes), but only one numerical ("more or less" possible) result (a real or complex Matrix).
2) Therefore, the given output might often not correspond to the expected result.
3) Sometimes, there should be no possible diagonalization... and no solution produced.
4) For safety, an additional (unnecessary?) test was added when the resulting eigenvalues are, as requested for the diagonalization, all different ; it checks then that, with the roundings, the determinent of the corresponding eigenvectors Matrix S is not equal to zero in order to calculate its inverse S^-1
(and a solution equal to S D^n S^-1).
5) A special calculation is done for 2 × 2 Matrixes when requested is the square root (exact power ± 1/2 or ±0.5).

Attached File(s)