Defining "2:vector" for roots() function Using Submatrix() function

Defining "2:vector" for roots() function Using Submatrix() function - Syntax error while solving roots() function - Messages

#1 Posted: 3/3/2022 1:55:28 AM
GabeJ112

GabeJ112

0 likes in 4 posts.

Group: User

Hello,

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 (5 KiB) downloaded 28 time(s).

Thanks for the help!
#2 Posted: 3/3/2022 4:46:28 AM
fedeghi

fedeghi

25 likes in 112 posts.

Group: User

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 (7 KiB) downloaded 30 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

Bye
#3 Posted: 3/3/2022 11:06:12 PM
overlord

overlord

547 likes in 1330 posts.

Group: Moderator

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.

Regards

2022-03-04_04-57.png
  • New Posts New Posts
  • No New Posts No New Posts