vectorise() go to deep without first calculating the matrix product

vectorise() go to deep without first calculating the matrix product - I think it should multiply the matrices first and then apply the comparison per line. - Messages

#1 Posted: 8/16/2019 12:18:08 PM
manti7

manti7

0 likes in 2 posts.

Group: User

matrix_vectorize.JPG

I think the vectorize() command goes too deep in the example. Probably it takes the first row from the first matrix, then it probably tries to multiply it with the second vector. Then I get the error message: Number of rows and/or columns of matrices or vectors do not match.

I think it should multiply the matrices first and then apply the comparison per line.

Can somebody take a look at this, please?

matrix_nested_function.sm (11 KiB) downloaded 42 time(s).
#2 Posted: 8/16/2019 2:05:19 PM
CBG

CBG

77 likes in 312 posts.

Group: User

Maybe this is a simple way to solve the problem

Matrix_nested_function.png

matrix_nested_function_CBG.sm (11 KiB) downloaded 44 time(s).

Best Regards

Carlos
#3 Posted: 8/16/2019 2:07:39 PM
Arie

Arie

93 likes in 285 posts.

Group: User

Can eval input to f() as such

Untitled.png
matrix_nested_function_alyles.sm (12 KiB) downloaded 41 time(s).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#4 Posted: 8/16/2019 2:50:18 PM
manti7

manti7

0 likes in 2 posts.

Group: User

Thank you both for the quick answer! I didn't know there was an eval() function. I now understand that SMath resolves everything as low as possible and then calculates in one go. The use of eval() in the right place prevents this.
#5 Posted: 8/16/2019 4:51:54 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I think it should multiply the matrices first and then apply the comparison per line.


Maybe you complicate matters or not make it simpler from the truth table.

Vectorize.PNG
#6 Posted: 8/16/2019 4:55:56 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... some stuff Truth table

Utilities Matrix Truth Table [Locate row_col].sm (43 KiB) downloaded 46 time(s).
  • New Posts New Posts
  • No New Posts No New Posts