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 NØNE  
#1 Posted : 25 February 2020 22:32:39(UTC)
NØNE

Rank: Newbie

Groups: Registered
Joined: 25/02/2020(UTC)
Posts: 1
Location: None

Hi everyone,
I've got problem with 'if' statement.
Image: https://ibb.co/YcxjcqR
As you can see in the picture, y(3) is being counted by the second formula, but it must be counted by the third formula cos' x>2 and it must be equal 1. What's wrong with that? Thanks!
You can also download the original file by this link: https://ufile.io/qpnqpws9 (I could upload it on this forum, but it's stuck)

Note (English is not my native language, so I'm sorry if something incorrect)

Edited by user 25 February 2020 23:34:03(UTC)  | Reason: Solved

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

Offline alyles  
#2 Posted : 25 February 2020 23:18:20(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 276
United States

Was thanked: 91 time(s) in 57 post(s)
The formulation you have for the second if statement will always evaluate to true if reached.

If you look at your condition:
(0<=x)< 2
(0<=x) will evaluate to 1 if true or 0 if false. Both 1 and 0 are less than 2.
So will always evaluate to true because 1 < 2 is true and 0 < 2 is also true.

Attached is the proper way to perform that condition in SMATH
2.sm (8kb) downloaded 18 time(s).

Also the way that you have formulated the if statement f(2) will result in an error because none is not defined. If that's what you intend, that's fine. Otherwise you'd need equality <= or >= in the 2,3 if statement, respectively.

Edited by user 25 February 2020 23:23:33(UTC)  | Reason: Not specified

Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Jean Giraud  
#3 Posted : 25 February 2020 23:19:48(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: NØ Go to Quoted Post
You can also download the original file

No point => that gadget is freak.

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