Underscore in variable name causes "not defined" - Messages
Using a variable name with a space character (which is entered by pressing the _ underscore key), I got an error:

Notice that the tooltip mentions variable "D" instead of "D t". If I remove the space from all instances of the variable name "D t", then P is correctly shown as 3.3333
If I have left more steps in the SMath worksheet than the minimum it takes to show the problem, please bear with me - I based the example on something I was doing for my job.
Here is the .sm file.
Of course, I can keep spaces out of my variable names for now, but maybe something can be changed in future versions of SMath Studio to allow variables to be evaluated that depend on other variables that have spaces in their names.
I wonder if a possible solution would include keeping underscore keypresses as underscore characters in variable names. This is really a separate feature request, but it is related closely enough that I thought it was OK to put in the same forum posting.
Thanks in advance for comment.
WroteI wonder if a possible solution would include keeping underscore keypresses as underscore characters in variable names. This is really a separate feature request, but it is related closely enough that I thought it was OK to put in the same forum posting.
I think that using underscore producing white space should be avoided at the moment. Some other people reported the same thing. However, there are other more exotic characters you can use into a variable name. Underscore as a regular character in the variable name might be useful, but I think there are some restrictions due to the internal SMath working. Andrey might give you a more precise answer.
Regards,
Radovan
EDIT: BTW, see please how the undefined D t variable made a mess into your worksheet:
If the D t variable have had a numerical value before its using, it would not be such a problem:
Also, if you just try to copy D t variable or a part of the region where such a variable exists, you will again make a mess (the characters will be overlapped)
Wrotesee please how the undefined D t variable made a mess into your worksheet:
If the D t variable have had a numerical value before its using, it would not be such a problem:
Also, if you just try to copy D t variable or a part of the region where such a variable exists, you will again make a mess (the characters will be overlapped)
I made this sample worksheet in an attempt to have multiple scenarios on the same worksheet, as discussed in the hints about user functions section of the Wiki. This requires defining a variable or function before the variables on which it depends ('D_t' in my example, 'a' in the Wiki example) are defined.
So I think the 2 display issues you mention in the quote above may need to be fixed in SMath Studio.
See also Crashes.
It seems, "_" will produce a space in the variable name but the underscore in the defined function name.
[LIVE width=282 height=275]http://smath.info/live/?file=1243[/LIVE]
Should it be this way?
On the other hand, I do not know how to copy a region in "Live" mode (I think this is not possible - not sure) in order to see if the underscore would make a mess in the copied math region.
Regards,
Radovan
WroteIt seems, "_" will produce a space in the variable name but the underscore in the defined function name.
...
Should it be this way?
Good question

WroteOn the other hand, I do not know how to copy a region in "Live" mode (I think this is not possible - not sure) in order to see if the underscore would make a mess in the copied math region.
Copying works now too with a latest builds of standalone SMath Studio versions. And you're right - there is no clipboard in Live version yet.
Best regards.
WroteIt seems, "_" will produce a space in the variable name but the underscore in the defined function name.
...
Should it be this way?
Wrote
Good questionWhat do you thing about this? Should the "_" symbol be invisible in variables and functions or not? Fact is that behavior of underscore character should be the same in both cases.
I think the underscore should be visible in either cases. Spaces might make a confusion. We are used to look at spaces as omitted product between two variables. I do not know what other users think.
Regards,
Radovan
Regards.
-
New Posts
-
No New Posts