SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
The 'if' logic appears to be backwards
Rank: Member Groups: Registered
Joined: 13/09/2009(UTC) Posts: 13
|
x:=0 if x=0 y:=0 else y:=1
y=1 (should be 0)
x:=1 (same conditional above) y=0 (should be 1)
|
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
|
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Member Groups: Registered
Joined: 13/09/2009(UTC) Posts: 13
|
I just re-tested using both my example & your example and I still get the wrong answer for both. I have ver 0.85 build 3531 installed under winXP SP3. I also tried to test under the live web version but could not figure out how to add the 'if' conditional since the selection list over on the right does not seem to contain the conditional functions like the installed version. By the way how are you getting smath pages pasted into the forum? Update: Ok it looks like I have issolated my problem. When I entered the conditional in the 'if' stmt I used the stnd '=' key instead of the actual boolean test condition '=' from the right side panel. They both look the same other than the fact that the boolean version appears in bold type. Any reason why smath did not automatically take and convert my stnd '=' into into a boolean test conditional '=' given the context in which it was entered? Edited by user 13 September 2009 19:07:12(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Hello mar, mar wrote:I just re-tested using both my example & your example and I still get the wrong answer for both. I have ver 0.85 build 3531 installed under winXP SP3.
Could you send the *.sm file to me, and will see. My email is omorr@uns.ac.rsmar wrote: I also tried to test under the live web version but could not figure out how to add the 'if' conditional since the selection list over on the right does not seem to contain the conditional functions like the installed version.
There are some restrictions about "Live" version. You can make a *.sm file on your computer and choose the "Upload" option in "Live" SMath from the lower right corner (easyer and faster). After the file has been uploaded, you can get the LIVE link - lower right corner. This link put (copy/paste) into your post and you will get the same as I did. mar wrote: By the way how are you getting smath pages pasted into the forum?
Yuo can have pictures and files into this forum, but you have to provide the links for them. Try to "Quote" some of the posts and see the way. You can upload the files on some free upload file services and provide the adress for them "http://...". There is also an upload SMath server but it is in Russian only (not translated to English yet). Regards, Radovan |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Hello mar, mar wrote:Update: Ok it looks like I have issolated my problem. When I entered the conditional in the 'if' stmt I used the stnd '=' key instead of the actual boolean test condition '=' from the right side panel. They both look the same other than the fact that the boolean version appears in bold type. Any reason why smath did not automatically take and convert my stnd '=' into into a boolean test conditional '=' given the context in which it was entered? It is a common mistake. I do not believe it could be possible to convert stnd '=' into a boolean test conditional '=' (shortcut is CTRL+=). You have to take care of this. Regards, Radovan |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Member Groups: Registered
Joined: 13/09/2009(UTC) Posts: 13
|
If smath can not auto translate the stnd '=' into a valid boolean test cond '=' than maybe it could flag the fact that the entire conditional arg does not contain a vaild boolean test condition?
|
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
mar wrote:If smath can not auto translate the stnd '=' into a valid boolean test cond '=' than maybe it could flag the fact that the entire conditional arg does not contain a vaild boolean test condition? Yes, you might be right. I am sure that the SMath author Andrey will answer this. Regards, Radovan |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Administration Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member Joined: 11/07/2008(UTC) Posts: 1,616 Was thanked: 1978 time(s) in 666 post(s)
|
mar, this is impossible to implement auto conversion of the 'equal to' operator. Unfortunately. But, please, tell me, how you could write not boolean 'equal to' into the condition of if function? I can't find the way.
omorr, thank you!
|
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
smath wrote:mar, this is impossible to implement auto conversion of the 'equal to' operator. Unfortunately. But, please, tell me, how you could write not boolean 'equal to' into the condition of if function? I can't find the way.
omorr, thank you! You are welcome, I'll comment this, if you do not mind. Actually, it is possible. The error will be issued but you can continue. After the first expression below if, the equal sign will shift to the right and finally Regards, Radovan |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 30/08/2009(UTC) Posts: 52 Location: Australia
|
A change in syntax might be to use == for boolean test =, while keeping := for assignment=
I'm surprised it can't figure out which is meant from context after an 'if' keyword
|
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Hello Greg, I think this is a bug - kind of. Actually, "if" is the only tool from Programming palette which will return a value (I think). For instance (Pay attention on equal to signs) if(1≡1;5;6)=5or if(1≡0;5;6)=6or x←0a←if(x≡0;10;20)a=10There is the way it works. I suppose something goes wrong and should be checked out here. if(x;y←9;z←8)=90Regards, Radovan Edited by user 14 September 2009 19:05:26(UTC)
| Reason: Not specified |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Newbie
Groups: Registered
Joined: 14/01/2016(UTC) Posts: 5
Was thanked: 1 time(s) in 1 post(s)
|
By the way Impossible to assign to a function different values according conditions. An example in the cloudOr how it would by correct? Edited by user 19 January 2017 09:36:07(UTC)
| Reason: Not specified
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
Originally Posted by: John-VEG By the way Impossible to assign to a function different values according conditions. An example in the cloudOr how it would by correct? Please: attach your request in a work sheet.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
Originally Posted by: John-VEG An example in the cloud Can't find the file in cloud. Generally, conditions must be completely specified [Integrate Discontinuous]. Odd cases happen one of the condition must not be completely specified. Success or failure is the sole guide. Each case exemplified in the attached. Jean Integrate Discontinuous.sm (23kb) downloaded 19 time(s). Spline De Boor [Colibri].sm (33kb) downloaded 14 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
Originally Posted by: Jean Giraud Generally, conditions must be completely specified [Integrate Discontinuous]. ... This example is constructed on Davide "cases". The numerical integrator works with "cases". Numerical integrator does NOT "if/else" "cases" is needed with 'convolution stuff' Cheers Integrate Discontinuous [UN].sm (19kb) downloaded 11 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
Originally Posted by: Jean Giraud "cases" is needed with 'convolution stuff' ... here is the convolution "cases" example: Convolution RC 6179.sm (14kb) downloaded 17 time(s).
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Bugs & Problems
»
The 'if' logic appears to be backwards
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.