Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline RFreund  
#1 Posted : 21 September 2022 21:40:35(UTC)
RFreund


Rank: Advanced Member

Groups: Registered
Joined: 25/09/2013(UTC)
Posts: 315
United States
Location: IL

Was thanked: 18 time(s) in 16 post(s)
How can I remove a row or column from a matrix while keeping all assigned units to the elements in the matrix.

For example let's say that I have a matrix with the first column containing all text, the next column contains numbers with units of inches, and the next column has units of pounds. I want to create a new matrix but I want the entire 3rd row removed. I also want to keep the appearance of the units (i.e. text, inches, lbs).
Is this possible?

Thanks!
Offline overlord  
#2 Posted : 22 September 2022 01:21:22(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 829
Turkey

Was thanked: 290 time(s) in 204 post(s)
Originally Posted by: RFreund Go to Quoted Post
How can I remove a row or column from a matrix while keeping all assigned units to the elements in the matrix.

Well you can't show it with conventional ways if it contains string column.
I am not sure if it is possible when a string column is absent if it has mixed units.
However, you can use a table region to show your new matrix.
Not an ideal solution, but it is what we can have.

Regards

2022-09-22_01-20.png
Offline Davide Carpi  
#3 Posted : 22 September 2022 13:02:40(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,516
Man
Italy
Location: Italy

Was thanked: 1260 time(s) in 829 post(s)
Something like this?

rmRows_rmCols.sm (36kb) downloaded 9 time(s).
2022-09-22 12_01_13-SMath Solver - [rmRows_rmCols.sm].png
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline PompelmoTell  
#4 Posted : 22 September 2022 17:16:00(UTC)
PompelmoTell


Rank: Advanced Member

Groups: Registered
Joined: 23/12/2011(UTC)
Posts: 305
Man
Italy
Location: italy

Was thanked: 105 time(s) in 89 post(s)
I believe that rfreund wanted to keep the units of measurement set. I take Davide's solution and I add a trick (I think he had been offered by Overlord or Razonar or perhaps from both).
However, I still have to solve for the strings. Furthermore, if we cancel the columns instead of the lines we should build the units of measurement of the matrix resulting with the same method.
rmRows_rmCols_units.sm (16kb) downloaded 10 time(s).
sergio
Offline overlord  
#5 Posted : 23 September 2022 01:14:03(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 829
Turkey

Was thanked: 290 time(s) in 204 post(s)
Originally Posted by: PompelmoTell Go to Quoted Post
I believe that rfreund wanted to keep the units of measurement set. I take Davide's solution and I add a trick (I think he had been offered by Overlord or Razonar or perhaps from both).
However, I still have to solve for the strings. Furthermore, if we cancel the columns instead of the lines we should build the units of measurement of the matrix resulting with the same method.

I first see usage of diag() for units by Razonar, then just wrote it as in your example.
Another way is using pseudo units, but this is also not interchangeable.
Again, these are not conventional ways. Just holding your left ear with your right hand.
And there is no solution for string column I guess.

Regards

matrix mixed units.sm (10kb) downloaded 5 time(s).

2022-09-23_00-39.png
Offline mkraska  
#6 Posted : 23 September 2022 10:26:49(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 955 time(s) in 606 post(s)
One might use vector-valued indices.

rmRows_rmCols_Kr.sm (8kb) downloaded 6 time(s).
rmRows_rmCols_Kr.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline overlord  
#7 Posted : 23 September 2022 14:55:30(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 829
Turkey

Was thanked: 290 time(s) in 204 post(s)
All you missing some points of Rfreund's question, except Sergio.
He asked for a string column, an inch column and a pound column.
And showing result matrix as written. This is the tricky part.
Not removing rows of an ordinary matrix with SI units.
He specifically asked removing a row of mixed non-SI units matrix.
And displaying it with non-SI units.
Offline overlord  
#8 Posted : 23 September 2022 16:32:58(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 829
Turkey

Was thanked: 290 time(s) in 204 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
That will reduce the fractal replies.

It is clear what Rfreund has asked, no need to upload an smath file.
Take this matrix, remove its third row, make it look like as intended.
With its string and non-SI columns displayed as they are.

2022-09-23_16-32.png
Offline mkraska  
#9 Posted : 24 September 2022 11:56:56(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 955 time(s) in 606 post(s)
Originally Posted by: overlord Go to Quoted Post
All you missing some points of Rfreund's question, except Sergio.
He asked for a string column, an inch column and a pound column.
And showing result matrix as written. This is the tricky part.
Not removing rows of an ordinary matrix with SI units.
He specifically asked removing a row of mixed non-SI units matrix.
And displaying it with non-SI units.


So the topic is "display of matrices in non-default units". No idea if the presence of strings is relevant for the problem.

This question is another vote for a function defaultUnit(u).

This function would be inserted wherever appropriate in a document.

An option to set the default units by document or system-wide in the units dialog would be helpful. Otherwise, we will see many documents starting with blocks of unit settings. Yet, still the above-mentioned function would be required, because at different places in a document you might need different settings.

units6.png

Of course, if you want to mix different units of the same quantity, then setting the default unit would not help either.
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline overlord  
#10 Posted : 24 September 2022 13:56:57(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 829
Turkey

Was thanked: 290 time(s) in 204 post(s)
Originally Posted by: mkraska Go to Quoted Post
No idea if the presence of strings is relevant for the problem.

This is how it is relevant, somehow you can view your matrix with method I have showed.
But if matrix contains a string column, the sample below won't work too.
That's what Rfreund asked I guess, string and mixed units columns viewing.

Regards

2022-09-24_13-53.png
Offline Jean Giraud  
#11 Posted : 24 September 2022 15:34:28(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 910 time(s) in 738 post(s)
MixedUnits.PNG
Offline mkraska  
#12 Posted : 25 September 2022 00:20:23(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 955 time(s) in 606 post(s)
Originally Posted by: overlord Go to Quoted Post
Originally Posted by: mkraska Go to Quoted Post
No idea if the presence of strings is relevant for the problem.

This is how it is relevant, somehow you can view your matrix with method I have showed.
But if matrix contains a string column, the sample below won't work too.
That's what Rfreund asked I guess, string and mixed units columns viewing.

Regards



Thanks for clarification. Perhaps overloading the multiply operator to strings could help then, but that is probably too far-fetched. 1*"a"="a", 2*"a"="aa".
For now I just stick with displaying individual columns with custom units instead of whole matrices or in rare cases I use tables.
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline loha  
#13 Posted : 25 September 2022 08:47:33(UTC)
loha


Rank: Advanced Member

Groups: Registered
Joined: 13/09/2011(UTC)
Posts: 57
Location: Kolkata

Was thanked: 7 time(s) in 7 post(s)
Fascinating catalog of examples!
Thanks to all!
That all these neat and concise writings are possible really show how brilliant Smath is as a software!
Users browsing this topic
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.