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. - 消息

#1 已发布: 2019/8/16 12:18:08
manti7

manti7

0个赞,共2个帖子。

组: 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.57 KiB)已下载 1191 次。
#2 已发布: 2019/8/16 14:05:19
CBG

CBG

78个赞,共312个帖子。

组: User

Maybe this is a simple way to solve the problem

Matrix_nested_function.png

matrix_nested_function_CBG.sm (11.45 KiB)已下载 1172 次。

Best Regards

Carlos
#3 已发布: 2019/8/16 14:07:39
Arie

Arie

94个赞,共285个帖子。

组: User

Can eval input to f() as such

Untitled.png
matrix_nested_function_alyles.sm (12 KiB)已下载 1220 次。
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#4 已发布: 2019/8/16 14:50:18
manti7

manti7

0个赞,共2个帖子。

组: 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 已发布: 2019/8/16 16:51:54
Jean Giraud

Jean Giraud

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

组: 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 已发布: 2019/8/16 16:55:56
Jean Giraud

Jean Giraud

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

组: User

... some stuff Truth table

Utilities Matrix Truth Table [Locate row_col].sm (43.39 KiB)已下载 1053 次。
  • 有新帖
  • 无新帖