Type conversion error - Min() function

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

#1 已发布: 2014/12/7 15:28:00
Ryan Freund

Ryan Freund

20个赞,共339个帖子。

组: 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.29 KiB)已下载 1368 次。
#2 已发布: 2014/12/7 17:53:48
brotjob

brotjob

7个赞,共71个帖子。

组: 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 已发布: 2014/12/7 20:57:41
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: 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 已发布: 2014/12/7 21:12:58
Ryan Freund

Ryan Freund

20个赞,共339个帖子。

组: 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 已发布: 2014/12/7 21:51:36
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: 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
  • 有新帖
  • 无新帖