Prev: hp 50g rom
Next: HP 50g + ROM 2.09
From: Joe Veazey on 19 Aug 2006 16:52 There are a number of numeric functions in the HP-50g for single variable polynomials, that represent the polynomial as a numeric array, containing the coefficients of the polynomial stored in dsecending order of the powers of the variable. That is, the polynomial: (1): '4*x^3 + 0.36*x^2 - 7*x + 14' would be stored as this numeric array: (2): [4.0, 0.36, -7.0, 14.0] MAIN QUESTION: Is there a function to convert from polynomial form (1) to array form (2) automatically? I searched thru the documentation and I couldn't find anything obvious. Am I going to have to write such a function myself? Perhaps a function named "P->AR". I would want something that would take the polynomial as stack arg 2, and the variable name as stack arg 1, so I could convert polynomials which are functions of 'z', or 'y', or 'myvar' or anything else. Possibly a "P->ARVX" version which would take only the polynomial as stack arg 1, and the variable name would be the variable defined in HOME.CASDIR.VX. I did have one that worked fine on the HP-48G, but I found that just copying it over to the 50g didn't quite work, because of differences in the COLLECT and EXPAND cmds. I am working on it as an introduction to converting to the 50g sysRPL, and perhaps later I will convert it to HPGCC. Thanks for reading!
From: hgabert@xmission.com on 19 Aug 2006 17:24 Check out library 1125 "Polynomial 2.1" by Steen Schmidt on hpcalc.org. It has the functions you are searchung for, namely P->A and A->P, and more. Joe Veazey wrote: > There are a number of numeric functions in the HP-50g for single variable > polynomials, that represent the polynomial as a numeric array, containing > the coefficients of the polynomial stored in dsecending order of the powers > of the variable. > > That is, the polynomial: > > (1): '4*x^3 + 0.36*x^2 - 7*x + 14' > > would be stored as this numeric array: > > (2): [4.0, 0.36, -7.0, 14.0] > > > MAIN QUESTION: > Is there a function to convert from polynomial form (1) to array form (2) > automatically? I searched thru the documentation and I couldn't find > anything obvious. > > > > Am I going to have to write such a function myself? > > Perhaps a function named "P->AR". > > I would want something that would take the polynomial as stack arg 2, and > the variable name as stack arg 1, so I could convert polynomials which are > functions of 'z', or 'y', or 'myvar' or anything else. > > Possibly a "P->ARVX" version which would take only the polynomial as stack > arg 1, and the variable name would be the variable defined in > HOME.CASDIR.VX. > > I did have one that worked fine on the HP-48G, but I found that just > copying it over to the 50g didn't quite work, because of differences in the > COLLECT and EXPAND cmds. > > I am working on it as an introduction to converting to the 50g sysRPL, and > perhaps later I will convert it to HPGCC. > > Thanks for reading!
From: Virgil on 19 Aug 2006 18:17 In article <Xns9824A18F4BDSleazeyWombat(a)207.115.17.102>, Joe Veazey <charon(a)pluto.sol.milkyway.localcluster.universe0> wrote: > There are a number of numeric functions in the HP-50g for single variable > polynomials, that represent the polynomial as a numeric array, containing > the coefficients of the polynomial stored in dsecending order of the powers > of the variable. > > That is, the polynomial: > > (1): '4*x^3 + 0.36*x^2 - 7*x + 14' > > would be stored as this numeric array: > > (2): [4.0, 0.36, -7.0, 14.0] > > > MAIN QUESTION: > Is there a function to convert from polynomial form (1) to array form (2) > automatically? I searched thru the documentation and I couldn't find > anything obvious. > > > > Am I going to have to write such a function myself? > > Perhaps a function named "P->AR". > > I would want something that would take the polynomial as stack arg 2, and > the variable name as stack arg 1, so I could convert polynomials which are > functions of 'z', or 'y', or 'myvar' or anything else. For "P\->AR" try \<< RCLVX UNROT STOVX {} SWAP DO RCLVX DIV2 ROT + SWAP UNTIL {0 0.} OVER POS END DROP AXL SWAP STOVX \>> > > Possibly a "P->ARVX" version which would take only the polynomial as stack > arg 1, and the variable name would be the variable defined in > HOME.CASDIR.VX. For "P->ARVX" you can use the simpler version which does not need to change VX and then change it back \<< {} SWAP DO RCLVX DIV2 ROT + SWAP UNTIL {0 0.} OVER POS END DROP AXL \>> > > I did have one that worked fine on the HP-48G, but I found that just > copying it over to the 50g didn't quite work, because of differences in the > COLLECT and EXPAND cmds. > > I am working on it as an introduction to converting to the 50g sysRPL, and > perhaps later I will convert it to HPGCC. > > Thanks for reading!
From: Hans on 20 Aug 2006 05:44 Hi, I found a very simple elegant program for you out there on Alistair Borowski's website. It does exactly what you want. http://alpage.ath.cx/hptute/hptute5.htm Entering Polynomials Entering Polynomials in RPN mode is a pain, and other methods aren't much better. This program will allow you to easily generate polynomials. << PEVAL EXPAND >> . To use it, put the coefficients in a vector (Between []'s), on the stack, then the name of a variable, and then run the program. EG To generate 5*x^3 + 6*x^2 + 7x + 9, Put [5 6 7 9] on the stack, then type 'X'. Then run the program. I have saved this as 'MkPol' in the screenshot above (Make Polynomial). On 2006-08-19 22:52:49 +0200, Joe Veazey <charon(a)pluto.sol.milkyway.localcluster.universe0> said: > There are a number of numeric functions in the HP-50g for single > variable polynomials, that represent the polynomial as a numeric array, > containing the coefficients of the polynomial stored in dsecending > order of the powers of the variable. > > That is, the polynomial: > > (1): '4*x^3 + 0.36*x^2 - 7*x + 14' > > would be stored as this numeric array: > > (2): [4.0, 0.36, -7.0, 14.0] > > > MAIN QUESTION: > Is there a function to convert from polynomial form (1) to array form > (2) automatically? I searched thru the documentation and I couldn't > find anything obvious. > > > > Am I going to have to write such a function myself? > > Perhaps a function named "P->AR". > > I would want something that would take the polynomial as stack arg 2, > and the variable name as stack arg 1, so I could convert polynomials > which are functions of 'z', or 'y', or 'myvar' or anything else. > > Possibly a "P->ARVX" version which would take only the polynomial as > stack arg 1, and the variable name would be the variable defined in > HOME.CASDIR.VX. > > I did have one that worked fine on the HP-48G, but I found that just > copying it over to the 50g didn't quite work, because of differences in > the COLLECT and EXPAND cmds. > > I am working on it as an introduction to converting to the 50g sysRPL, > and perhaps later I will convert it to HPGCC. > > Thanks for reading!
From: Hans on 20 Aug 2006 06:47
On 2006-08-20 11:44:23 +0200, Hans <mac(a)mac.mac> said: > Hi, > > I found a very simple elegant program for you out there on Alistair > Borowski's website. It does exactly what you want. Sorry.... it does exactly opposite what you want. I misinterpreted your question. Maybe you still can do something usefull with it. Hans |