CoCalc Public Filestmp / 2014-11-02-214954.sagewsOpen with one click!
Authors: Gihan Marasingha, Harald Schilly, ℏal Snyder, William A. Stein
m = matrix(0) m.add_multiple_of_row?
File: /usr/local/sage/sage-6.3.beta6/src/sage/matrix/matrix0.pyx Signature : m.add_multiple_of_row(self, i, j, s, start_col=0) Docstring : Add s times row j to row i. EXAMPLES: We add -3 times the first row to the second row of an integer matrix, remembering to start numbering rows at zero: sage: a = matrix(ZZ,2,3,range(6)); a [0 1 2] [3 4 5] sage: a.add_multiple_of_row(1,0,-3) sage: a [ 0 1 2] [ 3 1 -1] To add a rational multiple, we first need to change the base ring: sage: a = a.change_ring(QQ) sage: a.add_multiple_of_row(1,0,1/3) sage: a [ 0 1 2] [ 3 4/3 -1/3] If not, we get an error message: sage: a.add_multiple_of_row(1,0,i) Traceback (most recent call last): ... TypeError: Multiplying row by Symbolic Ring element cannot be done over Rational Field, use change_ring or with_added_multiple_of_row instead. Docstring: Signature : m.add_multiple_of_row(self, i, j, s, start_col=0) Docstring : Add s times row j to row i. EXAMPLES: We add -3 times the first row to the second row of an integer matrix, remembering to start numbering rows at zero: sage: a = matrix(ZZ,2,3,range(6)); a [0 1 2] [3 4 5] sage: a.add_multiple_of_row(1,0,-3) sage: a [ 0 1 2] [ 3 1 -1] To add a rational multiple, we first need to change the base ring: sage: a = a.change_ring(QQ) sage: a.add_multiple_of_row(1,0,1/3) sage: a [ 0 1 2] [ 3 4/3 -1/3] If not, we get an error message: sage: a.add_multiple_of_row(1,0,i) Traceback (most recent call last): ... TypeError: Multiplying row by Symbolic Ring element cannot be done over Rational Field, use change_ring or with_added_multiple_of_row instead.