Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline mar  
#1 Posted : 13 September 2009 11:02:39(UTC)
mar


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)

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline omorr  
#2 Posted : 13 September 2009 14:24:08(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello mar,
Open in SMath Cloud
You must have done something wrong. It seems Ok.

Regards,
radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline mar  
#3 Posted : 13 September 2009 18:42:14(UTC)
mar


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

Offline omorr  
#4 Posted : 13 September 2009 19:15:22(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

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.rs
mar 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!"
Offline omorr  
#5 Posted : 13 September 2009 19:21:28(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

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!"
Offline mar  
#6 Posted : 13 September 2009 19:40:27(UTC)
mar


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?
Offline omorr  
#7 Posted : 13 September 2009 19:45:16(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

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!"
Offline Andrey Ivashov  
#8 Posted : 14 September 2009 03:16:25(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

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!
Offline omorr  
#9 Posted : 14 September 2009 13:06:31(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

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!"
Offline Greg Locock  
#10 Posted : 14 September 2009 15:33:24(UTC)
Greg Locock


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
Offline omorr  
#11 Posted : 14 September 2009 18:55:36(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

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)=5
or
if(1≡0;5;6)=6
or
x←0
a←if(x≡0;10;20)
a=10

There is the way it works. I suppose something goes wrong and should be checked out here.

if(x;y←9;z←8)=90

Regards,
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!"
Offline John-VEG  
#12 Posted : 19 January 2017 09:32:52(UTC)
John-VEG

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 cloud

Or how it would by correct?

Edited by user 19 January 2017 09:36:07(UTC)  | Reason: Not specified

Offline Jean Giraud  
#13 Posted : 19 January 2017 16:50:59(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: John-VEG Go to Quoted Post
By the way
Impossible to assign to a function different values according conditions.
An example in the cloud

Or how it would by correct?


Please: attach your request in a work sheet.

Offline Jean Giraud  
#14 Posted : 19 January 2017 19:00:56(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: John-VEG Go to Quoted Post
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).

Offline Jean Giraud  
#15 Posted : 19 January 2017 19:24:01(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
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).
Offline Jean Giraud  
#16 Posted : 19 January 2017 20:05:38(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
"cases" is needed with 'convolution stuff'


... here is the convolution "cases" example:

Convolution RC 6179.sm (14kb) downloaded 17 time(s).

Users browsing this topic
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.