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

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline manti7  
#1 Posted : 16 August 2019 18:18:08(UTC)
manti7

Rank: Newbie

Groups: Registered
Joined: 23/06/2019(UTC)
Posts: 2
Germany

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 (12kb) downloaded 5 time(s).

Edited by user 16 August 2019 19:45:23(UTC)  | Reason: Not specified

Offline CBG  
#2 Posted : 16 August 2019 20:05:19(UTC)
CBG


Rank: Advanced Member

Groups: Registered
Joined: 14/10/2015(UTC)
Posts: 217

Was thanked: 44 time(s) in 32 post(s)
Maybe this is a simple way to solve the problem

Matrix_nested_function.png

matrix_nested_function_CBG.sm (12kb) downloaded 3 time(s).

Best Regards

Carlos
Offline alyles  
#3 Posted : 16 August 2019 20:07:39(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 191
United States

Was thanked: 65 time(s) in 41 post(s)
Can eval input to f() as such

Untitled.png
matrix_nested_function_alyles.sm (13kb) downloaded 6 time(s).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline manti7  
#4 Posted : 16 August 2019 20:50:18(UTC)
manti7

Rank: Newbie

Groups: Registered
Joined: 23/06/2019(UTC)
Posts: 2
Germany

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.
Offline Jean Giraud  
#5 Posted : 16 August 2019 22:51:54(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 3,887
Canada

Was thanked: 699 time(s) in 547 post(s)
Originally Posted by: manti7 Go to Quoted Post
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
Offline Jean Giraud  
#6 Posted : 16 August 2019 22:55:56(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 3,887
Canada

Was thanked: 699 time(s) in 547 post(s)
... some stuff Truth table

Utilities Matrix Truth Table [Locate row_col].sm (44kb) downloaded 7 time(s).
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.