Science Tools

W. Christian

Davidson College

Delphi provides excellent tools for building business and database applications. It provides less for the sciences in the way of number crunching and data visualization. It is, however, possible to extend the Delphi tool pallet and we are currently in the process of writing and testing a collection of Delphi components, Science Tools, that make it easy for students to quickly perform many data analysis and visualization tasks.

Science Tools are distributed in compiled Delphi Component Units, i.e., DCU files. Copy these components into your Delphi LIB directory and read the Borland Delphi manual for instructions on how to add these components to your tool pallet. The parser and the ThreeD/Contour plotting component that have been incorporated into these utilities are based, in part, on the CUPS utilities written by William MacDonald and Jaroslaw Tuszynski as part of the CUPS Project. The CUPS project was funded by the National Science Foundation and the CUPS Utilities are freely available for unrestricted noncommercial production and distribution of programs. Users who which to write programs for commercial distribution should contact the publisher of the CUPS series, John Wiley and Sons.

Science Tools DCU files may be downloaded for personal non-commercial use by instructors who are employed at and students who are enrolled in accredited educational institutions. Licenses allowing Science Tools to be used in a course my be granted at ZERO COST by contacting Wolfgang Christian, Physics Department, Davidson College, Davidson, NC 28036. Contact Wolfgang Christian if you require Science Tools source code for special applications.

It is our intention to provide documentation for Science Tools using the standard Windows help file format and on line using HTML. As is often the case, documentation lags behind the development of the software. Please feel free to ask questions about the syntax of a particular Science Tool method. Send suggestions and bug reports to Wolfgang Christian at Davidson College.

We have converted the Windows HELP FILE for Science Tools into HTML hypertext. The conversion is not perfect but you can now use your browser to look up Science Tools syntax and sample code. The best documentation for the tools may be the mini-apps that demonstrate how we use the tools for various programming exercises in our computational physics course.

Science Tools 16 Bit Library (Delphi 1)
SciTools.ZIP The complete package of libraries (*.DCU), forms (*.FRM), and help (*.HLP) files.
SciTools.HLP The help files in case you want to browse. You will need the Win 95 help reader. Get the table of contents too.
SciTools.CNT
SciTool3.HLP The Windows 3.1 version of the help file. Use only as a last resort!
Science Tools 32 Bit Library (Delphi 2- beta)
SciTools2.ZIP The complete package of libraries (*.DCU), forms (*.FRM), and help (*.HLP) files.
Science Tools 32 Bit Library (Delphi 3- beta)
SciTools3.ZIP The complete package of libraries (*.DCU), forms (*.FRM), and help (*.HLP) files.

 

Sample Code

Science Tools are Object Oriented Components that perform common data analysis and visualization tasks with a minimal amount of code. For example, a programmer can drag the SGraph component from the Delphi toolbar, size and position it on the screen using the mouse, and write the following code to produce a graph of a sin function:

var i:Integer; x,y:Double;
begin
for i:=0 to 1023 do
  begin
  x:=4*Pi*i/1023;
  y:=Sin(6*Pi*x);
  Graph.RegisterDatum(1,x,y);
  end;
Graph.Invalidate;
end;

The SGraph object will plot the data to fit using automatic scaling. The SGraph object is smart enough to "remember" that data so that it will repaint the window as required by the operating system. In addition, the user can right click on the graph at runtime to view the data and change the display properties.

A slightly more extensive code fragment that plots two data series is shown below along with the resulting graph. The first series, a Gaussian, is plotted in blue. The second series, random data points, is shown using red triangles. Each series is first cleared to remove old data old data from the graph object. The drawing styles is set and each data point is then registered with the graph object to produce the desired result. This following sample code fragment was extracted from the SciTools.hlp Windows help file.

var i:Integer;x,y:Double;
begin
Graph.ClearSeriesData(5);
Graph.SetSeriesStyle(5,clBlue,True,none);
Graph.ClearSeriesData(6);
Graph.SetSeriesStyle(6,clRed,False,Triangle);
for i:=0 to 100 do
  begin
  x:=i/10;
  y:=exp(-Sqr(x-5));
  Graph.RegisterDatum(5,x,y);
  y:=y+Random(1000)/10000;
  Graph.RegisterDatum(6,x,y);
  end;
Graph.Invalidate;
end;


Copyright 1996 Wolfgang Christian