Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download

Math 208 Interactive Notebooks © 2024 by Soham Bhosale, Sara Billey, Herman Chau, Zihan Chen, Isaac Hartin Pasco, Jennifer Huang, Snigdha Mahankali, Clare Minerath, and Anna Willis is licensed under CC BY-ND 4.0

Views: 796
License: OTHER
Image: ubuntu2204
Kernel: SageMath 10.1
## Hello All! This is a place we can work on our shared Linear Algebra Tutorial. What should we put in this document? ## Here is an existing Sage Tutorial in html format. We can use it as a guide to get started: https://doc.sagemath.org/html/en/tutorial/tour_linalg.html ## Here is another example that might be of use: ## https://sites.math.washington.edu//~billey/colombia/sage.code/Algebraic%20Combinatorics%20Tutorial.pdf
A = Matrix(QQ, [[1,2,3],[3,2,1],[1,1,1]])
A
[1.00000000000000 + 1.00000000000000*I 2.00000000000000 3.00000000000000] [ 3.00000000000000 2.00000000000000 1.00000000000000] [ 1.00000000000000 1.00000000000000 1.00000000000000]
A*A
[10 9 8] [10 11 12] [ 5 5 5]
A.echelon_form()
[ 1 0 -1] [ 0 1 2] [ 0 0 0]
A.det()
0
A.charpoly()
x^3 - 4*x^2 - 5*x
A.eigenvalues()
[5, 0, -1]
A.is_diagonalizable()
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In [15], line 1 ----> 1 A.is_diagonalizable()
File /ext/sage/10.1/src/sage/matrix/matrix2.pyx:11699, in sage.matrix.matrix2.Matrix.is_diagonalizable() 11697 raise ValueError('matrix entries must be from a field') 11698 if not A.base_ring().is_exact(): > 11699 raise ValueError('base field must be exact, but {} is not'.format(A.base_ring())) 11700 11701 # check if the sum of algebraic multiplicities equals to the number of rows
ValueError: base field must be exact, but Complex Field with 53 bits of precision is not
A.
A = Matrix(QQ, [[1,2,3],[3,2,1],[1,1,1]])
A.diagonalization()
( [ 5 0 0] [ 1 1 1] [ 0 0 0] [13/11 -2 -1] [ 0 0 -1], [ 6/11 1 0] )
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In [21], line 1 ----> 1 B = Matrix(_ ,[[Integer(1),Integer(2),Integer(3)],[Integer(3),Integer(2),Integer(1)],[Integer(1),Integer(1),Integer(1)]])
File /ext/sage/10.1/src/sage/matrix/constructor.pyx:643, in sage.matrix.constructor.matrix() 641 """ 642 immutable = kwds.pop('immutable', False) --> 643 M = MatrixArgs(*args, **kwds).matrix() 644 if immutable: 645 M.set_immutable()
File /ext/sage/10.1/src/sage/matrix/args.pyx:356, in sage.matrix.args.MatrixArgs.__init__() 354 if argi == argc: return 355 --> 356 raise TypeError("too many arguments in matrix constructor") 357 358 def __repr__(self):
TypeError: too many arguments in matrix constructor