When executing Mathematica's NullSpace command on a symbolic matrix, Mathematica makes some assumptions about the variables and I would like to know what they are.
For example,
In[1]:= NullSpace[{{a, b}, {c, d}}]
Out[1]= {}
but the unstated assumption is that
a d != b c.
How can I determine what assumptions the NullSpace command uses?
Two matrices A and B are equal if they have the same dimensions and 𝑎ij = bij for every i and j. A square matrix is a matrix that has the same number of rows as columns; that is, and n × n matrix for some positive integer n.
Definition. The nullspace of the matrix A, denoted N(A), is the set of all n-dimensional column vectors x such that Ax = 0.
The underlying assumptions, so to speak, are enforced by internal uses of PossibleZeroQ
. If that function cannot deem an expression to be zero then it will be regarded as nonzero, hence eligible for use as a pivot in row reduction (which is generally what is used for symbolic NullSpace).
---edit---
The question was raised regarding what might be visible in zero testing in symbolic linear algebra. By default the calls to PossibleZeroQ
go through internal routes. PossibleZeroQ
was later built on top of those.
There is always a question in Mathematica kernel code development of what should go through the main evaluator loop and what (e.g. for purposes of speed) should short circuit. Only the former is readily traced.
One can influence the process in symbolic linear algebra by specifying a non-default zero test. Could be e.g.
myTest[ee_]:= (Print[zerotesting[ee]]; PossibleZeroQ[ee])
and then use ZeroTest->myTest
in NullSpace
.
---end edit---
Found this:
In this case, if you expand your matrix by one column, the assumption shows up:
NullSpace[{{a, b, 1}, {c, d, 1}}]
{{-((-b+d)/(-b c+a d)),-((a-c)/(-b c+a d)),1}}
Perhaps useful in some situations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With