Logic test returning unexpected answer - 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: Logic test returning unexpected answer (/thread-5166.html) |
Logic test returning unexpected answer - pwarmuth - 11-20-2015 04:57 PM 2^(-x) == 1/(2^x) is returning 0. Any idea why? RE: Logic test returning unexpected answer - Helge Gabert - 11-20-2015 05:08 PM Not surprising, because == doesn't do any and all simplifications for you. Try (x-1)*(x+1) == x^2-1 also returns 0. But x^2-1 == x^2-1 returns 1. RE: Logic test returning unexpected answer - pwarmuth - 11-20-2015 05:31 PM Ok, that makes sense. Speaking of simplifications, I encountered this today as well. [attachment=2830] Those two statements should be mathematically identical, but yet their simplifications are not the same. I know for certain the second one is correct. Though if I add in an explicit multiply, it behaves. [attachment=2832] RE: Logic test returning unexpected answer - Helge Gabert - 11-20-2015 06:17 PM Yes, don't skimp on the '*'! RE: Logic test returning unexpected answer - Fortin - 11-20-2015 10:05 PM Using the method, simplify(f-g)==0, works pretty well - where f ang g are the two items being compared. For example: simplify(2^(-x) - 1/(2^x))==0 RE: Logic test returning unexpected answer - Fortin - 11-20-2015 10:42 PM (11-20-2015 05:31 PM)pwarmuth Wrote: Ok, that makes sense. This is because the intended implied multiplication involving 1/4 is calling 'of' instead of '*'. |