Site hosted by Angelfire.com: Build your free website today!

Screenshot      Frequently Asked Questions     Tutorials

PAD-Description     EULA      Download Power-Surface v1.5
 

Power-Surface: Power-Series LSq-Fitting & Saw-File
v1.5

Power-Surface offers linear/ quadratic/ higher-power least-square curve/ surface fitting for the given column-wise numeric data for a function z = f(x) or z = f(x,y) of one or two independent variable(s), so that the fitted function is of the form z = a + b.x + c.x2 +... or z = a + b.x + c.y + d.x2 + e.xy + f.y2 +... respectively.
To perform the fitting, the aforesaid algebraic power series function is assumed, and then the sum of the squares of deviations of z-values (for the given points) from the assumed function-value is minimized, thereby generating a set of linear simultaneous equations. This set is then auto-solved by standard Gaussian-elimination method, giving the fitting parameters (coefficients)
a, b, c etc. (users should refer to the tutorials). To avoid calculation errors, constant factors and decimal-points in the given (x,y,z) data are first shifted but finally re-corrected. The Saw-File subroutine allows vertical copying/pasting of numeric data columns from text files.

This Windows package (screenshot shown below) has been developed (using the Visual FoxPro 6 platform) by Rituraj Kalita of Guwahati (India) first in 2005 as a part of a theoretical-chemistry package, but since 2007 it is also available as a separate freeware (i.e., free software), and is being distributed free of cost by Eastern Star Software, Guwahati. 


Fig.: Power-Surface Screenshot
 

Now, please do spare a few more minutes to go through the following 'Tutorials' and 'Frequently Asked Questions'!

A. Frequently Asked Questions:

01. I know that we may run Power-Surface by double-clicking at the desktop icon named Power Surface. How do I get that desktop icon?
This icon should automatically appear at your Windows desktop. If it didn't, open the working folder (e.g., C:\PwrSurface), starting from, say, My Computer. From that working folder find and copy the link file named Power Surface, and then paste that to your Windows desktop to facilitate running the Power-Surface application in future.

02. I keep getting an error message:
Row or column position is off the screen! whenever I try to run (i.e., open) Power-Surface. Where is the problem?
Most probably your monitor (VDU) screen resolution (screen area in Windows terminology) is not set to a level high enough (i.e., at least to a level of 800 by 600 pixels). You may try improving this particular Windows setting (via Control Panel - Display) -- it should work in most cases. The Windows XP 'themes' and the Windows display font-size (either 'small' or 'normal' font-size is the desired one) may also matter in some situations.

03. How should the numeric data for the known (x,y,z) [or (x,y)] points be fed into Power-Surface?
As it says in the opening screen of the program interface, the given data points (x,y,z) is to be specified in a text file with .txt extension, having three (space-separated) columns for the coordinates as x y z with at most 9 places before & 9 places after decimal, or in 1.23E45 form. A least-square n-th power fitting (where n = 1, 2, ..., 9) z = a + b x + .... will then be tried by solving the resulting equations in the coefficients a, b etc. [Two examples of such data-input '.txt' files, namely PS Ind1Var.txt & PS Ind2Var.txt for data-points representing function of one or two independent variables respectively, are available at the program's working folder.]

04. I fed in only the (x,y,z) data via the input text file. Then, what is 'zeta'? What are (u,v,w)? Why don't I remember hearing about any of them in any mathematics textbook?
This developer has coined these new quantities himself, aiming to minimize the computer-calculation numerical errors during the complicated data-fitting job. As an example, let us consider the (x,z) data-points [(1,24002), (2,24004), (3,24006)] arising out of an underlying function z = 2x + 24000 -- won't it be better for the accuracy of the (linear least-square fitting) calculation, if the constant-factor 24000 is removed from the data-points (before the fitting calculation begins)? Introduction of zeta does exactly that, removing the lowest value z_low from the z-values (using a transformation zeta = z - z_low). Similarly, let us consider the data points [(1,0.000000002), (2,0.000000004)] for the background function z = (0.000000002)x -- won't it be better for the computer-computational accuracy if we instead work with the transformed, decimal-shifted set [(1,2), (2,4)]? This very example explains the necessity of the decimal-shifted (u,v,w) [or (u,w)] data set. It's, naturally, no coincidence that you didn't read about them earlier!

05. I once came across an error message: "The number of coefficients will be more than that of points!! Leaving this program...". How can I know what will be the number of coefficients, and how do I keep it controlled within the mandatory upper limit of the number of points?
For a function [say, z = f(x)] of one variable, the number Cn of coefficients equals the order n of fitting plus one -- thus, for a quadratic (n = 2) one-variable-fitting, Cn is 2 + 1 = 3. However for a function [say, z = f(x,y)] of two variables, no. of coefficients Cn would equal (n+1)(n+2)/2 where n is the order of fitting. Thus for a quadratic two-variable-fitting, Cn is (2+1)(2+2)/2 = 6.

06. I, at present, do not want quadratic or higher-power fitting for a function of two independent variables, but just want to perform a linear least-square fitting. Can I do that simple job here?
Yes, surely. Just use a two-column data-points representation, and set the Perform ... Fitting option to L (or to 1) from the default Q.

B. Tutorials:

01. Performing a 4th-power power-series-fitting for the points-data stated in the file 'PS Ind1Var.txt' representing a function of one independent variable:
    Within the working folder (say, C:\PwrSurface) locate and open the file PS Ind1Var.txt (say, by double-clicking) to check its points-data: you'll see the five points (0.0,0.010), (1.0,0.060), (2.0,0.250), (3.0,0.620) & (4.0,1.230) stated therein. Now, (if you are told) you may easily verify that these (x,z) points stand for the function z = (0.01).x3 + (0.03).x2 + (0.03).x 0.01. Let us see whether we can find out this unknown background function just from this set of points-data. Let's proceed:
    Open Power-Surface, go through the opening screen meticulously, then click at
Choose the File button to select and finally choose the text file PS Ind1Var.txt specifying the points to be fitted. There are 5 given points in this file, so we can't go for an order higher than the 4th (as Cn = n+1, see answer to question 5 above). In the Perform Linear(L) or Quadratic(Q) fitting entry, so let us fill-in 4 (to mean 4-th power). [You may also do that by clicking a few times in the Choose L/Q/3/4 button.] As the points data here are of two-column nature, so obviously the number of independent variables is 1 (the second column standing for the dependent function z). So, in the Set number of independent variables to one or two entry, fill-in 1 (may do that by simply clicking once at the Choose 1 or 2 button). Click Continue
   
In the next screen you'll first come across some database displays, showing the (x,z) points accepted and then the transformed (u,w) points. Just view & close these displays. The 5 equations involving the fitting-coefficients are then shown. Click Continue. These equations, transformed to the upper triangular form, are then shown. Again click Continue. Their solutions giving the fitting-coefficients, and verification of these solutions of equations are then shown -- you'll find that the verification are OK. Next, again click Continue to investigate presence of any minimum (or maximum, as you choose). The fitting process is now complete: you may either interpolate for some more points or view the detailed, exact-calculation output. In this detailed text-file-output you'll find the fitted function both in a verbally-described form (with coefficient-values stated one by one) and also as an Assam-Calcu-Command (that may be pasted in an expression-based calculator-software such as in Assam-Calcu, this particular package being available from geocities.com/riturajkalita/AssamCalcu.htm and also being hosted by download.com, softpedia.com, webgrid.co.uk etc.)
    You'll find that the fitted function is
z = 0.01 + 0.03*x + 0.03*(x**2) + 0.01*(x**3) + 0.00000000000000718*(x**4) which is, practically speaking, the (hidden) background function itself!

02. Performing a quadratic (2nd-power) power-series fitting for the points-data stated in the file PS Ind2Var.txt representing a function of two independent variables:
    Within the working folder of Power-Surface, locate and open the file PS Ind2Var.txt (say, by double-clicking) to check its points-data: you'll see the seven points (1,1,3), (1,2,7), (2,1,7), (2,2,13.0), (2,3,21.0), (3,2,21.0)& (3,3,31.0) stated therein. You may easily verify that these (x,y,z) points stand for the function z = 1 x y + x2 + 2xy + y2. Let us again check whether we can find this unknown background function just from this set of points-data. Let's proceed:
    Open Power-Surface, and then click at
Choose the File button to select and finally choose the text file PS Ind2Var.txt specifying the points to be fitted. There are 7 given points in this file, so we can't go for power (order) higher than the 2nd [as, for functions of two variables, Cn = (n+1)(n+2)/2 (note: Cn is 6 for n = 2, but 10 for n = 3) which mustn't be more than 7, the number of points]. In the Perform Linear(L) or Quadratic(Q) fitting entry, so let us keep Q or 2 (to mean 2nd power or quadratic fitting) -- as Q is already there, let us leave this entry as it is. As the points-data here are of three-column type, so obviously the number of independent variables is two. So, in the Set number of independent variables to one or two entry, we need to keep 2 (as 2 is already there, leave it as it is). Click Continue.
    In the next screen you'll first come across some database displays, showing the
(x,y,z) points accepted and then the transformed (u,v,w) points -- just view & close these displays. The 6 equations in the fitting-coefficients a,b,c etc. are then shown. Click Continue. These equations, transformed to the upper triangular form are then shown. Again click Continue. Their solutions giving the fitting-coefficients (a, b, c, d, e & f) and verification of these solutions of equations are then shown -- the verification will be OK. The fitting process is thus complete: you may either interpolate for some more points or view the detailed, exact-calculation output. In this detailed text-file output the fitted function will be both in the verbally-described form and as an Assam-Calcu-Command
    You'll find that the fitted function is
z = 1 1*x 1*y + 1*(x**2) + 2*(x*y) + 1*(y**2) which is just exactly the hidden, background function!