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 RFreund  
#1 Posted : 21 September 2022 21:40:35(UTC)
RFreund


Rank: Advanced Member

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

Was thanked: 19 time(s) in 17 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!

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

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


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,125
Turkey

Was thanked: 506 time(s) in 337 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,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
Something like this?

rmRows_rmCols.sm (36kb) downloaded 13 time(s).
2022-09-22 12_01_13-SMath Solver - [rmRows_rmCols.sm].png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: 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: 318
Man
Italy
Location: italy

Was thanked: 109 time(s) in 93 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 12 time(s).
sergio
thanks 1 user thanked PompelmoTell for this useful post.
on 15/11/2022(UTC)
Offline overlord  
#5 Posted : 23 September 2022 01:14:03(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,125
Turkey

Was thanked: 506 time(s) in 337 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 7 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,980
Germany

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

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

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline overlord  
#7 Posted : 23 September 2022 14:55:30(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,125
Turkey

Was thanked: 506 time(s) in 337 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: 1,125
Turkey

Was thanked: 506 time(s) in 337 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,980
Germany

Was thanked: 1120 time(s) in 718 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://smath.com/wiki/SMath_with_Plugins.ashx
Offline overlord  
#10 Posted : 24 September 2022 13:56:57(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,125
Turkey

Was thanked: 506 time(s) in 337 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
thanks 1 user thanked overlord for this useful post.
on 14/11/2022(UTC)
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,868
Canada

Was thanked: 980 time(s) in 808 post(s)
MixedUnits.PNG
thanks 1 user thanked Jean Giraud for this useful post.
on 14/11/2022(UTC)
Offline mkraska  
#12 Posted : 25 September 2022 00:20:23(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1120 time(s) in 718 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://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 14/11/2022(UTC)
Offline loha  
#13 Posted : 25 September 2022 08:47:33(UTC)
loha


Rank: Advanced Member

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

Was thanked: 9 time(s) in 9 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!
Offline RFreund  
#14 Posted : 14 November 2022 20:49:45(UTC)
RFreund


Rank: Advanced Member

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

Was thanked: 19 time(s) in 17 post(s)
Thanks for all your efforts on this. Very impressive!

Also sorry for being ambiguous. My question really was twofold - First, can I simply remove a row or column and keep the assigned units. Second, can we do this with Text. Seems as though the answer is yes and no. Yes, you can remove the row or column, but no you cannot get it to display in non-SI units.

The table idea isn't bad, but I really like having more control over what units are displayed or are considered default.

Thanks again.

Edited by user 15 November 2022 00:32:19(UTC)  | Reason: I finally read the responses.

Offline Jean Giraud  
#15 Posted : 16 November 2022 14:51:17(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: RFreund Go to Quoted Post
Yes, you can remove the row or column, but no you cannot get it to display in non-SI units.

Smath is delivered with silent units or active SI ...
... silent units as required

Page4 Delete Col-Row.sm (16kb) downloaded 6 time(s).
Offline RFreund  
#16 Posted : 17 November 2022 05:04:59(UTC)
RFreund


Rank: Advanced Member

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

Was thanked: 19 time(s) in 17 post(s)
Martin - I didn't realize that you could use "vector-valued indices" to reorganize matrices. That might be useful to me in the future. Although I suppose using the submatrix function is pretty similar.

Jean - it took me a minute to understand "silent-units" as I thought the apostrophe in front of the unit solved the unit "display" issue. I guess it does if you only want it to "look correct". Thanks for your efforts.
Offline mkraska  
#17 Posted : 17 November 2022 14:20:36(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1120 time(s) in 718 post(s)
Originally Posted by: RFreund Go to Quoted Post
Martin - I didn't realize that you could use "vector-valued indices" to reorganize matrices. That might be useful to me in the future. Although I suppose using the submatrix function is pretty similar.



The index vector approach is more flexible, as it allows to pick arbitrary subsets of rows and columns instead of continuous ranges.

iv.sm (5kb) downloaded 8 time(s).
iv.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Jean Giraud  
#18 Posted : 17 November 2022 17:38:10(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: RFreund Go to Quoted Post
Jean - it took me a minute to understand "silent-units" as I thought the apostrophe in front of the unit solved the unit "display" issue. I guess it does if you only want it to "look correct". Thanks for your efforts.

Silent mode disables the SI unit sub-processor.
Don't miss visiting this great matrix shuffling utility.
Cheers ... Jean.

Utilities Matrix Shuffle.sm (13kb) downloaded 5 time(s).

Offline Jean Giraud  
#19 Posted : 17 November 2022 17:50:17(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 980 time(s) in 808 post(s)
... this clean version.

Utilities Matrix Shuffle.sm (15kb) downloaded 10 time(s).
Offline RFreund  
#20 Posted : 18 November 2022 06:59:14(UTC)
RFreund


Rank: Advanced Member

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

Was thanked: 19 time(s) in 17 post(s)
@Martin - Good point. I still don't know how I will use this feature, but I already see it being a little more difficult to use in some sort of function. Just seems like it lends itself to manual creation of the vector used in the indices, but I suppose you just need to be creative enough.
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.