Problem with length() command

Problem with length() command - 消息

#1 已发布: 2012/5/28 04:34:39
ska109

ska109

0个赞,共2个帖子。

组: User

Hi, I have a problem using length() commang.

If used on matrix, it works well, but using the length() command on scalar value (which is, I think, matrix of size 1 by 1), it doesn't work well.

length problem

File with this problem: length_problem.sm.
#2 已发布: 2012/5/28 05:01:40
Radovan Omorjan

Radovan Omorjan

325个赞和1个踩,共2,052个帖子。

组: Moderator

Hello,

You get the last math region [MATH=eng]lx_1=length(-1)[/MATH]. If yoo would use numerical equal to, there would be an error issued.
And, no - scalar is not a matrix of size 1 by 1.

Regards,
Rdaovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 已发布: 2012/6/17 07:31:07
ska109

ska109

0个赞,共2个帖子。

组: User

Hello,
thank you for your reply. Is trere any other way (instead of using "length()" command) how to find out the number of solutions of the equation?

Thank you for amazing SMath,
kind regards
Jan Skapa



Wrote


Hello,

You get the last math region [MATH=eng]lx_1=length(-1)[/MATH]. If yoo would use numerical equal to, there would be an error issued.
And, no - scalar is not a matrix of size 1 by 1.

Regards,
Rdaovan



#4 已发布: 2012/6/17 07:48:35
Radovan Omorjan

Radovan Omorjan

325个赞和1个踩,共2,052个帖子。

组: Moderator

Hello,
Wrote

Is trere any other way (instead of using "length()" command) how to find out the number of solutions of the equation?


Could you be more specific, please?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#5 已发布: 2012/6/17 08:46:45
Davide Carpi

Davide Carpi

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

组: Moderator

Hi,

I don't see your file therefore I'm not sure, but I think that this snippet can help you:

varManager.zip

EDIT(1): now i can see your file

use it in this way:
[MATH]x_1:ToArray(x_1)[/MATH]

EDIT(2): instead of [MATH]x_1:ToArray(x_1)[/MATH] you can use [MATH]x_1:stack(x_1)[/MATH]

(x_1 can be an array, a scalar or a text)

then you can use:
[MATH]length(x_1)[/MATH]


regards,

w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • 有新帖
  • 无新帖