The 'if' logic appears to be backwards - Сообщения
if x=0
y:=0
else
y:=1
y=1 (should be 0)
x:=1
(same conditional above)
y=0 (should be 1)
[LIVE width=170 height=282]http://smath.info/live/?file=631[/LIVE]
You must have done something wrong. It seems Ok.
Regards,
radovan
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?
Could you send the *.sm file to me, and will see. My email is omorr@uns.ac.rsWroteI 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.
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.
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
WroteUpdate:
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
WroteIf 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
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!
Wrotemar, 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
I'm surprised it can't figure out which is meant from context after an 'if' keyword
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)
[MATH]if(1≡1;5;6)=5[/MATH]
or
[MATH]if(1≡0;5;6)=6[/MATH]
or
[MATH]x←0[/MATH]
[MATH]a←if(x≡0;10;20)[/MATH]
[MATH]a=10[/MATH]
There is the way it works. I suppose something goes wrong and should be checked out here.
[MATH]if(x;y←9;z←8)=90[/MATH]
Regards,
Radovan
Impossible to assign to a function different values according conditions.
An example in the cloud
Or how it would by correct?
WroteBy 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.
WroteAn 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 (22 КиБ) скачан 31 раз(а).
Spline De Boor [Colibri].sm (32 КиБ) скачан 29 раз(а).
WroteGenerally, 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 (18 КиБ) скачан 25 раз(а).
Wrote"cases" is needed with 'convolution stuff'
... here is the convolution "cases" example:
Convolution RC 6179.sm (13 КиБ) скачан 32 раз(а).
-
Новые сообщения
-
Нет новых сообщений