35s Quadratic Regression


I am new to HP programming and recently acquired a 35s. I was surprised to see it cannot do Quadratic Regression, so I wrote a basic program that will develop the twelve inputs necessary to use the built in 3*3 lin. solve equation.

Q001 LBL Q



Q004 SF 10

Q005 (eqn) QUADREG

Q006 (eqn) TOTAL SETS

Q007 PSE


Q009 STO N

Q010 1

Q011 STO M

Q012 (eqn) X

Q013 PSE


Q015 STO X

Q016 (eqn) Y

Q017 PSE


Q019 STO Y

Q020 STO +D

Q021 RCL X

Q022 *

Q023 STO +H

Q024 RCL Y

Q025 RCL X


Q027 *

Q028 STO +L

Q029 RCL X

Q030 STO +B

Q031 STO +E


Q033 STO +C

Q034 STO +F

Q035 STO +I

Q036 RCL X

Q037 3

Q038 (Y to the X)

Q039 STO +G

Q040 STO +J

Q041 RCL X

Q042 4

Q043 (Y to the X)

Q044 STO +K

Q045 RCL M

Q046 STO +A

Q047 RCL N

Q048 RCL A

Q049 X<Y

Q050 GTO Q012

Q051 RTN

When it is finished, there will be values stored in memory locations A through L. Launch and Solve the 3*3 lin. solve built-in EQN and R/S your way through the already-saved values. It will return the X, Y, and Z results of the Quadratically Regressed X,Y inputs from the program.

If anyone knows a better way to do this, please share!




You can download my free HP-35S Stat Pac from here (the download link is near the bottom of that web page), and look for program NCS_POLY1. This program performs quadratic fitting.


Edited: 2 Feb 2011, 12:06 p.m.


So if I may ask a newbie question, how do I use the solver to solve for various values of Y (or x) in the equation y=ax^2+bx+c?


Press [EQN]

Type "Y=A*X^2+B*X+C" [ENTER], pressing [RCL] before each letter.

Press (right-shift) [SOLVE]

Type the letter of the unknown - no [RCL] needed this time

Provide a value for each prompted unknown followed by [R/S]

After the final [R/S] the value of the unknown will be calculated and displayed.

This is covered in the user's guide, chapter 7. Pay special attention to the bit about initial guesses in 7-8 as that is of particular importance with a quadratic.


Boy, I feel dumb. I did not put the * symbols between the A and X.

Thank you for the help!


Years before I wrote this - It wasn't too popular (I dunno whi... :P ;) )



I just noticed the 30b has this built in. Another + for the 30b.

From the linked post:

   Excel      HP32SII
A -2.133E-3 -2.139E-3
B +6.956E-2 +7.017E-2
C +9.000E+1 +9.000E+1

for the 30b

A -2.1329E-3
B +6.9560E-2
C +9.0000E+1


The 20b has this as well.


I thought that quadratic regressions were only limited to the 30b. The manual confirms this.


Edited: 3 Feb 2011, 5:30 p.m.



You're right, I stand corrected. I misread the statistics section in the combined 20b/30b manual on this.



I hope, you're realized that, my program uses just LINEAR regression to fit quadratic function.


I hope, you're realized that, my program uses just LINEAR regression to fit quadratic function.

Yes, that's a quite clever approach - though not exactly a strict least-square regression. ;-)

Hmm... since some calculators seem to offer a preprogrammed quadratic regression your idea might be used to fit a cubic function on these models...?


Possibly Related Threads…
Thread Author Replies Views Last Post
  Quadratic & Cubic Regression RPN progs Matt Agajanian 9 2,904 09-17-2013, 11:37 AM
Last Post: Jeff O.
  WP34s program submission: Quadratic fit Andrew Nikitin 2 1,232 06-13-2013, 02:44 AM
Last Post: Paul Dale
  OT: Excel regression modeling using VBA Namir 0 854 12-06-2012, 10:05 AM
Last Post: Namir
  Where is linear regression on an HP-41 Palmer O. Hanson, Jr. 22 5,488 08-13-2012, 10:43 PM
Last Post: Gerson W. Barbosa
  New Quadratic Lagrangian Interpolation Method Namir 2 1,338 07-20-2012, 04:32 PM
Last Post: Namir
  Fast Quadratic Formula for the HP-41C Gerson W. Barbosa 21 6,112 07-18-2012, 08:53 AM
Last Post: Gerson W. Barbosa
  Quadratic formula program help Chris C 18 4,814 06-16-2012, 12:14 AM
Last Post: Matt Agajanian
  WP 34S linear regression bug Nigel J Dowrick 9 2,915 05-12-2012, 06:23 PM
Last Post: Paul Dale
  Which quadratic formula is use? Michel Beaulieu 7 2,284 09-29-2011, 10:17 PM
Last Post: Jeff O.
  Dr Bills Quadratic solver for 35S snaggs 6 2,113 09-12-2011, 05:10 AM
Last Post: Pablo P (Spain)

Forum Jump: