d89-bfr@sm.luth.se (d89-bfr) (12/14/89)
Curve fitting programs. How many times have you been annoyed by the fact that linear regression isn't enough. These programs can handle polynomial, logarithmic and exponential curves. You have these samples Y 4.0 17.0 62.0 157.0 569.0 320.0 1397.0 2012.0 X 1.0 2.0 3.0 4.0 6.0 5.0 8.0 9.0 I suspect that this is a polynomial function. Let's try. Enter [[1 5[ [2 17] [3 62] [4 157] [6 569] [5 320] [8 1397] [9 2012] My guess is that it's a polynom of degree 4. 4 [PFIT] [[5.00] [-2.00] [-2.00] [3.00] [3.88E-9]] So. The furmula is, y=3*x^3-2*x^2-2*x+5. Let's try enother curve. Y 20 2.5 0.74 0.31 X 1 2 3 4 5 6 PFIT [7625] << SWAP TRN -> n s << [[ 0 1 ]] s * TRN [[ 1 0 ]] s * -> b sa << 1 sa SIZE 2 GET FOR x 0 n FOR p sa x GET p ^ NEXT NEXT sa SIZE 2 GET n 1 + 2 ->LIST ->ARRY DUP TRN -> a at << at b * at a * / >> >> >> >> LFIT [4715] << -> a << a SIZE LIST-> DROP -> r c << 1 r FOR x 1 c FOR y a x y 2 ->LIST GET LN a SWAP x y 2 ->LIST SWAP PUT 'a' STO NEXT NEXT a 1 PFIT DUP 1 GET EXP 1 SWAP PUT >> >> >> EFIT [D4DE] << -a << a SIZE LIST-> DROP -> r c << 1 r FOR x a x 2 2 ->LIST GET LN a SWAP x 2 2 ->LIST SWAP PUT 'a' STO NEXT a 1 PFIT DUP 1 GET EXP 1 SWAP PUT DUP 2 GET EXP 2 SWAP PUT >> >> >> No calculation of error yet. It might come in the future. Have fun. _ /Bjorn.