{"id":27663,"date":"2022-08-16T00:00:29","date_gmt":"2022-08-15T18:30:29","guid":{"rendered":"https:\/\/python-programs.com\/?p=27663"},"modified":"2022-08-16T00:00:29","modified_gmt":"2022-08-15T18:30:29","slug":"python-sympy-matrix-col_del-method","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-sympy-matrix-col_del-method\/","title":{"rendered":"Python sympy.Matrix.col_del() Method"},"content":{"rendered":"
Python SymPy Module:<\/strong><\/p>\n SymPy is a Python\u00a0symbolic mathematics<\/strong>\u00a0library. It aims to be a full-featured computer algebra system (CAS) while keeping the code as basic(simple) as possible in order to be understandable and easily expandable. SymPy is entirely written in Python. SymPy is simple to use because it only depends on mpmath, a pure Python library for arbitrary floating-point arithmetic.<\/p>\n Rational and Integer are the numerical types defined by SymPy. A rational number is represented by the Rational class as a pair of two Integers, numerator and denominator, therefore Rational(1, 2) is 1\/2, Rational(3, 2) is 3\/2, and so on. Integer numbers are represented by the Integer class.<\/p>\n SymPy uses mpmath in the background, allowing it to execute arbitrary-precision arithmetic computations. Some special constants, such as exp, pi, and oo (Infinity), are thus considered as symbols and can be evaluated with arbitrary precision.<\/p>\n Installation:<\/strong><\/p>\n Python sympy.Matrix.col_del() Method:<\/strong><\/p>\n We can delete the columns of a matrix using the sympy.Matrix.col_del() function.<\/p>\n Syntax:<\/strong><\/p>\n Return Value:<\/strong><\/p>\n A new matrix after the deletion of the column is returned by the Matrix.col_del() function.<\/p>\n For 2-Dimensional (2D) Matrix<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n For 3-Dimensional (3D) Matrix<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Python SymPy Module: SymPy is a Python\u00a0symbolic mathematics\u00a0library. It aims to be a full-featured computer algebra system (CAS) while keeping the code as basic(simple) as possible in order to be understandable and easily expandable. SymPy is entirely written in Python. SymPy is simple to use because it only depends on mpmath, a pure Python library …<\/p>\npip install sympy<\/pre>\n
sympy.Matrix().col_del()<\/pre>\n
sympy.Matrix.col_del() Method in Python<\/h2>\n
\n
\nto delete the values of the specified column.<\/li>\n# Import all the methods from sympy using the import keyword\r\nfrom sympy import *\r\n\r\n# Create a 2-Dimensional(2D) matrix using the Matrix() function by passing some random\r\n# 2D matrix as an argument to it and store it in a variable.\r\ngvn_matrx = Matrix([[3, 5], [6, 8]])\r\n# Apply col_del() function on the above given matrix by passing the column number as an argument to it\r\n# to delete the values of the specified column.\r\n# Here it deletes the zero(0th) column.\r\ngvn_matrx.col_del(0)\r\n\r\n# Print the given matrix after deleting the zero(0th) column.\r\nprint(\"The given matrix after deleting the zero(0th) column:\")\r\nprint(gvn_matrx)\r\n<\/pre>\n
The given matrix after deleting the zero(0th) column:\r\nMatrix([[5], [8]])<\/pre>\n
\n
\nto delete the values of the specified column.<\/li>\n# Import all the methods from sympy using the import keyword\r\nfrom sympy import *\r\n\r\n# Create a 3-Dimensional(3D) matrix using the Matrix() function by passing some random\r\n# 3D matrix as an argument to it and store it in a variable.\r\ngvn_matrx = Matrix([[1, 6, 10], [8, 7, 5], [3, 2, 9]])\r\n# Apply col_del() function on the above given matrix by passing the column number as an argument to it\r\n# to delete the values of the specified column.\r\n# Here it deletes the 1st column.\r\ngvn_matrx.col_del(1)\r\n\r\n# Print the given matrix after deleting\u00a0the 1st column\r\nprint(\"The given matrix after deleting\u00a0the 1st column:\")\r\nprint(gvn_matrx)\r\n<\/pre>\n
The given matrix after deleting the 1st column:\r\nMatrix([[1, 10], [8, 5], [3, 9]])<\/pre>\n","protected":false},"excerpt":{"rendered":"