[SS-3525] assigning element to matrix resets its size

[SS-3525] assigning element to matrix resets its size - matrix created artificially - Сообщения

#1 Опубликовано: 21.03.2018 20:28:13
m227

m227

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

Группа: User

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
#2 Опубликовано: 22.03.2018 01:04:56
Jean Giraud

Jean Giraud

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

Группа: User

Just like this.

sub.PNG
#3 Опубликовано: 22.03.2018 01:49:29
CBG

CBG

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

Группа: User

Something like this?


Ass_elem_Matrix.png


Ass_elem_Matrix.sm (4 КиБ) скачан 39 раз(а).


Best regards


Carlos
#4 Опубликовано: 22.03.2018 07:57:51
m227

m227

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

Группа: User

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
#5 Опубликовано: 22.03.2018 08:08:01
Martin Kraska

Martin Kraska

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

Группа: Moderator

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 (5 КиБ) скачан 42 раз(а).
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
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
2 пользователям понравился этот пост
Davide Carpi 22.03.2018 08:16:00, sergio 22.03.2018 09:00:00
#6 Опубликовано: 22.03.2018 10:21:30
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Ok, I probably did not clarify my real needs.


That will handle your projects more conveniently.

AugmentMatrix.PNG

Poland.sm (15 КиБ) скачан 41 раз(а).

#7 Опубликовано: 24.03.2018 15:39:26
m227

m227

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

Группа: User

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 (8 КиБ) скачан 37 раз(а).
#8 Опубликовано: 24.03.2018 19:01:20
Martin Kraska

Martin Kraska

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

Группа: Moderator

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://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#9 Опубликовано: 25.03.2018 17:02:23
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

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.
#10 Опубликовано: 26.03.2018 05:10:28
m227

m227

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

Группа: User

Wrote

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.
#11 Опубликовано: 26.03.2018 08:22:01
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

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
#12 Опубликовано: 26.03.2018 08:55:23
m227

m227

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

Группа: User

(...)
Wrote


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
#13 Опубликовано: 26.03.2018 11:23:55
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

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
#14 Опубликовано: 26.03.2018 12:29:20
Martin Kraska

Martin Kraska

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

Группа: Moderator

Wrote

[
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/Issues/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.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
Davide Carpi 27.03.2018 06:15:00
#15 Опубликовано: 27.03.2018 06:06:23
m227

m227

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

Группа: User

Wrote

Wrote

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.
#16 Опубликовано: 27.03.2018 08:17:35
Ruben Sidranski

Ruben Sidranski

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

Группа: User

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
#17 Опубликовано: 27.03.2018 09:27:25
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

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.
#18 Опубликовано: 27.03.2018 11:23:11
m227

m227

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

Группа: User

Wrote

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.
#19 Опубликовано: 27.03.2018 19:14:07
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

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 (9 КиБ) скачан 41 раз(а).
#20 Опубликовано: 27.03.2018 19:42:24
Ruben Sidranski

Ruben Sidranski

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

Группа: User

Here you go Jean.
Is this a bug or a feature? Array or vector.sm (25 КиБ) скачан 44 раз(а).
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений