Calculating the null space of a matrix 

The null space of an m x n matrix A, denoted as null A, is the set of all solutions for the homogeneous equation Ax = 0.

Calculating the null space of a matrix helps us in identifying all the potential values of x that help solve the equation Ax = 0.

In order to calculate the null space of a given matrix, we would be using the built-in nullspace function available within the sympy package.

In order to understand how the null space of a given matrix can be calculated, let us consider the following example: 

  1. Initialize the matrix:
M = Matrix([[1, 2, 3, 0, 0], [4, 10, 0, 0, 1]]) 
  1. Calculate the null space of the matrix by using the nullspace function:
M.nullspace()
  1. The output of the preceding code ...

Get SciPy Recipes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.