Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


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 7 time(s).

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

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

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


Rank: Advanced Member

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

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

Matrix_nested_function.png

matrix_nested_function_CBG.sm (12kb) downloaded 5 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: 275
United States

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

Untitled.png
matrix_nested_function_alyles.sm (13kb) downloaded 8 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: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 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: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
... some stuff Truth table

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