Post Reply 
Problem with zeros and solve in HP Prime.
01-20-2014, 04:08 PM
Post: #3
RE: Problem with zeros and solve in HP Prime.
(01-20-2014 03:11 PM)Han Wrote:  Would you mind sharing how you implemented this into code -- it would make it easier to figure out how to address the issue(s).

This is a simple program to find extrema of a function. The prgm gives mi this problem only when finding the roots, critical points, of the first derivative and only when there is exponential function. I think it could be the problem the way the 'zeroes' works, if I remember correctly it uses the secant method and maybe it changes the sign for some x's and thinks they are the zeros of the function.
I plan to fix the problem by passing the roots through some kind of 'root cleaning' program that will reject the root that evaluate to values smaller than, I do not know, but perhaps 1E-8 and that should fix the problem for now.
Thanks.

EXPORT FNEXTREMA(f,v)
BEGIN
LOCAL d,k,fd,sd,rts,cpts,infpts;
LOCAL temp,fcpts,finfpts,sdcpts;

d:=NDIFF(f,v,2);
fd:=collect(d(1));
sd:=collect(d(2));
rts:=zeros(f,v);
rts:=sort(VECT2LIST(rts));

temp:=""+fd+"";
cpts:=zeros(temp,v); <------- HERE IS THE PROBLEM.
cpts:=sort(VECT2LIST(cpts));
...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Problem with zeros and solve in HP Prime. - John P - 01-20-2014 04:08 PM



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