Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
I do not believe such a feature would ever exits in SMath (it does not exit in Mathcad, Prime etc. as well) but I just had an urge to mention this (again). Actually, after such a long time I had to believe it is impossible to just make it real because it would have been made already. For example, if any of you have some time, just read the post from a Guest about 6 years ago ( here) This is very common in other math packages - to extract a matrix from a matrix by having vector indexes. See the picture, it is clear what we want, but there is an error message. Of course, we can do this by using submatrix(), augment(), stack() function, or by for loop - but it can be sometimes a night mare. Regards, Ra |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
3 users thanked omorr for this useful post.
|
on 08/09/2016(UTC), on 08/09/2016(UTC), on 08/09/2016(UTC)
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,647 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Very nice Radovan something like this? el_plus.sm (20kb) downloaded 214 time(s).Edited by user 20 September 2016 11:31:31(UTC)
| Reason: marked as solved (implemented) |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
3 users thanked Davide Carpi for this useful post.
|
on 08/09/2016(UTC), on 08/09/2016(UTC), on 08/09/2016(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: Davide Carpi something like this?
Yes, that would be something like vector valued indices in matlab. I support this proposal. This would be the little brother of Mathcad range variables (implicit iteration in assignments over vector valued indices, currently this requires for loops) The availability of range variables mitigates the need for el_plus in Mathcad, because you can define your index vectors r and c, create range variables i=1...length(r), j=1..length(c) Result[(i,j) = M[(r[i,c[j) |
|
1 user thanked mkraska for this useful post.
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Originally Posted by: Davide Carpi Very nice Radovan something like this? el_plus.sm (20kb) downloaded 214 time(s). Just like that, very nice Davide . If you could make operators from these functions like el(M, that would be amazing Regards, Radovan |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Administration Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member Joined: 11/07/2008(UTC) Posts: 1,616 Was thanked: 1978 time(s) in 666 post(s)
|
Implemented (will be available in new build). Thank you, Radovan.
|
5 users thanked Andrey Ivashov for this useful post.
|
on 08/09/2016(UTC), on 08/09/2016(UTC), on 08/09/2016(UTC), on 08/09/2016(UTC), on 08/09/2016(UTC)
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Originally Posted by: mkraska Originally Posted by: Davide Carpi something like this?
Yes, that would be something like vector valued indices in matlab. I support this proposal.... Exactly Martin, not just in Matlab but just in many other software where this kind of vector valued indices is a rather common (and an elegant) feature. Regards, Radovan |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Originally Posted by: Andrey Ivashov Implemented (will be available in new build).
You are very welcome Andrey, and I am really surprised about this very fast reaction of yours I really do not know why this was not implemented earlier, and that is why I thought it was not possible. I am glad that I was wrong BTW, I consider this as a rather important feature. Best Regards, Radovan Edited by user 08 September 2016 16:49:09(UTC)
| Reason: Not specified |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: Andrey Ivashov Implemented (will be available in new build).
Great. I assume that the feature isn't limited to range()-generated index vectors but can use arbitrary integer vectors. Might be useful to have some shorthand for using all elements in a given dimension, perhaps an empty placeholder or "all" would do. This would make the examples even more compact without adding problems for the reader. |
|
|
|
|
Rank: Administration Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member Joined: 11/07/2008(UTC) Posts: 1,616 Was thanked: 1978 time(s) in 666 post(s)
|
Originally Posted by: mkraska I assume that the feature isn't limited to range()-generated index vectors but can use arbitrary integer vectors. I did afraid someone may ask this question. Yes, I didn't introduce any limits there, you can even use matrices: Not sure what it means, but it works He-he... Edited by user 08 September 2016 18:20:51(UTC)
| Reason: Not specified
|
4 users thanked Andrey Ivashov for this useful post.
|
on 08/09/2016(UTC), on 08/09/2016(UTC), on 08/09/2016(UTC), on 08/09/2016(UTC)
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
This would be very appreciated and would give some new opportunities (and unexpected behavior). Moreover, my greedy mind does not let me go and bothers me with vector (matrix) indices for undefined variables. Here is the picture I hope I made my point. The primer goal is to define a symbolic vector or matrix by this shorthand notation Regards, Ra |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Administration Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member Joined: 11/07/2008(UTC) Posts: 1,616 Was thanked: 1978 time(s) in 666 post(s)
|
|
1 user thanked Andrey Ivashov for this useful post.
|
|
|
Rank: Administration Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member Joined: 11/07/2008(UTC) Posts: 1,616 Was thanked: 1978 time(s) in 666 post(s)
|
|
1 user thanked Andrey Ivashov for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
If we could use the array valued indices on the left hand side of assignments, this would be close to having range variables like in Mathcad. SS-14 could be closed. |
|
1 user thanked mkraska for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Sorry for "Mathcaders Primes", Mathcad 11 did it simple because it supported index [indices] as argment. Smath does not. Though submatrix look alike between Smath/Mathcad, except for the indexing, they are not the same ... Explain: In Mathcad, if you want to mirror a matrix [think of an image], you just need to reverse the cols order. Smath does not support the reverse cols order. If you think others do something useful: YES, but useless for practical Engineering works involving specific search in matrix unless the software has been designed for. When working with matrices [Smath, Mathcad ...] you need a "Matrix Treasury" of utilities. You will have more than expected in the attached document. Thanks Radovan, most interesting subject. Jean Utilities Matrix RemToDo [select row_col].sm (6kb) downloaded 41 time(s).
|
1 user thanked Jean Giraud for this useful post.
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Originally Posted by: mkraska If we could use the array valued indices on the left hand side of assignments, this would be close to having range variables like in Mathcad. SS-14 could be closed. Sorry, Martin but it seems to me that at the moment we could use the array valued indices on the left hand side for the numerical or symbolical equal to, only. Not on the left hand side of the assignment operator. I hope I am(not) right. Regards, Ra |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Originally Posted by: Jean Giraud Sorry for "Mathcaders Primes", Mathcad 11 did it simple because it supported index [indices] as argment. Smath does not. Though submatrix look alike between Smath/Mathcad, except for the indexing, they are not the same ... Explain: In Mathcad, if you want to mirror a matrix [think of an image], you just need to reverse the cols order. Smath does not support the reverse cols order. If you think others do something useful: YES, but useless for practical Engineering works involving specific search in matrix unless the software has been designed for. When working with matrices [Smath, Mathcad ...] you need a "Matrix Treasury" of utilities. You will have more than expected in the attached document. Thanks Radovan, most interesting subject. Jean Thank you Jean for the comment, and you are very welcome as always. As Andrey introduced this new feature, you can just use intrinsic SS possibilities rather than writing new functions like your own, or as Davide wrote few ones in the post above, for extracting the values from a matrix in the way you want. I also mentioned, as you did, that this feature do not have neither Mathcad nor Prime(I think). Regards, Ra |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
The snipet does it nice, does not work in 5346, and very glad it does not work. What I need is a function, and designed as such fully flexible rather than a local result. There is a bit of story behind "MatrixBlocUser". Mathcad 11.2a [2003] came with the Excel read function ++++, how many have used/exchanged work in the forum ? NONE !!! except during the stage of designing DAEP, the collab had to read "SunSpot" from his own Excel file. The 3 functions [matrix utilities] have been vital to me, let's see: The Project Team constructs the pipe data ... so many cols wide, so many rows long. The piping designer needs certain cols by the rows of pipe sizes wrt the project. The purchasing department needs other set of columns, the transport trucker other set of cols ... and Jean [the Instrument man] needs his own set of cols/rows. So, everybody is happy with the "MatrixBlocUser". Jean Utilities Matrix RemToDo [select row_col].sm (25kb) downloaded 51 time(s).
|
1 user thanked Jean Giraud for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 17/01/2013(UTC) Posts: 296 Location: Khabarovsk, Russia Was thanked: 151 time(s) in 107 post(s)
|
Originally Posted by: Andrey Ivashov we cannot generate symb vector here because in SS we support definition after usage Hm. I just don't seem to understand... Why isn't possible to re-interpret el(X,range(1,5)) as mat(el(X,1),el(X,2),el(X,3),el(X,4),el(X,5),5,1)? Aren't these expressions equivalent in any case? If value of X is undefined, this doesn't seem to change the situation... |
Best regards, Mike Kaganski |
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Originally Posted by: mikekaganski Originally Posted by: Andrey Ivashov we cannot generate symb vector here because in SS we support definition after usage Hm. I just don't seem to understand... Why isn't possible to re-interpret el(X,range(1,5)) as mat(el(X,1),el(X,2),el(X,3),el(X,4),el(X,5),5,1)? Aren't these expressions equivalent in any case? If value of X is undefined, this doesn't seem to change the situation... Thank you for your comment Mike. I did not understand this as well but had to accept what Andrey explained about it for granted. BTW, this gave me headache many times when I had to define a symbolic vector, matrix (having the elements in standard notation like mat(el(X,1),el(X,2),el(X,3)...) with more than few variables. I hoped this might be the most simplest way. There must be something simpler than this, or I just forgot how to perform this in as simpler way Symbolic vector matrixRegards, Radovan Edited by user 10 September 2016 12:34:57(UTC)
| Reason: Not specified |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: Andrey Ivashov The sandbox example shows the use of matrices as indices. The question is, how the rules for such indices are. A straightforward rule would be that whatever you provide as index structure, it is accessed by linear indexing from 1..length() of the index structure. The following example shows that the actual behaviour is different. The index matrices are indexed column-wise and not row-wise as the usual linear indexing works. I propose to change this in order to be consistent with general linear indexing. Example (cloud) |
|
4 users thanked mkraska for this useful post.
|
on 10/09/2016(UTC), on 10/09/2016(UTC), on 19/09/2016(UTC), on 20/09/2016(UTC)
|
|
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.