HP Prime and Strings - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: HP Prime and Strings (/thread-250753.html) HP Prime and Strings - Han - 09-19-2013 Since the HP Prime is able to handle strings, is it possible to take strings and convert them into functions? I know back in the TI-85 there was such a command. Does/will the HP Prime have the ability to ask users to input a function to be used as a symbolic object like equations in the HP48 series? I tried using the INPUT command but it seems to only accept numerical inputs. Re: HP Prime and Strings - Eddie W. Shore - 09-19-2013 What I found to be the most successful is to pass functions as strings as arguments. Example: ```\\ calculate the numerical derivative of f(X) at X = N EXPORT NDER(str1, N) BEGIN X:=N + .000001; D:=EXPR(str1) X:=N - .000001; D:= D - EXPR(str1); D:= D/(.000002); RETURN D; END; EXPR - numerical evaluation of the string with the appropriate variables substituted. ``` f(X) = 3*e^X - 3*X^2. Find f'(1). NDER("3*e^X - 3*X^2",1) returns 2.15484. We could also use strings to store functions into graphing functions or equations. Example: "3*X+4" - > F1 Hope this helps, Eddie Re: HP Prime and Strings - Gilles Carpentier - 09-19-2013 Quote: I tried using the INPUT command but it seems to only accept numerical inputs. INPUT allows all type of argument but you have put the right delimiters: " " [ ] { } etc. be carefull that A..Z variables are only numericals The INPUT command is very powerfull (default value, on line help ...) Re: HP Prime and Strings - Han - 09-19-2013 Could you give me an example of how to ask the user to enter in a function that can be used as a function? Ideally I would like to have something like: f(x,y)= and have the user enter in a formula that can be used later on. Re: HP Prime and Strings - Namir - 09-20-2013 Here is an example of a Newton method that uses a string parameter sFx to pass a string image for a function: ```EXPORT Newton(sFx,xguess,toler) BEGIN LOCAL h,f,fp,diff; REPEAT h:=0.001*(ABS(xguess)+1); X:=xguess; f:=EXPR(sFx); X:=xguess+h; fp:=EXPR(sFx); diff:=h*f/(fp-f); xguess:=xguess-diff; UNTIL ABS(diff)