Post Reply 
Bugs about simpilfy function in the cas
09-03-2017, 01:31 PM (This post was last modified: 09-11-2017 04:47 AM by wangchong01.)
Post: #1
Bugs about simpilfy function in the cas
Hello, I have found a bug of the simplify function, just try simplify sqrt((sqrt(46)+1)/2) and you'll find the bug.
Find all posts by this user
Quote this message in a reply
09-04-2017, 03:49 AM
Post: #2
RE: Bugs about simpilfy function in the cas
(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.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
09-11-2017, 04:48 AM
Post: #3
RE: Bugs about simpilfy function in the cas
I'm sorry that I typed the wrong expression. It should be sqrt((sqrt(46)+1)/2) instead of sqrt(sqrt(46)+1).
Find all posts by this user
Quote this message in a reply
09-11-2017, 06:53 AM
Post: #4
RE: Bugs about simpilfy function in the cas
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.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
09-11-2017, 07:47 AM
Post: #5
RE: Bugs about simpilfy function in the cas
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.... :-)
Find all posts by this user
Quote this message in a reply
09-11-2017, 11:32 AM (This post was last modified: 09-11-2017 11:36 AM by DrD.)
Post: #6
RE: Bugs about simpilfy function in the cas
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.
Find all posts by this user
Quote this message in a reply
09-11-2017, 01:27 PM (This post was last modified: 09-11-2017 01:28 PM by wangchong01.)
Post: #7
RE: Bugs about simpilfy function in the cas
(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().
Find all posts by this user
Quote this message in a reply
09-12-2017, 06:39 AM
Post: #8
RE: Bugs about simpilfy function in the cas
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...
Find all posts by this user
Quote this message in a reply
09-12-2017, 11:17 AM
Post: #9
RE: Bugs about simpilfy function in the cas
(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
Find all posts by this user
Quote this message in a reply
09-12-2017, 12:13 PM
Post: #10
RE: Bugs about simpilfy function in the cas
(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-
Find all posts by this user
Quote this message in a reply
09-13-2017, 01:37 PM
Post: #11
RE: Bugs about simpilfy function in the cas
(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.
Find all posts by this user
Quote this message in a reply
09-13-2017, 02:43 PM (This post was last modified: 09-13-2017 02:44 PM by DrD.)
Post: #12
RE: Bugs about simpilfy function in the cas
f:=(3*x^2-4)^100;
simplify(diff(f));
Find all posts by this user
Quote this message in a reply
09-13-2017, 06:05 PM (This post was last modified: 09-13-2017 06:05 PM by parisse.)
Post: #13
RE: Bugs about simpilfy function in the cas
(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.
Find all posts by this user
Quote this message in a reply
09-13-2017, 08:48 PM
Post: #14
RE: Bugs about simpilfy function in the cas
(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.
Find all posts by this user
Quote this message in a reply
09-14-2017, 05:20 AM
Post: #15
RE: Bugs about simpilfy function in the cas
Then it's a misunderstanding of what simplify does.
Find all posts by this user
Quote this message in a reply
09-14-2017, 10:22 AM
Post: #16
RE: Bugs about simpilfy function in the cas
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
Find all posts by this user
Quote this message in a reply
09-14-2017, 12:06 PM
Post: #17
RE: Bugs about simpilfy function in the cas
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).
Find all posts by this user
Quote this message in a reply
09-18-2017, 09:20 AM
Post: #18
RE: Bugs about simpilfy function in the cas
Another bug about simplify:
simplify(asin(a*b)/abs(a))
Find all posts by this user
Quote this message in a reply
09-18-2017, 01:44 PM
Post: #19
RE: Bugs about simpilfy function in the cas
What did you expect?
Find all posts by this user
Quote this message in a reply
Post Reply 




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