Post Reply 
Equation validator (==) problem
05-08-2020, 12:34 PM
Post: #1
Equation validator (==) problem
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?
Find all posts by this user
Quote this message in a reply
05-08-2020, 12:55 PM
Post: #2
RE: Equation validator (==) problem
(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
Find all posts by this user
Quote this message in a reply
05-08-2020, 02:29 PM
Post: #3
RE: Equation validator (==) problem
(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
Find all posts by this user
Quote this message in a reply
05-08-2020, 03:42 PM
Post: #4
RE: Equation validator (==) problem
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
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)