HP Forums

Full Version: I think there is a bug in CAS mode using "zeros", "solve"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
Consider putting parenthesis around -e, like so

solve ((-e)^x*(-cos(x)+sin(x))=0,x) returns {1/4*pi, 5/4*pi}.
(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.
I see the problem . . . if your exponential expression is an intermediate result in a program.
(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.
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]. ???
(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.
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...
(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.
Reference URL's