Timeline for Elegant operations on matrix rows and columns
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 28, 2016 at 11:15 | comment | added | Fierce82 | What If I want to use your method to multiply a column? I tried this m /. {m[[All, 3]] -> 3 m[[All, 3]]} // MatrixForm in order to multiply 3rd column by 3 but doen't work. Am I missing something in your logic? | |
Mar 16, 2012 at 9:43 | comment | added | Vitaliy Kaurov | @sjdh I just did. But please be aware of the warning I posted at the beginning in bold - and read all comments here. | |
Mar 16, 2012 at 9:42 | history | edited | Vitaliy Kaurov | CC BY-SA 3.0 |
added 205 characters in body
|
Mar 16, 2012 at 9:27 | comment | added | sjdh | @Vitaliy the key insight I was missing is that you can address row i with m[[i]]. This is clear, thanks. Can you give an example for columns? Adding two columns, for example? | |
Mar 16, 2012 at 9:16 | history | edited | Vitaliy Kaurov | CC BY-SA 3.0 |
added 68 characters in body
|
Mar 16, 2012 at 9:14 | comment | added | Niki Estner |
+1 nice idea. But what happens if the matrix contains two rows {4 5 6} ?
|
|
Mar 16, 2012 at 9:13 | comment | added | Vitaliy Kaurov | @Szabolcs (and Mr.Wizard and nikie ;-) ) Very true - I'll add a comment at the top. | |
Mar 16, 2012 at 9:10 | comment | added | Mr.Wizard |
These ReplaceAll methods are dangerous because a matrix may contain repeated rows or columns.
|
|
Mar 16, 2012 at 9:09 | comment | added | Vitaliy Kaurov | @sjdh I see - added an example. | |
Mar 16, 2012 at 9:09 | comment | added | Szabolcs |
What if the matrix has two rows that are the same? The Replace approach will affect both.
|
|
Mar 16, 2012 at 9:08 | history | edited | Vitaliy Kaurov | CC BY-SA 3.0 |
added 68 characters in body
|
Mar 16, 2012 at 8:59 | comment | added | sjdh | With adding rows, I mean adding the numbers of one row to an existing row | |
Mar 16, 2012 at 8:38 | history | answered | Vitaliy Kaurov | CC BY-SA 3.0 |