Operators behavior?

Operators behavior? - Messages

#1 Posted: 7/28/2010 2:53:50 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello,

This is some minor issues about operators and assignment in SMath.
Here are some examples:
[MATH]{{a←5}/{b←a+1}}/{c←b+4}[/MATH]
========
[MATH]sqrt({aa←100}/{cc←800})[/MATH]
========
[MATH]det({v←110}/{u←1000})[/MATH]
========
They reported "Division by zero." error but the assigment is performed and every variables has their values. For instance, try to use matrix operator and fill the placeholders with asignments. No error reported, but assignmnets are performed.

I do not know what to think about it. This might just be ignored (no harm done) or just force SMath to supress this. What others think about it?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#2 Posted: 7/28/2010 2:26:18 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

The examples you show are not critical because the division by zero seems to suppress any result of the operator. I could not get the sqrt of aa/cc with the "=" key.

However a more critical case is shown in the example below where the result is incorrect.

Ed
#3 Posted: 7/28/2010 4:03:35 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Yes, I agree. However, I still do not have any definite opinion about this. Here is another example, symilar to yours.

No errors reported as well. As you would expect variable "x" to have value of 10, I would expect some other values for the variables in this example. I do not know how to explain this and how is this actually working. On the other hand, I think it might be useful if the results would be predictible.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#4 Posted: 7/28/2010 6:49:02 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Hello.

This is a bug. Definition operator should return the right side of expression, so in

answer for "x" should be 10.

Regards.
#5 Posted: 7/29/2010 2:10:36 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Andrey,

Just one more comment - hope you would not mind.

This syntax is incorrect (error message):
[MATH]a←b←5[/MATH]
With this one the syntax is correct but gives problematic and questionable results:
[MATH]a←(b←5)[/MATH]
[MATH]a=0[/MATH] [MATH]b=5[/MATH]
In the first place, I was thinking that multiple assignments are problematic but I remembered that, i.e., this is quite correct:

SMath must have multiple assignments in the same math region. On the other hand I commented the issue about "local" and "global" variables - problematic "line" environment in few posts:
http://en.smath.info/forum/default.aspx?g=posts&m=3113#post3113
http://en.smath.info/forum/default.aspx?g=posts&m=3114#post3114

Then I remembered that Mathcad does not allow multiple assignments. I suppose because of the similar problems. In Mathcad inside the "line" blocks there are "local assignments" - left arrow character - used instead ordinary (:=) assignment operator. However, I would like very much SMath to have the functionality of multiple functions with "line" and programming (above are the mentioned posts about the present situation). At the moment I do not know how to deal with it. I feel that the solution is right there and SMath is close to it. Of course, this is just my impression.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • New Posts New Posts
  • No New Posts No New Posts