How to calculate all the square roots of a matrix?

6 visualizaciones (últimos 30 días)
Viswanath Hariharan
Viswanath Hariharan el 18 de Dic. de 2017
Respondida: Irshad Khan el 10 de Ag. de 2018
I have a matrix [5/8 3/8; 3/8 5/8] and it has more than one square root. If I perform sqrtm on it, it returns only one square root. How do I obtain all of its square roots?

Respuestas (2)

Walter Roberson
Walter Roberson el 19 de Dic. de 2017
x = sym('x', [2 2]);
xsq = x^2;
sol = solve(xsq == [5/8 3/8; 3/8 5/8]);
all_roots = arrayfun(@(x11, x12, x21, x22) [x11,x12;x21,x22], sol.x1_1, sol.x1_2, sol.x2_1, sol.x2_2, 'uniform', 0);
  2 comentarios
Viswanath Hariharan
Viswanath Hariharan el 21 de Dic. de 2017
This did work. Thank you. But [-0.7071 -0.7071;-0.3536 0.3536] is also a root but this algorithm didn't find it out. Why so?
Walter Roberson
Walter Roberson el 22 de Dic. de 2017
T = sqrt(sym(2)); U = [-1/T -1/T;-1/T/2 1/T/2] double(U) %verify that U is the matrix you are talking about U^2
The result is
[ 3/4, 1/4]
[ 1/8, 3/8]
which is not your original matrix, so the matrix you indicate is not a square root of the original matrix.

Iniciar sesión para comentar.


Irshad Khan
Irshad Khan el 10 de Ag. de 2018
How do I get only real roots?

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by