Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


2 Pages12>
Options
Go to last post Go to first unread
Offline m227  
#1 Posted : 22 March 2018 02:28:13(UTC)
m227


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?
2018-03-22 00_22_13-SMath Studio - [error.sm_].png

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

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Jean Giraud  
#2 Posted : 22 March 2018 07:04:56(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Just like this.

sub.PNG
Offline CBG  
#3 Posted : 22 March 2018 07:49:29(UTC)
CBG


Rank: Advanced Member

Groups: Registered
Joined: 14/10/2015(UTC)
Posts: 308

Was thanked: 77 time(s) in 58 post(s)
Something like this?


Ass_elem_Matrix.png


Ass_elem_Matrix.sm (5kb) downloaded 18 time(s).


Best regards


Carlos
Offline m227  
#4 Posted : 22 March 2018 13:57:51(UTC)
m227


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.

2018-03-22 11_54_49-SMath Studio - [error.sm_].png
Offline mkraska  
#5 Posted : 22 March 2018 14:08:01(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,985
Germany

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).
2018-03-22 12_06_51-SMath Studio - [Ass_elem_Matrix.sm_].png
2018-03-22 12_11_02-SMath Studio - [Ass_elem_Matrix_Kr.sm_].png

Edited by user 22 March 2018 14:12:29(UTC)  | Reason: Not specified

Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 2 users thanked mkraska for this useful post.
on 22/03/2018(UTC),  on 22/03/2018(UTC)
Offline Jean Giraud  
#6 Posted : 22 March 2018 16:21:30(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: m227 Go to Quoted Post
Ok, I probably did not clarify my real needs.

That will handle your projects more conveniently.

AugmentMatrix.PNG

Poland.sm (16kb) downloaded 16 time(s).

Offline m227  
#7 Posted : 24 March 2018 21:39:26(UTC)
m227


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.
2018-03-24 19_36_00-SMath Studio - [error.sm].png
error_matrices_notequal.sm (9kb) downloaded 14 time(s).
Offline mkraska  
#8 Posted : 25 March 2018 01:01:20(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,985
Germany

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".

Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Jean Giraud  
#9 Posted : 25 March 2018 23:02:23(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: mkraska Go to Quoted Post
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.
Offline m227  
#10 Posted : 26 March 2018 11:10:28(UTC)
m227


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 Go to Quoted Post
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.
Offline Jean Giraud  
#11 Posted : 26 March 2018 14:22:01(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: m227 Go to Quoted Post
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.

MatrixCollection.PNG
Offline m227  
#12 Posted : 26 March 2018 14:55:23(UTC)
m227


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 Go to Quoted Post

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?
2018-03-26 13_50_18-SMath Studio - [error_matrices_notequal.sm_].png

Edited by user 26 March 2018 15:00:23(UTC)  | Reason: Not specified

Offline Jean Giraud  
#13 Posted : 26 March 2018 17:23:55(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: m227 Go to Quoted Post
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.

MakeMatrix.PNG
Offline mkraska  
#14 Posted : 26 March 2018 18:29:20(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,985
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: m227 Go to Quoted Post
[
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

Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 27/03/2018(UTC)
Offline m227  
#15 Posted : 27 March 2018 12:06:23(UTC)
m227


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 Go to Quoted Post
Originally Posted by: m227 Go to Quoted Post
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.
Offline ElSid  
#16 Posted : 27 March 2018 14:17:35(UTC)
ElSid


Rank: Advanced Member

Groups: Registered
Joined: 05/03/2009(UTC)
Posts: 433
Man
United States
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
Offline Jean Giraud  
#17 Posted : 27 March 2018 15:27:25(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: m227 Go to Quoted Post
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.
Offline m227  
#18 Posted : 27 March 2018 17:23:11(UTC)
m227


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 Go to Quoted Post
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.
Offline Jean Giraud  
#19 Posted : 28 March 2018 01:14:07(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: m227 Go to Quoted Post
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).
Offline ElSid  
#20 Posted : 28 March 2018 01:42:24(UTC)
ElSid


Rank: Advanced Member

Groups: Registered
Joined: 05/03/2009(UTC)
Posts: 433
Man
United States
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).
Users browsing this topic
2 Pages12>
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.