HP Forums
Bugs about simpilfy function in the cas - 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: Bugs about simpilfy function in the cas (/thread-8975.html)



Bugs about simpilfy function in the cas - wangchong01 - 09-03-2017 01:31 PM

Hello, I have found a bug of the simplify function, just try simplify sqrt((sqrt(46)+1)/2) and you'll find the bug.


RE: Bugs about simpilfy function in the cas - Joe Horn - 09-04-2017 03:49 AM

(09-03-2017 01:31 PM)wangchong01 Wrote:  Hello, I have found a bug of the simplify function, just try simplify sqrt(sqrt(46)+1) and you'll find the bug.

Please tell us what firmware version you're using, and what result you're getting. Six HP Primes, all with different firmware versions in them, all return sqrt(sqrt(46)+1), which as far as I can tell is what should be expected. I'm assuming that you're in CAS view with default settings, of course.


RE: Bugs about simpilfy function in the cas - wangchong01 - 09-11-2017 04:48 AM

I'm sorry that I typed the wrong expression. It should be sqrt((sqrt(46)+1)/2) instead of sqrt(sqrt(46)+1).


RE: Bugs about simpilfy function in the cas - Joe Horn - 09-11-2017 06:53 AM

Woo hoo! Wow, that's an interesting bug! It returns this amazing result:

√2*√(√72639657109063867246+1256631601)/70898

My checking shows that the bug apparently was introduced sometime in early 2015 and has been there ever since, because it's not in rev 6975 (2014 12 3) or earlier, but it is in rev 7829 (2015 4 27) and later.


RE: Bugs about simpilfy function in the cas - webmasterpdx - 09-11-2017 07:47 AM

if you do an approx() on the original and the "simplified" answer, you get the same result, so it's correct, although not really simplified.... :-)


RE: Bugs about simpilfy function in the cas - DrD - 09-11-2017 11:32 AM

The CAS also will return "simplified" results even if the Simplify setting is "None."

For an example, you can experiment with the following function, (especially interesting to calculus students), by cycling through the CAS settings for Simplify: {None, Minimum, Maximum}:

[CAS] Exact[✔]
factor(((x^2-4)/(x^2+x-6))) ==> (x+2)/(x+3)

[CAS] Exact[ ]
factor(((x^2-4)/(x^2+x-6))) ==> (x-2)*(x+2)/((x-2)*(x+3))

The domain is not continuous, (at x=2), but the factor (x-2) gets masked for all simplify settings, (with Exact checked). There are work-a rounds:

factor(x^2-4) / factor(x^2 + x -6) ==> (x-2)*(x+2)/((x-2)*(x+3))

or uncheck the Exact setting:
factor(((x^2-4)/(x^2+x-6))) ==> (x-2.)*(x+2.)/((x-2.)*(x+3.))

Shouldn't a Simplify setting of "None" fully factorize the functions, and not mask the (x-2) term? Including all the singularities is important, for this kind of example. Attention to the subject matter at the student level can be difficult enough, and requiring special settings, or command variations, only diverts attention from the specific learning environment.


RE: Bugs about simpilfy function in the cas - wangchong01 - 09-11-2017 01:27 PM

(09-11-2017 11:32 AM)DrD Wrote:  The CAS also will return "simplified" results even if the Simplify setting is "None."

For an example, you can experiment with the following function, (especially interesting to calculus students), by cycling through the CAS settings for Simplify: {None, Minimum, Maximum}:

[CAS] Exact[✔]
factor(((x^2-4)/(x^2+x-6))) ==> (x+2)/(x+3)

[CAS] Exact[ ]
factor(((x^2-4)/(x^2+x-6))) ==> (x-2)*(x+2)/((x-2)*(x+3))

The domain is not continuous, (at x=2), but the factor (x-2) gets masked for all simplify settings, (with Exact checked). There are work-a rounds:

factor(x^2-4) / factor(x^2 + x -6) ==> (x-2)*(x+2)/((x-2)*(x+3))

or uncheck the Exact setting:
factor(((x^2-4)/(x^2+x-6))) ==> (x-2.)*(x+2.)/((x-2.)*(x+3.))

Shouldn't a Simplify setting of "None" fully factorize the functions, and not mask the (x-2) term? Including all the singularities is important, for this kind of example. Attention to the subject matter at the student level can be difficult enough, and requiring special settings, or command variations, only diverts attention from the specific learning environment.

The simplify will ignore approx expressions such as (1.1*x)/x. You can you normal() to "simplify" the function and then simplify().


RE: Bugs about simpilfy function in the cas - Anders - 09-12-2017 06:39 AM

Yes so sqrt() is not behaving well in general and especially with nested sqrt(). This has been an going challenge for a long time, e.g. try to simplify nested radicals of complex numbers and it gets eve worse, like:

simplify(√((1+i)+√(1+i))) results something horrendous.

Search the forum for some more references...


RE: Bugs about simpilfy function in the cas - parisse - 09-12-2017 11:17 AM

(09-11-2017 06:53 AM)Joe Horn Wrote:  Woo hoo! Wow, that's an interesting bug! It returns this amazing result:

√2*√(√72639657109063867246+1256631601)/70898

My checking shows that the bug apparently was introduced sometime in early 2015 and has been there ever since, because it's not in rev 6975 (2014 12 3) or earlier, but it is in rev 7829 (2015 4 27) and later.
Must be some missing factorization on the Prime, because 1256631601=35449^2 and sqrt(72639657109063867246)=sqrt(46)*1256631601


RE: Bugs about simpilfy function in the cas - DrD - 09-12-2017 12:13 PM

(09-11-2017 01:27 PM)wangchong01 Wrote:  
(09-11-2017 11:32 AM)DrD Wrote:  [CAS] Exact[✔]
factor(((x^2-4)/(x^2+x-6))) ==> (x+2)/(x+3)

[CAS] Exact[ ]
factor(((x^2-4)/(x^2+x-6))) ==> (x-2)*(x+2)/((x-2)*(x+3))

Shouldn't a Simplify setting of "None" fully factorize the functions, and not mask the (x-2) term?

The simplify will ignore approx expressions such as (1.1*x)/x. You can you normal() to "simplify" the function and then simplify().

The objective is to quickly obtain a fully factorized result, such as might be needed by a student interested in evaluating continuity, and limits. I was hoping to show that the machine is making work, instead of saving work, by requiring the extra student interaction to satisfy the machine, in order to reach the objective.

I'm not sure I have a valid concern here. It may well be that the (x-2) term in numerator and denominator are 'artificial' singularities. I see them as necessary for domain clarity. Diverting attention from the study of a problem, to a study of the machine, may find students frustrated with both; and educators frustrated with the machine.

-Dale-


RE: Bugs about simpilfy function in the cas - parisse - 09-13-2017 01:37 PM

(09-12-2017 11:17 AM)parisse Wrote:  Must be some missing factorization on the Prime, because 1256631601=35449^2 and sqrt(72639657109063867246)=sqrt(46)*1256631601
Fixed in source code.


RE: Bugs about simpilfy function in the cas - DrD - 09-13-2017 02:43 PM

f:=(3*x^2-4)^100;
simplify(diff(f));


RE: Bugs about simpilfy function in the cas - parisse - 09-13-2017 06:05 PM

(09-13-2017 02:43 PM)DrD Wrote:  f:=(3*x^2-4)^100;
simplify(diff(f));
I don't see any bug, simplify expands polynomials. Run factor to get a more readable expression.


RE: Bugs about simpilfy function in the cas - DrD - 09-13-2017 08:48 PM

(09-13-2017 06:05 PM)parisse Wrote:  
(09-13-2017 02:43 PM)DrD Wrote:  f:=(3*x^2-4)^100;
simplify(diff(f));
I don't see any bug, simplify expands polynomials. Run factor to get a more readable expression.

The example (above) has to do with "more readable expression." Somehow "Simplify" and the result obtained, don't translate well.


RE: Bugs about simpilfy function in the cas - parisse - 09-14-2017 05:20 AM

Then it's a misunderstanding of what simplify does.


RE: Bugs about simpilfy function in the cas - DrD - 09-14-2017 10:22 AM

Clearly so. Even more so, when one reads the provided Help description, and reviews the provided Help example. When I encountered the problem above, and the returned "simplification'," it was then I realized, " I have yet to learn the definition of simple."

One of the most difficult aspects (for me), especially of American language, is how frequently we use the same word for multiple meanings. Politicians, news reporters, and children are great at this.

At least I know what is meant by simplify in this case! What seems (sort of) ironic is that using the expand() command returns the same thing. Yet expand seems (to me) so much more descriptive of the result than simplify. Almost to the point of being antonyms.

((simplify(f'))==(expand(f'))); ==> 1


RE: Bugs about simpilfy function in the cas - parisse - 09-14-2017 12:06 PM

They are not synonyms in general. Unlike simplify, expand does not search relations between non rational variables. By default, expand just expands neg, product and power. Try for example with sin(2x)/sin(x).


RE: Bugs about simpilfy function in the cas - wangchong01 - 09-18-2017 09:20 AM

Another bug about simplify:
simplify(asin(a*b)/abs(a))


RE: Bugs about simpilfy function in the cas - parisse - 09-18-2017 01:44 PM

What did you expect?