Post Reply 
I think there is a bug in CAS mode using "zeros", "solve"
12-05-2014, 09:25 PM
Post: #1
I think there is a bug in CAS mode using "zeros", "solve"
I think there is a bug in CAS mode using "zeros", "solve". I have fn: "-e^x*(-cos(x)+sin(x))" and I need zeros of that fn. I use zeros(-e^x*(-cos(x)+sin(x)),x) and I get the error: "Unable to isolate x in cos(x)-sin(x)" but when I use zeros(e^x*(-cos(x)+sin(x)),x) I get the zeros [1/4*Pi,5/4*Pi] and no error. What I've done I changed the minus sign in front of e to plus sign and there is no error. It looks like the "-" in front of "e" makes all the difference. On plot both functions have the same zeros. Using "solve" does the same thing.
Find all posts by this user
Quote this message in a reply
12-05-2014, 10:44 PM
Post: #2
RE: I think there is a bug in CAS mode using "zeros", "solve"
Consider putting parenthesis around -e, like so

solve ((-e)^x*(-cos(x)+sin(x))=0,x) returns {1/4*pi, 5/4*pi}.
Find all posts by this user
Quote this message in a reply
12-05-2014, 11:39 PM
Post: #3
RE: I think there is a bug in CAS mode using "zeros", "solve"
(12-05-2014 10:44 PM)Helge Gabert Wrote:  Consider putting parenthesis around -e, like so

solve ((-e)^x*(-cos(x)+sin(x))=0,x) returns {1/4*pi, 5/4*pi}.

Yes, but I also use diff(e^x*cos(x),x) inside program and the differentiation gives me e^x*cos(x)-e^x*sin(x) and when I want zeros I get the same error so parenthesis will not solve my problem. Thanks.
Find all posts by this user
Quote this message in a reply
12-06-2014, 02:15 AM
Post: #4
RE: I think there is a bug in CAS mode using "zeros", "solve"
I see the problem . . . if your exponential expression is an intermediate result in a program.
Find all posts by this user
Quote this message in a reply
12-06-2014, 04:13 AM (This post was last modified: 12-06-2014 04:17 AM by John P.)
Post: #5
RE: I think there is a bug in CAS mode using "zeros", "solve"
(12-06-2014 02:15 AM)Helge Gabert Wrote:  I see the problem . . . if your exponential expression is an intermediate result in a program.

Yes, but even though it is a bug in spite what you have proposed as a band aid.
Find all posts by this user
Quote this message in a reply
12-06-2014, 04:41 AM
Post: #6
RE: I think there is a bug in CAS mode using "zeros", "solve"
I don't disagree with you . . . it seems a bug to me as well.

Try collect() on the intermediate expression, i.e.

collect(e^x*cos(x)-e^x*sin(x)) returns e^x*(cos(x)-sin(x)).

Okay, now try solve() or zeros(). That works, but returns [-3/4*pi 1/4*pi]. ???
Find all posts by this user
Quote this message in a reply
12-06-2014, 05:31 AM (This post was last modified: 12-06-2014 06:12 AM by John P.)
Post: #7
RE: I think there is a bug in CAS mode using "zeros", "solve"
(12-06-2014 04:41 AM)Helge Gabert Wrote:  I don't disagree with you . . . it seems a bug to me as well.

Try collect() on the intermediate expression, i.e.

collect(e^x*cos(x)-e^x*sin(x)) returns e^x*(cos(x)-sin(x)).

Okay, now try solve() or zeros(). That works, but returns [-3/4*pi 1/4*pi]. ???

Funny thing. When I do what you propose in CAS on the command line: differentiating "e^x*cos(x)" and then collecting I get e^x(cos(x)-sin(x)) and it works but when I do the same thing but in program and collect the 1st derivative I get -e^x(-cos(x)+sin(x)) and then the error using "zeros" or "solve". I did return(fd) after collecting in the program. Lets hope that somebody from HP Prime group reads this post and maybe they will fix it someday. Just for curiosity I have iPod 5g and on it PocketCAS and it works without a hitch so the problem must be related to HP Prime implementation of xCAS not to xCAS itself. Thank you for your time.
Find all posts by this user
Quote this message in a reply
12-06-2014, 04:03 PM
Post: #8
RE: I think there is a bug in CAS mode using "zeros", "solve"
solve/zeros/etc. can handle polynomial equations and equations that the system can rewrite as a polynomial equation. The problem is rewrite the expression as a polynomial equation. From one version to another, I try to improve the rewriting rules but sometimes it fails...
Find all posts by this user
Quote this message in a reply
12-06-2014, 05:48 PM
Post: #9
RE: I think there is a bug in CAS mode using "zeros", "solve"
(12-06-2014 04:03 PM)parisse Wrote:  solve/zeros/etc. can handle polynomial equations and equations that the system can rewrite as a polynomial equation. The problem is rewrite the expression as a polynomial equation. From one version to another, I try to improve the rewriting rules but sometimes it fails...

Yes, I understand. It works in PocketCAS with no problem but in HP Prime there is a problem. Both PosketCAS and HP Prime use the same xCAS as I understand.
Find all posts by this user
Quote this message in a reply
Post Reply 




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