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



Go to last post Go to first unread
Offline GabeJ112  
#1 Posted : 03 March 2022 07:55:28(UTC)

Rank: Newbie

Groups: Registered
Joined: 25/02/2022(UTC)
Posts: 4
United States
Location: US


I have run into an issue with putting variables to use in the roots() function by sourcing said variables from a "bank" of variables using the submatrix() function.

The roots() function gives a "syntax error" because it does not recognize variables pulled from a larger matrix.

rootsfunction.sm (6kb) downloaded 7 time(s).

Thanks for the help!
Offline fedeghi  
#2 Posted : 03 March 2022 10:46:28(UTC)

Rank: Advanced Member

Groups: Registered
Joined: 14/09/2013(UTC)
Posts: 87

Was thanked: 22 time(s) in 15 post(s)
Hi, I remember I ran in similar problem and couldn't figure out what was happening..
Maybe our PRO users and developers will find the reason.

On the other hand if submatrix is not going to work properly, you could use the "range" syntax to extract the desired submatrix elements. This "ranged" syntax asks more or less the same kind of parameters, and it will work.

I suggest to take a look at remarkable mkraska handbook: there are some other examples that show how to handle matrix and submatrix just playing with ranges and vectors in the matrix indexes.
See screenshot of his submatrix help page, so that you don't need to dig into the handbook right now.
Immagine 2022-03-03 084316.png

With this different approach, your sm file is going to work properly

rootsfunction-2.sm (8kb) downloaded 9 time(s).

Now something which maybe will be a hint for developers (hopefully).
I wanted to see what the result of submatrix looked like in a different way, so I tried to convert it to a system.
I'm getting a quite unexpected result indeed.
If i convert my var.3 with same approach, I obtain a regular "clean" system.
Hope this does help
Immagine 2022-03-03 085827.png


Edited by user 03 March 2022 11:01:39(UTC)  | Reason: added mat2sys check

Offline overlord  
#3 Posted : 04 March 2022 05:06:12(UTC)

Rank: Advanced Member

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

Was thanked: 290 time(s) in 204 post(s)
When submatrix() is converted to and from string, it works.
Can it be the string decode bug (TermsConverter.DecodeText)?
Submatrix is an embedded command, I couldn't check it.


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.