How to resize a matrix?

How to resize a matrix? - Сообщения

#1 Опубликовано: 24.11.2010 13:11:37
Konrad

Konrad

1 сообщений из 24 понравились пользователям.

Группа: User

Hi All,
I have a big matrix defined, many rows and columns laboriously entered. Now I need this matrix to have one more column or row in the definition. Can I do it? If not, can I copy and paste the contents of the old matrix to a new bigger one? Manual rewriting kind of scares me...
Konrad
PS I know there is augment(), but I need to do it in the definition.
#2 Опубликовано: 24.11.2010 13:21:07
Konrad

Konrad

1 сообщений из 24 понравились пользователям.

Группа: User

OK, I found some way: I have my old matrix, say 50x50. I define an additional vector, 1x50, augment(old,additional) and display the result which is a matrix 51x50, select all values and ctrl+C. Now I define a new, empty matrix 51x50, select all empty fields and ctrl+V. Delete the old one and there it is! Adding a row takes transposing, doesn't hurt anyway.
Any smarter ideas?
#3 Опубликовано: 24.11.2010 15:06:19
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello Konrad,

Me again

If you have large matrices of data, I would advice you to use importData() function. You can input your data matrix in different software (even in a text editor) and export it as a text file with rows and columns of data. Then you can use importData() and import it into a matrix (I think that exportData() function is not implemented yet in SMath). Your entered data will remain preserved this way while you are manipulating with matrices in SMath. Displaying large matrices in SMath is not advisable because they will cover lot of page area and it is hard to work this way. You can display part of it with submatrix() function.
Combining matrices, vectors can be aranged with augment() - matrices with the same number of rows and combined horizontaly, or stack() - matrices with the same number of columns and combined verticaly.

I hope this is maybe a partial answer to your question.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#4 Опубликовано: 25.11.2010 06:03:54
Konrad

Konrad

1 сообщений из 24 понравились пользователям.

Группа: User

Hi Radovan,
Stack! Of course, I missed it. You're helpful, as always. Thanks.
ImportData() seems useful, but so far they're not really large. As long as it fits on the page with a small font, I prefer to work without any external data source (less software validation & verification). I miss Mathcad's "reference", but I can live without it.
Konrad
#5 Опубликовано: 25.11.2010 06:28:45
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

You are welcome

Btw, if you like to extract single rows or columns - just do not miss row() and col() functions.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений