Output of propositional functions - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Output of propositional functions (/thread-7559.html) |
Output of propositional functions - Alberto Candel - 01-12-2017 05:40 AM 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 RE: Output of propositional functions - roadrunner - 01-13-2017 12:06 PM 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 RE: Output of propositional functions - DrD - 01-13-2017 05:00 PM If you can tolerate string objects, you could return "True" and "False" in Roads program. RE: Output of propositional functions - Alberto Candel - 01-14-2017 04:44 AM Thank you. I was looking for something already there, avoiding programming. For my students. RE: Output of propositional functions - compsystems - 01-14-2017 12:49 PM (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 |