I am trying to write a certain matrix neatly for a paper, but I do not know how I would go about writing what I want formally.
I have two variables, x and y, which can assume any value. I want to express a matrix M whose first diagonal component is 1 if x is positive, 0 otherwise. The second diagonal component is 1 if x is negative, 0 otherwise. The third diagonal component is 1 if y is positive, 0 otherwise. The fourth diagonal component is 1 if x is negative, 0 otherwise. For example:
x = 2, y = 1 -> diag(M) = [1 0 1 0];
x = 0, y = 1 -> diag(M) = [0 0 1 0];
x = -3, y = -2 -> diag(M) = [0 1 0 1];
In code, I would write that as:
diag(M) = [x > 0; x < 0; y > 0; y < 0];
Basically:
$\begin{equation} M = \begin{bmatrix} x>0 & & &\\ & x<0 & &\\ & & y>0&\\ & & & y<0 \end{bmatrix} \end{equation} $
And the boolean comparison is automatically converted to a 1 if true and 0 if false.
Would the latter be a good notation for a paper? Or is this only valid in code? I need to write this a lot of times and I want it to be clear what the matrix represent. Something maybe along the lines of the sign function, but that is -1 if the number is negative, and not zero so it does not work.
Basically it is not clear to me how to represent a boolean condition that translates to 1 if valid and 0 otherwise
I know that an alternative would be to write
$ \begin{equation} \begin{cases} 1 & \text{if x > 0}\\ 0 & \text{otherwise}\\ \end{cases} \end{equation}$
but that would be too much for the matrix I need to write since it is repeated four times slightly differently.
Cheers
The Iverson bracket notation is often used for things like this, where $[P] \equiv\begin{cases} 1 & \text{$P$ is true} \\ 0 & \text{$P$ is false} \end{cases}$
So in this case, you could write $[x > 0]$, $[y > 0]$, etc.