HP Forums

Full Version: Equation validator (==) problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
(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 Big Grin

You can move the exponent to the other side, 9 == 3^2 == (-3)^2
(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
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
Reference URL's