Type conversion error - Min() function

Type conversion error - Min() function - comparing matrix to non-matrix value - Messages

#1 Posted: 12/7/2014 3:28:00 PM
Ryan Freund

Ryan Freund

19 likes in 339 posts.

Group: User

See attached file.

For some reason if you have a normal value call it NV and a value in a 1x1 matrix, you recieve odd type conversion erros when you try to compare them using Min, Max, etc.... maybe though I don't understand why?

i.e Min(NM-M1x1, M1x1) = receive error


Type conversion error - 1x1 Matrix.sm (7 KiB) downloaded 64 time(s).
#2 Posted: 12/7/2014 5:53:48 PM
brotjob

brotjob

7 likes in 71 posts.

Group: User

I think Smath is handling this in a general style. You can't do min() on two matrices because matrices don't have a size you could compare. You can do min(det(MatrixA);det(MatrixB )) but anyway you compare scalars. In other words I am surprised that Min(2*'in,mat(8*'in,1,1)) works but not that Min(12*'in-mat(2*'in,1,1),mat(8*'in,1,1)) doesn't. I am an engineer and as such try to avoid matrices. Keep it simple where you can.
#3 Posted: 12/7/2014 8:57:41 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

I know this issue.

There are several small drawbacks working with preprocessing and pure low-level functions; the main problem is to recognize if the argument is a number, a matrix or a system and sometimes the preprocessing/symbolic calculation doesn't output the matrix/system as outer element. This is one of the cases.

I'm trying to find an easy solution (in the end a custom preprocessing function) but there are several things to consider, and obviously requires a little bit of time.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#4 Posted: 12/7/2014 9:12:58 PM
Ryan Freund

Ryan Freund

19 likes in 339 posts.

Group: User

I see, thanks for the comments. I too am an engineer and mostly only use the matrices for 'data storage' in scripts. So I tend to forget or miss-understand how Smath is treating such items.

Thanks for the comments. So I guess in general I should probably try to avoid having 1x1 matrices.
#5 Posted: 12/7/2014 9:51:36 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

You're welcome. This is just a problem of plugins and preprocessing. If calculations are made outside the function (not in the argument placeholder) you should skip these issues.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • New Posts New Posts
  • No New Posts No New Posts