HP50g: Writing a function that returns a function « Next Oldest | Next Newest »

 ▼ Chris de Castro Junior Member Posts: 1 Threads: 1 Joined: Dec 2013 12-10-2013, 06:18 PM On the HP-50g, how does one convert an expression into a function programmatically? e.g. I have an expression x^2+1 and wish to convert it into the function << ->x 'x^2+1' >>. More generally, how does one return a program << ... etc... >> from a program? (Haven't hit on the proper syntax yet). Thanks for your assistance. Appreciatively, Chris ▼ Han Senior Member Posts: 709 Threads: 104 Joined: Nov 2005 12-10-2013, 06:48 PM Quote: On the HP-50g, how does one convert an expression into a function programmatically? e.g. I have an expression x^2+1 and wish to convert it into the function << ->x 'x^2+1' >>. More generally, how does one return a program << ... etc... >> from a program? (Haven't hit on the proper syntax yet). Thanks for your assistance. Appreciatively, Chris One method is through strings. For example: << -> f << "<< -> x '" f + STR-> >> could work, provided that the formula is in terms of lower-case 'x'. Enter a formula on the stack (with the single quotes) and evaluate this program to get the desired result. I don't remember if there is an RPL command that extracts the variable of a given expression (my bad memory thinks there is), but hopefully the example above gives you some ideas. Edited: 10 Dec 2013, 6:48 p.m. ▼ Han Senior Member Posts: 709 Threads: 104 Joined: Nov 2005 12-10-2013, 06:49 PM If you are trying to create mathematical functions, you can alternatively use the DEFINE command.

 Possibly Related Threads... Thread Author Replies Views Last Post IFERR function on HP Prime Mic 2 1,184 12-02-2013, 01:33 AM Last Post: cyrille de Brébisson Writing RPL programs on OS X Sean Freeman 18 3,577 11-30-2013, 03:59 PM Last Post: Sean Freeman HP Prime: Dirichlet's eta function recognized but not numerically evaluated Helge Gabert 0 737 11-16-2013, 03:41 PM Last Post: Helge Gabert Possible bug with sqrt function in the HP prime Michael de Estrada 6 1,557 11-15-2013, 12:49 PM Last Post: Michael de Estrada HP-41 MCODE: The Last Function - at last! Ángel Martin 0 682 11-08-2013, 05:11 AM Last Post: Ángel Martin [Prime] any ideas for a undo function? Stefan Dröge (Germany) 8 1,924 11-04-2013, 04:37 PM Last Post: Damien [HP-Prime] - Shortcuts for program writing Jean-Michel 4 1,303 11-01-2013, 07:55 AM Last Post: Jean-Michel HP Prime 'where' function bluesun08 11 2,447 10-29-2013, 06:56 PM Last Post: Joe Horn HP Prime - Defining a function bluesun08 5 1,459 10-23-2013, 02:43 PM Last Post: Han How to save the definition of a CAS program or CAS function ? dg1969 3 1,095 10-19-2013, 01:48 PM Last Post: dg1969

Forum Jump: