Quadratic fit without linear algebra (32SII) - NOT only for statistics lovers - LONG « Next Oldest | Next Newest »

 ▼ Tizedes Csaba [Hungary] Member Posts: 97 Threads: 25 Joined: Jan 1970 06-25-2004, 07:01 AM Hello, I want to fit quadratic equation curves to pumps' characteristics, but I dont want to use linear equation solver, and I want to use only my 32SII. And I dont want to store the points' coordinates. ```############################################ # # # What do you think about this method??? # # # ############################################ Let y=A*x^2+B*x+C, the derivative is: y'=2*A*x+B == m*x+b, so A=m/2, and B=b. And if we minimize the sum of calculated and given y's differece's square, we give C=AVER(y)-A*AVER(x^2)-B*AVER(x). AVER() is average function. Here is the 32SII version: LBL S #First start CLSum INPUT X STO I STO U x^2 STO K INPUT Y STO J STO V LBL I #Input more points INPUT X ENTER STO+I x^2 STO+K Roll Down RCL-U INPUT Y STO+J RCL-V / 1/x #End of numerical differentiation RCL X RCL+U 2 / Sum+ RCL X STO U RCL Y STO V n 1 + STO N VIEW N GTO I LBL C #Calculating A, B and C m 2 / STO A VIEW A b STO B VIEW B RCL J RCL A RCL*K - RCL B RCL*I - RCL/N STO C VIEW C RTN LBL S: CK=BE1E 15.0 LBL I: CK=D9ED 42.0 LBL C: CK=C868 30.0 Variables: A, B, C: Coefficients X, Y: New point coordinates U, V: Old point coordinates I: SumX J: SumY K: SumX^2 N: Number of datapoints And statistic registers Usage: 1., Sort the datapoints in increasing order of X 2., Start program with XEQ S 3., Enter the datapoints (No correction available!) 4., If you entered the last data, and you see N=... screen start the coefficient-calculator routine: XEQ C ===================================================== An example: ----------------------------------------------------- MEASURED CALCULATED Q H H_Excel H_HP32SII Delta%_HP32SII (flow) (head) [m3/h] [m] [m] [m] [%] ----------------------------------------------------- 0 90.0 90.0 90.0 0 30 90.2 90.2 90.2 -0.02 60 86.4 86.5 86.5 +0.13 90 79.0 79.0 79.0 -0.01 120 67.7 67.6 67.6 -0.12 150 52.4 52.4 52.4 0 ----------------------------------------------------- And the coefficients: Excel HP32SII A -2.133E-3 -2.139E-3 B +6.956E-2 +7.017E-2 C +9.000E+1 +9.000E+1 ``` Enjoy! :D Csaba Edited: 28 June 2004, 3:26 a.m.

 Possibly Related Threads... Thread Author Replies Views Last Post HP prime: linear solver app Alberto Candel 1 711 11-21-2013, 01:57 AM Last Post: Michael Carey HP Prime: Linear Solver app bug BruceH 0 514 11-15-2013, 06:36 PM Last Post: BruceH HP Prime: Long integers (continued) Helge Gabert 2 792 11-07-2013, 11:24 AM Last Post: Helge Gabert HP Prime: Pass "Long" Integers to a Program Helge Gabert 6 1,339 11-03-2013, 01:12 PM Last Post: Helge Gabert Best statistical fit Richard Berler 8 1,477 10-30-2013, 11:25 PM Last Post: Walter B HP Prime polynomial long division bluesun08 13 1,943 10-30-2013, 03:29 AM Last Post: parisse Quadratic & Cubic Regression RPN progs Matt Agajanian 9 1,509 09-17-2013, 11:37 AM Last Post: Jeff O. New article on a new type of neo linear equations Namir 0 650 08-11-2013, 10:27 AM Last Post: Namir Linear Optimization/Programming fhub 14 1,960 08-04-2013, 06:27 AM Last Post: fhub weird statistics bug in wp34s Andrew Nikitin 5 1,176 06-20-2013, 01:54 PM Last Post: Namir

Forum Jump: