Output of propositional functions
|
01-12-2017, 05:40 AM
Post: #1
|
|||
|
|||
Output of propositional functions
A propositional function outputs 0/1 or True/False depending on ...? Maybe someone knows how to always get True/False. I explain:
The function gt0(x):=x>0 outputs 0/1: for example gt0(2)=1 and gt0(-1)=0. But the function ge0(x):=x ≥ 0 outputs True/False (≥ is the html code for "at least"), for example ge0(2)=True and ge0(-3)=False. Is there some kind of switch that will always give True/False as possible answers? BTW, Xcas seems to always return True/False |
|||
01-13-2017, 12:06 PM
Post: #2
|
|||
|
|||
RE: Output of propositional functions
I don't know of a switch, but this function returns true and false in CAS:
g2(x):=BEGIN IF x>0 THEN RETURN(true); END ; RETURN(false); END; In HOME I think you will always get 0 or 1. -road |
|||
01-13-2017, 05:00 PM
Post: #3
|
|||
|
|||
RE: Output of propositional functions
If you can tolerate string objects, you could return "True" and "False" in Roads program.
|
|||
01-14-2017, 04:44 AM
Post: #4
|
|||
|
|||
RE: Output of propositional functions
Thank you. I was looking for something already there, avoiding programming. For my students.
|
|||
01-14-2017, 12:49 PM
Post: #5
|
|||
|
|||
RE: Output of propositional functions
(01-13-2017 12:06 PM)roadrunner Wrote: I don't know of a switch, but this function returns true and false in CAS: I agree, in HOME should return 1/0 but in CAS MODE always TRUE / FALSE as constants without evaluating. CASs must show SYMBOLIC and non-numerical values return PI -> π and not 3.14.... return true -> true and not 1 return false -> false and not 0 To see the numerical value, there are the EVAL commands, EVAL(TRUE) -> 1 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)