SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
[SS-3525] assigning element to matrix resets its size
Rank: Member Groups: Registered
Joined: 09/03/2010(UTC) Posts: 29 Location: Poland
Was thanked: 4 time(s) in 2 post(s)
|
Hi, what am I doing wrong? m matrix looses it's contents and dimensions after I assigned a single element. Edit: I found an ugly fix. First I have to create matrix of (2;1) instead (2;0) elements. After all augmenting I have to use submatrix to get rid of first column. Michal Edited by moderator 29 March 2018 12:44:38(UTC)
| Reason: marked as FIXED
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Just like this.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 14/10/2015(UTC) Posts: 308
Was thanked: 77 time(s) in 58 post(s)
|
|
|
|
|
Rank: Member Groups: Registered
Joined: 09/03/2010(UTC) Posts: 29 Location: Poland
Was thanked: 4 time(s) in 2 post(s)
|
Ok, I probably did not clarify my real needs. I have some matrices. I just exclude single column from each of them and then I glue them together. So in my real sheet I never glue the same matrix twice. Here comes another example where I try to augment some vectors to new matrix. I have many vectors and they are indexed so I can use program to augment them in a loop.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,985 Was thanked: 1124 time(s) in 721 post(s)
|
The issue is in the type recognition on the left hand side. m is a matrix-valued expression rather than a matrix (expression with mat() being the top level object). We had this already with index values being expressions instead of variables. Thus, the existing m is not recognized as a matrix and therefore not modified but overwritten. You need to make sure that m is actually stored as matrix, i.e. by applying eval() or by just evaluating numerically (you did symbolically) I'd prefer SMath to actually check if m evaluates to a matrix and then deciding what to do. Ass_elem_Matrix_Kr.sm (6kb) downloaded 17 time(s).Edited by user 22 March 2018 14:12:29(UTC)
| Reason: Not specified |
|
2 users thanked mkraska for this useful post.
|
on 22/03/2018(UTC), on 22/03/2018(UTC)
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: m227 Ok, I probably did not clarify my real needs. That will handle your projects more conveniently. Poland.sm (16kb) downloaded 16 time(s).
|
|
|
|
Rank: Member Groups: Registered
Joined: 09/03/2010(UTC) Posts: 29 Location: Poland
Was thanked: 4 time(s) in 2 post(s)
|
Thank you for both your answers. It clarified the situation. However I think if something looks like matrix it should behave like one. But it is not. The history of building a matrix affects it And I treat it as a flaw. error_matrices_notequal.sm (9kb) downloaded 14 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,985 Was thanked: 1124 time(s) in 721 post(s)
|
The flaw is that m is not evaluated before applying the by-element assignment. you can, however, enforce this by setting the previous two assignments to numeric optimization in the context menu.
This complies to the survival rule "never use symbolic optimization unless you know what you are doing".
|
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: mkraska This complies to the survival rule "never use symbolic optimization unless you know what you are doing". Can't be more right Martin ! I vote for default calculation Numeric, instead of Symbolic.
|
|
|
|
Rank: Member Groups: Registered
Joined: 09/03/2010(UTC) Posts: 29 Location: Poland
Was thanked: 4 time(s) in 2 post(s)
|
Originally Posted by: mkraska The flaw is that m is not evaluated before applying the by-element assignment. you can, however, enforce this by setting the previous two assignments to numeric optimization in the context menu.
Your solution works, it was enough to set it for first assignment. I have to comment it in code at least. Thank you. However I am programmer and for program to be clear everything shall be set in a visible manner (in code). So fiddling with some options in context menu instead of setting them by code is unacceptable.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: m227 So fiddling with some options in context menu instead of setting them by code is unacceptable. A collection is just a collection. A matrix supports all matrix operation for concluding a project Generally, a matrix results from the project itself Smath works by itself, not from invented not compatible code. Please be more specific about what you are attempting.
|
|
|
|
Rank: Member Groups: Registered
Joined: 09/03/2010(UTC) Posts: 29 Location: Poland
Was thanked: 4 time(s) in 2 post(s)
|
(...) Originally Posted by: Jean Giraud Please be more specific about what you are attempting.
First of all, I want to say, that I like SMath Studio very much and I use it, whenever I have to prepare some calculations for students or in my projects. I once was co-author of book covering exercises in Mathcad. SMath studio is small, uncluttered and (mostly) does what is expected to do. And is free so I don't have to manage licenses, take care of keys and so on. I once paid some bucks to the author and gladly repeat it as program gets better. But coming back to my being more specific: If I see matrix in the code (not necessarily mine) I expect it to behave like matrix and that's all. Let's assume I got quite large project which can also reference to other files by include("..." ) add-in. So I have two matrices in front of me (see screenshot). I want to change a single element in each of them. Shall I go back and read all the code before to check if it can be done? The general question is: if we have two identical looking chairs shall we expect one of them not to be a chair but a briefcase with a chair in it? Edited by user 26 March 2018 15:00:23(UTC)
| Reason: Not specified
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: m227 So I have two matrices in front of me (see screenshot) Your original 'm' is a matrix. Your concluded 'm' is NOT a matrix, simply a collection. You can't apply any matrix calculation. Make it a matrix and continue the project.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,985 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: m227 [ However I am programmer and for program to be clear everything shall be set in a visible manner (in code). So fiddling with some options in context menu instead of setting them by code is unacceptable.
You might vote for https://smath.info/bts/I...s/IssueDetail.aspx?id=19. This feature request is exactly tailored to your need. It is a long standing issue with second highest voter rate ever, yet no sign of hope out there... Yet I encourage all users to file bug reports instead or at least in addition to forum posts on bugs, because forum discussions rapidly fade out of sight, whereas the bug tracking system is transparent and user friendly. I did that already for now, see SS 3525. And SS-19 is not typical for the responsiveness of the developers, sometimes you get the fix within hours. Edited by moderator 27 March 2018 12:15:26(UTC)
| Reason: Not specified |
|
1 user thanked mkraska for this useful post.
|
|
|
Rank: Member Groups: Registered
Joined: 09/03/2010(UTC) Posts: 29 Location: Poland
Was thanked: 4 time(s) in 2 post(s)
|
Originally Posted by: Jean Giraud Originally Posted by: m227 So I have two matrices in front of me (see screenshot) Your original 'm' is a matrix. Your concluded 'm' is NOT a matrix, simply a collection. (...) Ok, but you probably agree that they look the same when displayed. So I think there is a problem that they are not distinguishable (by looking at them) as long as you don't make any operation on each one.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/03/2009(UTC) Posts: 433 Location: USA Was thanked: 17 time(s) in 15 post(s)
|
I'm wondering, are you looking for an array to display differently than a matrix? I had an issue reviewing a sheet where this would have helped. In Mathcad, an array looks like an spreadsheet while a matrix looks just like it does now
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: m227 Ok, but you probably agree that they look the same when displayed. Sorry, but can't help more. You must have projects that produce something.
|
|
|
|
Rank: Member Groups: Registered
Joined: 09/03/2010(UTC) Posts: 29 Location: Poland
Was thanked: 4 time(s) in 2 post(s)
|
Originally Posted by: ElSid I'm wondering, are you looking for an array to display differently than a matrix? I had an issue reviewing a sheet where this would have helped. In Mathcad, an array looks like an spreadsheet while a matrix looks just like it does now I wouldn't care if they were the same thing. But they aren't. Probably Mathcad approach would have helped.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: m227 I'm wondering, are you looking for an array to display differently than a matrix?I had an issue reviewing a sheet where this would have helped.In Mathcad, an array looks like an spreadsheet while a matrix looks just like it does now I understand nothing w/o the problem sheet. CellArray.sm (10kb) downloaded 16 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/03/2009(UTC) Posts: 433 Location: USA Was thanked: 17 time(s) in 15 post(s)
|
Here you go Jean. Is this a bug or a feature? Array or vector.sm (26kb) downloaded 21 time(s).
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
[SS-3525] assigning element to matrix resets its size
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.