## How to find square root of a matrix that contains symbolic variables?

### Amit Kumar (view profile)

on 21 May 2019
Latest activity Commented on by Walter Roberson

### Walter Roberson (view profile)

on 21 May 2019
Hi
I am evaluating the square root of a matrix. The matrix includes a symbolic variable. I have observed that until the matrix order is 3x3, the command sqrtm(), gives requisite output. On the other hand as the order of matrix becomes 4 or higher, the simulation although starts, but do not end even in 8-10 hrs. Then, finally I had to use "Ctl+C" command to terminate the simulation process. The problem is illustrated more clearly as under:
The elements R, L and C are:
R =
[200, 0 0 0;
0 200 0 0;
0 0 200 0;
0 0 0 200]
L =
[7.78e-10 4.38e-10 2.66e-10 1.72e-10;
4.38e-10 7.42e-10 4.2e-10 2.58e-10;
2.66e-10 4.2e-10 7.34e-10 4.2e-10;
1.72e-10 2.58e-10 4.2e-10 7.42e-10]
C =
[2.64e-13 -1.5e-13 -7.26e-15 -3.08e-15;
-1.5e-13 3.6e-13 -1.48e-13 -5.7e-15;
-7.26e-15 -1.48e-13 3.6e-13 -1.46e-13;
-3.08e-15 -5.7e-15 -1.46e-13 3.4e-13]
The matrix sZ = R +s*L; where sZ represents Z matrix that contain symbolic variable s.
sY = s*C; where sY represents C matrix that contain symbolic variable s.
sYZ = sY*sC
square_root_sYZ = sqrtm(sYZ)
The matlab code is written as below:
R = [200, 0, 0, 0;
0, 200, 0, 0;
0, 0, 200, 0;
0, 0, 0, 200]
L = [7.78e-10, 4.38e-10, 2.66e-10, 1.72e-10;
4.38e-10, 7.42e-10, 4.2e-10, 2.58e-10;
2.66e-10, 4.2e-10, 7.34e-10, 4.2e-10;
1.72e-10, 2.58e-10, 4.2e-10, 7.42e-10]
C = [2.64e-13, -1.5e-13, -7.26e-15, -3.08e-15;
-1.5e-13, 3.6e-13, -1.48e-13, -5.7e-15;
-7.26e-15, -1.48e-13, 3.6e-13, -1.46e-13;
-3.08e-15, -5.7e-15, -1.46e-13, 3.4e-13]
syms s
sZ = R +s*L
sY = s*C
sYZ = sY*sC
square_root_sYZ = sqrtm(sYZ)
As I run this, no output is coming for the last step i.e. square_root_sYZ = sqrtm(sYZ), even after the simulation goes on for hours.
Kindly suggest possible solution to this problem.

Show 1 older comment
Walter Roberson

### Walter Roberson (view profile)

on 21 May 2019
sYZ is already sym. We know that because it involves sY which involves the symbolic s.
Amit Kumar

### Amit Kumar (view profile)

on 21 May 2019
"We don’t know what sC is".
Actually it is sY; a typing mistake from my end and therefore,
sYZ = sY*sZ
i.e. the product of sY and sZ matrices which includes the symbolic variable s.
"what happens when you try
sqrtm(sym(sYZ)) %?"
I am trying this, but again the program keeps on running the same way as it ran with sqrtm(sYZ) command.
Walter Roberson

### Walter Roberson (view profile)

on 21 May 2019
Even just sqrtm() of a 4 x 4 array of symbolic variables (with no expressions to complicate things) takes a long time.