[BUG] Comparison fails
02-20-2014, 10:56 PM
Post: #1
 Stefan Member Posts: 87 Joined: Dec 2013
[BUG] Comparison fails
The following comparison fails (which is true when you do it by hand):
$$\frac{\partial \left( \frac{x^n}{n^3\cdot\left(1+x^n\right)}\right)}{\partial x} =\frac{x^{n-1}}{n^2\cdot(x^n)^2+2\cdot n^2\cdot x^n+n^2}== \frac{x^{n-1}}{n^2\cdot\left(1+x^n\right)^2}$$

(The term in the middle is what the differential is solved to by the Prime. It doesn't matter whether it is compared directly to the differential or to the solution).
It also doesn't matter whether you make the following assumptions about x and n:
n Integer and >0
x >0
02-21-2014, 07:18 AM
Post: #2
 parisse Senior Member Posts: 1,088 Joined: Dec 2013
RE: [BUG] Comparison fails
It's not a bug. == checks if the expressions are the same, not if they are mathematically equivalent. To do that the easiest is to simplify the difference between both sides and check if it's 0 or not. The reason is that automatic simplification may fail and would cost time, it's better to leave the programmer/user simplify himself (here factor should work for example), and that's what all CAS do.
02-21-2014, 07:01 PM
Post: #3
 Stefan Member Posts: 87 Joined: Dec 2013
RE: [BUG] Comparison fails
Thanks for the advice.
I think it would be a good idea to include somewhere in the manual, that the Test Functions should not be used to compare expressions with each other (of course together with a hint how to do it properly)

And how much time are we talking about usually? Maybe the CAS could attempt a simplification and if doesn't suceed after say 50ms, go the "traditional" way. (on the other hand this would lead to the behaviour that sometimes the simplification (and hence the test) succeeds, and sometimes not. So maybe its better if it almost never works and one gets used to the not so intuitive but always working method mentioned by parisse).
 « Next Oldest | Next Newest »

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