Jump to article
< >

Active GUI element

Static GUI element

Code

WPS object

File/Path

Command line

Entry-field content

[Key combination]

more

Java Programs and eComStation
The PolySolve Applet

by Niels Jensen, © October 2006

Niels JensenNiels Jensen is using eComStation at home and at work on a T42p while interacting with co-workers, who are exclusively using Windows. He has been using OS/2 since version 2.1, and the Dept. of Chemical Engineering at Technical University of Denmark, where he works, has been using OS/2 for multivariable control and monitoring of a heat integrated industrial scale distillation column since the late eighties.

When dealing with measured data, one often has to find a function that describes the set of data. While the process of a regression isn't difficult in the linear case, things get complicated for polynomials of higher degrees. So why not let the computer do the work for you? As first part of a loose series of short reviews of Java applets and applications, Niels Jensen takes a look at the PolySolve Java applet.

With both the freely available Java™ Development Kit J2SE™ 1.4.2 from Innotek Systemberatung, and the native Golden Code RTE and SDK of J2SE 1.4.1_07, eComstation and OS/2 users have a good platform for running Java applications and applets.

The price for the native port from Golden Code Development is US$ 42 [€33.45] for a single user license.

In this and a few follow up articles I take a look at some Java programs and applets that I have found useful. The criteria for selection of these programs have been:

  1. They satisfy a need I have to perform a certain task, i.e., searching news at eComstation.com or fitting data to polynomials.
  2. They run with the current available JDK from either Innotek or Golden Code Development.
  3. They should run locally on my desktop—or plans for development of off-line versions should be in place.

PolySolve

PolySolve is a Java applet primarily for regression of polynomials of the form:

f(x) = a0 + a1 x + a2 x2 + a3 x3 + a4 x4 + .....

The applet—if suitable data are provided—can also calculate the coefficient in the following trigonometric expression:

f(x) = a0 + a1 cos(2π x) + a2 cos(4π x) + a3 cos(6π x) + a4 cos(8π x) ...

However, I don't know of a scientific application of this type of function.

Operation is very simple: You enter a set of x,y value pairs in the top panel, select the type of regression and degree of polynomial, and press Solve. PolySolve outputs the graph, the correlation coefficient r2 and the standard error for estimating the regression quality, and of course the function itself.

PolySolve applet

Figure 1. PolySolve running as applet on my desktop. [Larger image]

Since I frequently use PolySolve, I have created a program object for it on the desktop. The properties page for this object is shown in figure 2. It shows the general procedure for creating a program object for a Java applet:

  1. In the Path and file name field give the path to your version of java.exe or javaw.exe, if you don't want to see the Java console window. If your \java142\bin\ directory is listed in your CONFIG.SYS in the PATH statement, then it is sufficient to enter java.exe or javaw.exe. However, I like to give the full path to have control over which version of java is being used. Also the first time you attempt to use a Java program, the information in the Java console could give vital information about why things are not as expected.
  2. In the parameters field write -jar (mind the space!) followed by the name of the jar file, i.e., for PolySolve write -jar PolySolve.jar.
  3. In the working directory field write the path to the directory containing the jar file.
Properties page

Figure 2. Properties page of program object for PolySolve showing setup. I run the applet using Innotek JDK. If you don't want the Java console window, then replace java.exe with javaw.exe. [Larger image]

About CareWare

PolySolve and other programs created by Paul Lutus are CareWare. You can read what this implies at "The CareWare Idea." I found this little gem of a program by simply searching with Google using the as search terms fit, polynomial, and data.

In my daytime job at the Technical University of Denmark I often have a need to fit a limited number of experimental datapoints to a linear equation or a low degree polynomial, and hence PolySolve have become a nice addition to my eComStation desktop.

Formatting: Christian Hennecke
Editing: James Moe
References

PolySolve
Developer: Paul Lutus
Price: CareWare

The CareWare Idea: http://www.arachnoid.com/careware/index.html
GOLDEN CODE® J2SETM FOR OS/2, Golden Code Development, URL: http://www.goldencode.com/ (viewed 2005-0526).
Lutus, P. (2003): "Polynomial/Trig Regression Data Fit", URL: http://vps.arachnoid.com/polysolve/index.html (viewed 2005-05-24).
OS/2 Kit for Java, Innotek Systemberatung GmbH, URL: http://www.innotek.de/products_e.html (viewed 2005-05-26).