flâneur — a map of the web's best reading

Matrices (linear algebra) - SymPy 1.13.0rc2 documentation

docs.sympy.org · 34,442 words · saved by 1 readers

The linear algebra module is designed to be as simple as possible. First, we import and declare our first Matrix object: In addition to creating a matrix from a list of appropriately-sized lists and/or matrices, SymPy also supports more advanced methods of matrix creation including a single list of values and dimension inputs: More interesting (and useful), is the ability to use a 2-variable function (or lambda) to create a matrix. Here we create an indicator function which is 1 on the diagonal and then use it to make the identity matrix: Finally let’s use lambda to create a 1-line matrix with 1’s in the even permutation entries: There are also a couple of special constructors for quick matrix construction: eye is the identity matrix, zeros and ones for matrices of all zeros and ones, respectively, and diag to put matrices or elements along the diagonal: While learning to work with matrices, let’s choose one where the entries are readily identifiable. One useful thing to know is that w

Matrices (linear algebra) ¶ Creating Matrices ¶ The linear algebra module is designed to be as simple as possible. First, we import and declare our first Matrix object: >>> from sympy.interactive.printing import init_printing >>> init_printing ( use_unicode = False ) >>> from sympy.matrices import Matrix , eye , zeros , ones , diag , GramSchmidt >>> M = Matrix ([[ 1 , 0 , 0 ], [ 0 , 0 , 0 ]]); M [1 0 0] [ ] [0 0 0] >>> Matrix ([ M , ( 0 , 0 , - 1 )]) [1 0 0 ] [ ] [0 0 0 ] [ ] [0 0 -1] >>> Matrix ([[ 1 , 2 , 3 ]]) [1 2 3] >>> Matrix ([ 1 , 2 , 3 ]) [1] [ ] [2] [ ] [3] In addition to creating a

Explore this link on the map →

related reading