Hello. The context is that of discrete state space representations.

x_{t}=Ax_{t-1}+Bu_{t}

y_{t}=Cx_{t-1}+Du_{t}

I am making observational assumptions on the rows of x_{t} and I need to work symbolically. Specifically, I must construct controllability and observability matrices and verify the rank conditions for minimality, reducing the representation to a minimal one, ever symbolically. In Matlab I could do this by means of the syms command to then simply work with the basic linear algebra ones, more or less as follows.

syms a1111 a1112 a1121 a1122 b1111 b1121 b21

A=[a1111 a1112 0; a1121 a1122 0; zeros(1,3)];

B=[b1111; b1121; b21];

M=[1 0 0]; C=MA; D=MB;

Con=[B A*B A*A*B];

rc=rank(Con);

In Julia I have tried to use SymEngine and SymPy, but both fail to compute the rank. The code looks something like this.

using SymEngine, SymPy, ControlSystems, LinearAlgebra

@vars a1111 a1112 a1121 a1122 b1111 b1121 b21

A=[a1111 a1112 0; a1121 a1122 0; zeros(1,3)]

B=[b1111; b1121; b21]

M=[1 0 0]; C=MA; D=MB

Con=[B A*B A*A*B]

rc=rank(Con)

This is the error.

MethodError: no method matching copysign(::Basic, ::Basic)

Closest candidates are:

copysign(::Basic, !Matched::SymEngine.BasicType) at /Users/Name/.julia/packages/SymEngine/lLmHe/src/mathops.jl:89

copysign(!Matched::Sym, ::Number) at /Users/Name/.julia/packages/SymPy/fI5pg/src/generic.jl:26

How can I compute the rank for a symbolic matrix in Julia? I hope it is possible; I’m obviously not a cognoscente of Julia and appreciate the aid. Thanks a lot.