I have modified mi pr.ogs script, the one that makes these polynomial regressions, to give the equation of the polynomial after the fitting. I added in a couple of places (there are two different output styles, something like "full" and "simplified", and I wanted it in both) the following lines:%o=y=$(Stat.PR.A,*15); // Independent term of the function, full precision (15)
for (ii=1;ii<=stat.pr.order;ii+=1) // Do this from 1 to the polynomial order, to include all terms
{
if($(Stat.PR.B$(ii))>=0) {%o=%o+$(Stat.PR.B$(ii),*15);}
else {%o=%o$(Stat.PR.B$(ii),*15);}; // Dependent terms coefficients, (taking care of the sign), full precision (15)
%o=%o*x^$(ii); // Coefficient multiplies the ii power of x
}
type %o;
The full precision is necessary when you want the function to fully reproduce the fitting, mainly when using high-order polynomials.
The output of this code, directed to the script window, must be something like
y=0.478790630070108-0.0308866691670104*x^1+1.00152612350376*x^2
All you have to do, to define your new function, is to change the "y=" with something like "f2(x)=" and execute the line, creating with this a new function called f2.
Of course, you don't need to modify the pr.ogs script. You can also paste this code to your script window and run it right after the fitting. It will avoid the hard work of taking the parameters from the result table and constructing the function. You could also modify my code in the last line inside the loop, for example replacing "X" with "col(A)", to make a function to be pasted in the "Set column values" dialog box.
Hope this helps.
jose.
[This message has been edited by Jose (edited 08-02-2000).]