Remove zero rows and columns from a matrix

Remove zero rows and columns from a matrix - 消息

#1 已发布: 2021/4/19 22:44:50
Rodolfo Cruz Vargas

Rodolfo Cruz Vargas

0个赞,共1个帖子。

组: User

Hello
I am new to the use of Smath Studio, and I started by calculating the solution of a frame through the method of rigidities, the issue is that when carrying out the calculations I need to calculate a reduced matrix. For this I need to remove the rows and columns that contain zeros. I use the following function but it gives me an error, someone knows how to solve it

foro.png
#2 已发布: 2021/4/20 02:59:54
overlord

overlord

600个赞,共1,381个帖子。

组: Moderator

Wrote

Hello
I am new to the use of Smath Studio, and I started by calculating the solution of a frame through the method of rigidities, the issue is that when carrying out the calculations I need to calculate a reduced matrix. For this I need to remove the rows and columns that contain zeros. I use the following function but it gives me an error, someone knows how to solve it


I don't know if there is a ready function but you can use the one I wrote myself.
You can either remove zero rows and columns manually or with a function.
With posted function you can not perform removal if matrix elements are text.

Regards

removezeros.sm (11.71 KiB)已下载 1226 次。

removezeros.png
1位用户喜欢此帖子
Andrey Ivashov 2021/4/20 05:39:00
#3 已发布: 2021/4/20 04:47:25
sergio

sergio

127个赞,共342个帖子。

组: User

Overlord forgot to tell you that the two functions it used in its function, as well as the one you used to no avail (nonZeroRorwsCols (R)), is part of an external plugin (MatrixExtensions). Could it be that you haven't loaded the plugin? because it works correctly for me.
Until recently I myself did not know its existence since here in the forum (in English) I do not think it is reviewed. Maybe it is in the Russian-language forum.
SMathStudio_Desktop_E4l6s0W15L.png
sergio
1位用户喜欢此帖子
Andrey Ivashov 2021/4/20 05:39:00
#4 已发布: 2021/4/20 08:30:53
NDTM Amarasekera

NDTM Amarasekera

130个赞,共352个帖子。

组: User

Function 'nonZerosRowsCols".
I get an error and invalid answers as shown, apparently when some non-zero values have decimals.

nonZerosRowsCols.png
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
#5 已发布: 2021/4/20 08:42:13
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

... for that particular example.

Minor.PNG
#6 已发布: 2021/4/20 09:09:51
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: Moderator

Another way

rmEmptyRC.sm (7.02 KiB)已下载 1277 次。

2021-04-20 16_02_29-SMath Studio - [rmEmptyRC.sm].png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#7 已发布: 2021/4/20 10:12:50
sergio

sergio

127个赞,共342个帖子。

组: User

attention Davide, in the first 'if' one of the two 'max' is a 'min'

sergio

OK has been corrected (do not consider this message)

sergio
1位用户喜欢此帖子
Davide Carpi 2021/4/20 11:03:00
#8 已发布: 2021/4/20 11:08:17
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: Moderator

Wrote

attention Davide, in the first 'if' one of the two 'max' is a 'min'

sergio



TY, updated. Just shown the idea to have it working using the built-in features.





If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#9 已发布: 2021/4/20 13:01:58
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

... alternately: brute force works well.
It has very many applications for purpose.
Take care all Collabs ... Jean

Page28 BruteForce.sm (13.19 KiB)已下载 1520 次。
#10 已发布: 2021/4/20 17:02:18
Alvaro

Alvaro

1,139个赞,共1,805个帖子。

组: User

Hi. normi (infinitum norm) take the maximum of the absolute values of a matrix. max and min are defined only for reals, but a version with normi will work with complex numbers too. With the technique from Davide applied to the overlod method, it works also for empty answers.

Clipboard02.jpg

rmEmptyRC.sm (8.78 KiB)已下载 1306 次。

Best regards.
Alvaro.
1位用户喜欢此帖子
sergio 2021/4/21 06:39:00
  • 有新帖
  • 无新帖