Equation validator (==) problem - 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: Equation validator (==) problem (/thread-14945.html) |
Equation validator (==) problem - superludvig - 05-08-2020 12:34 PM So I have this inconvenience when using my calculator to check if what I think is the same thing actually is the same thing. This is really handy when comparing equations while shortening them. So here is the problem: I input 2*2==4 and I get a 1, which means it's true. And then I input 9^(1/2)==3 and I still get a 1. The problem occurs when I input 9^(1/2)==(-3) because then I get a 0. Why do I get a 0 and is there any way to have the calculator display a 1 instead? RE: Equation validator (==) problem - Albert Chan - 05-08-2020 12:55 PM (05-08-2020 12:34 PM)superludvig Wrote: Why do I get a 0 and is there any way to have the calculator display a 1 instead? If calculator return 1 for both 9^(1/2)==3 and 9^(1/2)==-3, by transitive propoerty, 3==-3 You can move the exponent to the other side, 9 == 3^2 == (-3)^2 RE: Equation validator (==) problem - DrD - 05-08-2020 02:29 PM (05-08-2020 12:55 PM)Albert Chan Wrote: You can move the exponent to the other side, 9 == 3^2 == (-3)^2 Did you try that in both [HOME] and [CAS]? [HOME] 9 == 3^2 == (-3)^2; ==> 0 [CAS] 9 == 3^2 == (-3)^2; ==> true RE: Equation validator (==) problem - Albert Chan - 05-08-2020 03:42 PM Hi, DrD XCas (1.5.0-63 win32) support chained comparison , but not fully short circuiting. XCas> f(x) := {print(x);x} XCas> f(1) < f(2) < f(3) < f(-1) < f(-2) < f(-3) x:1 x:2 x:2 x:3 x:-1 x:-3 → false Python 2.6: >>> def f(x): print x; return x ... >>> f(1) < f(2) < f(3) < f(-1) < f(-2) < f(-3) 1 2 3 -1 False |