Problem with length() command

Problem with length() command - Messages

#1 Posted: 5/28/2012 4:34:39 AM
ska109

ska109

0 likes in 2 posts.

Group: 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 Posted: 5/28/2012 5:01:40 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: 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 Posted: 6/17/2012 7:31:07 AM
ska109

ska109

0 likes in 2 posts.

Group: 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 Posted: 6/17/2012 7:48:35 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: 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 Posted: 6/17/2012 8:46:45 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: 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
  • New Posts New Posts
  • No New Posts No New Posts