WP34s program submission: Quadratic fit Andrew Nikitin Member Posts: 117 Threads: 31 Joined: Sep 2008 06-11-2013, 11:10 PM This is an implementation of quadratic fit for WP-34s. If only 3 points are entered, this may be used for quadratic interpolation. Similar function was implemented in HP30b, if you missed it, here it is. ```// (C) 2013 Andrew Nikitin // Fit quadratic polynomial to empirical data // program operates in stack size 4 // uses regJ and regK to accumulate [SIGMA]x^3 and [SIGMA]x^4 // uses stat registers to accumulate other sums // stores coefficients of quadrature fit in regA, regB, regC // Initialize: // XEQ'QF' // Clears sums, but not coefficients // Enter point: // y ENTER x R/S (or [A]) // Result: // number of points entered so far // Calculate coefficients (needs at least 3 points): // [B] // Result: // a=regA=regZ // b=regB=regY // c=regC=regX // (order compatible with SLVQ) // Evaluate Ax[^2]+Bx+C polynomial: // x [C] // Result: // Ax[^2]+Bx+C LBL'QF' SSIZE4 CL[SIGMA] CLx STO J STO K XEQ 00 STOP XEQ A BACK 002 // Accumulate sums, including [SIGMA]x^3 and [SIGMA]x^4 LBL A [SIGMA]+ RCL L ENTER x^3 STO+ J * STO+ K LBL 00 CLx n[SIGMA] RTN // delete point LBL 65 // XEQ - [SIGMA]- RCL L ENTER x^3 STO- J * STO- K GTO 00 // Fit quadratic LBL B LocR 016 RCL K STO .03 RCL J STO .02 STO .06 # 002 n[SIGMA] x<=? Y ERR 15 STO .07 [SIGMA]x STO .04 STO .08 [SIGMA]x[^2] STO .01 STO .05 STO .09 [SIGMA]y STO .12 [SIGMA]xy STO .11 [SIGMA]x[^2]y STO .10 1 1 3 . 0 3 0 3 ENTER 1 2 2 . 0 3 0 1 # 125 LINEQS RCL .15 STO A RCL .14 STO B RCL .13 STO C RTN // Evaluate Ax^2+Bx+C polynomial at regX LBL C ENTER RCL* A RCL+ B * RCL+ C RTN END ``` Marcus von Cube, Germany Posting Freak Posts: 3,283 Threads: 104 Joined: Jul 2005 06-13-2013, 02:35 AM Hi Andrew, nice submission. :-) It will find its way into the library if Pauli or I find the time to integrate it. Paul Dale Posting Freak Posts: 3,229 Threads: 42 Joined: Jul 2006 06-13-2013, 02:44 AM It is in the library now :) I've not included it in the standard library in flash. - Pauli « Next Oldest | Next Newest »

 Possibly Related Threads... Thread Author Replies Views Last Post HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 1,455 11-11-2013, 08:28 PM Last Post: Davi Ribeiro de Oliveira Best statistical fit Richard Berler 8 1,619 10-30-2013, 11:25 PM Last Post: Walter B Quadratic & Cubic Regression RPN progs Matt Agajanian 9 1,718 09-17-2013, 11:37 AM Last Post: Jeff O. program print in wp34s Andrew Nikitin 13 1,965 07-22-2013, 10:11 PM Last Post: Andrew Nikitin New empirical fit for ln(x) Namir 0 472 12-11-2012, 12:49 PM Last Post: Namir [WP34S] WP34S firmware on the AT91SAM7L-STK dev kit? jerome ibanes 1 706 10-04-2012, 04:59 PM Last Post: Paul Dale New Quadratic Lagrangian Interpolation Method Namir 2 788 07-20-2012, 04:32 PM Last Post: Namir Fast Quadratic Formula for the HP-41C Gerson W. Barbosa 21 3,651 07-18-2012, 08:53 AM Last Post: Gerson W. Barbosa Quadratic formula program help Chris C 18 2,924 06-16-2012, 12:14 AM Last Post: Matt Agajanian WP34S program question Mike Maiorana 12 1,886 04-05-2012, 03:09 AM Last Post: Steve Simpkin

Forum Jump: