Post Reply 
Problem with zeros and solve in HP Prime.
01-20-2014, 10:01 PM (This post was last modified: 01-20-2014 11:27 PM by Han.)
Post: #4
RE: Problem with zeros and solve in HP Prime.
zeros() works fine when used as follows:


as does the case when e^() is replaced with exp(). You were correct to cast fd as a string. I wonder if there is an issue with your use of collect() -- it too is a CAS command and requires its arguments to be cast as strings. So if d(1) is not a string, you might get nonsensical results since it will be evaluated via the Home view.

Also you do not need to add two null strings when forming temp, if the goal is simply to cast fd as a string. Use one of the two shown below:

temp:=""+fd; // or

Be aware that STRING() and string() behave slightly differently depending on Home vs CAS view. This is not an issue in a program since everything executes as if in the Home view.

An easy way to track down the problem debug it.

Here's an example of how to implement it. Usage: EXTREMA("x^3-3*x","x") Note that only minimal error checking is in place. Your actual program should check to see if complex mode is on (this may affect the results of zeros()), and other details I have left out.



  local fd,cp,sd,n,j,r={};

  // create a second deriv test function
  sd:="sd_(" + v + "):=" + diff(fd,v);
  if TYPE(n)==6 then n:=n(1); end;
  if n then
    return("No extrema found");

  // delete function

  local s;

  // ensure no singularities
    return({x,"2nd deriv singularity"});

    if s>0 then return({x,"Min"}); end;
    if s<0 then return({x,"Max"}); end;
    return({x,"2nd deriv = 0"});


Graph 3D | QPI | SolveSys
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. - Han - 01-20-2014 10:01 PM

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