# HP Forums

Full Version: Output of propositional functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 &ge; 0 outputs True/False (&ge; 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
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.

If you can tolerate string objects, you could return "True" and "False" in Roads program.
Thank you. I was looking for something already there, avoiding programming. For my students.
(01-13-2017 12:06 PM)roadrunner Wrote: [ -> ]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.

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
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :