Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the sign and natural logarithm of the determinant of a matrix
ResourceFunction["SignLogDet"][m] gives the sign and natural logarithm of the determinant of the square matrix m. |
Compute the sign and natural logarithm of the determinant of a matrix:
In[1]:= |
In[2]:= |
Out[2]= |
The determinant:
In[3]:= |
Out[3]= |
Or using the built-in function Det:
In[4]:= |
Out[4]= |
Compute the sign and natural logarithm of the determinant of a real-valued matrix:
In[5]:= |
Out[5]= |
In[6]:= |
Out[6]= |
Complex-valued array:
In[7]:= |
Out[7]= |
A SparseArray object:
In[8]:= |
Out[8]= |
A SymmetrizedArray object:
In[9]:= |
Out[9]= |
Use a singular matrix:
In[10]:= |
In[11]:= |
Out[11]= |
Use a large matrix:
In[12]:= |
In[13]:= |
Out[13]= |
Compute the determinant:
In[14]:= |
Out[14]= |
For real matrices, SignLogDet returns the signs as -1 or 1, depending on whether the determinant is negative or positive:
In[15]:= |
Out[15]= |
The sign is zero if the determinant is 0:
In[16]:= |
Out[16]= |
In[17]:= |
Out[17]= |
For complex matrices, the sign is a complex number with magnitude 1:
In[18]:= |
Out[18]= |
In[19]:= |
Out[19]= |
Or complex zero for singular matrices:
In[20]:= |
Out[20]= |
In[21]:= |
Out[21]= |
SignLogDet can give more accurate results than Det for small determinants:
In[22]:= |
In[23]:= |
Out[23]= |
In[24]:= |
Out[24]= |
In[25]:= |
Out[25]= |
SignLogDet may give inaccurate results with machine-precision computation:
In[26]:= |
In[27]:= |
Out[27]= |
In[28]:= |
Out[28]= |
The logarithm value returned by SignLogDet may be too small to compute the determinant with machine precision:
In[29]:= |
In[30]:= |
Out[30]= |
In[31]:= |
Out[31]= |
This work is licensed under a Creative Commons Attribution 4.0 International License