Rank: Advanced Member Groups: Registered
Joined: 04/07/2010(UTC) Posts: 178 Was thanked: 19 time(s) in 13 post(s)
|
I was curious how to embed matrices in a matrix and access an element of it. X[2 gives me the second row matrix. (X[2)[1,2 gives me the middle element of the second row. Works with functions too. Open in SMath Cloud |
Ed |
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Hello Ed, Yes, that is possible in SMath. One can have nested-embedded matrices. Andrey introduced that in one of the previous releases. I think he intended to apply some operations with so called "block matrices". It seems that there is some additional work to be done regarding this. It depends on Andrey's opinion about that. For instance, take a closer look to this example. Open in SMath CloudDid you notice how transpose operator works with nested matrices? On the other hand, we should take care of the multiple indexing here in order not to make mistakes. Regards, Radovan Edited by user 08 June 2011 15:00:35(UTC)
| Reason: Not specified |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
1 user thanked omorr for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 04/07/2010(UTC) Posts: 178 Was thanked: 19 time(s) in 13 post(s)
|
Radovan,
I'm not able to sub element an element thats why I found I had to enclose the submatrix in parens (X.2)[1,2 to get it to work. I'm using 0.89. Perhaps in the beta versions you can sub element an elemnt of a matrix X[2[1,2. |
Ed |
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Hello Ed,
At the moment, we should take care when using this multiple indexing. You could use parenthesis, but you do not need to do that if you use space key {SPACE}. For instance you should use X[2{SPACE}[1,2 instead of X[2[1,2. If we do not take care of this {SPACE} thing, there would actually error be issued - sometimes a strange one, for instance - that we try to display some large or small number not supported by Int32 ??? . There would be no problem as long as we use {SPACE} to enclose the needed parts of the variable inside the editing line (where invisible parenthesis would actually be). As I said, I think there are some additional efforts needed by Andrey to resolve these ambiguities.
I hope I made myself understood. If not I would give some pictures in the subsequnt posts (not able at the moment).
Regards, Radovan |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 04/07/2010(UTC) Posts: 178 Was thanked: 19 time(s) in 13 post(s)
|
Radovan,
I tried your {SPACE} and it works with 0.89 Stable. I didn't know about this. Thanks. |
Ed |
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.