SciPlot
ã Michael Wesemann 1991/92,   Version 1.73 (080892/230)

General Help

SciPlot is a scientific 2D plotting and manipulation program. Various functions are available in SciPlot:

  - ASCII import and export 
  - EPS export
  - selective open and save 
  - plotting in many styles
  - linear and logarithmic axes
  - two different axes
  - text and graphic
  - color support
  - absolut,relative, and free defined error bars
  - normalizing and moving
  - add and subtract data 
  - background subtractions (linear,shirley,tougaard, bezier)
  - integration and relative integration
  - simple calculations (+, -, *, /, sin, cos, log, etc.)
  - least square smooth and FFT smooth
  - diiferentiation
  - axis conversions 
  - FFT 
  - ESCA calculations

and  some others. 

The basis of 2D plotting is a set of XY data (and maybe error bar values). Within SciPlot  these data are stored in data buffers which are managed by the File Inspector. The number of data buffers and the number of XY pairs (points) is free. Another important thing is the Inspector . He controls all the manipulations you can do. At the top of the Inspector  a pulldown menu appears which allows switching between different subinspectors.

There are three ways to import data into SciPlot: 

1. Import from a ASCII file which should have a defined format (look up in the Import help file) 

2. Enter data directly within the Edit Inspector.

3. Get data via the pasteboard by clicking the Services menu item in another program (e.g. Edit). This works only if SciPlot is installed in LocalApps, ~/Apps or another known NeXTStep search path. After installing, you have to relogin.

After data are entered they may be manipulated in several ways, plotted, exported to an ASCII file, or saved in a SciPlot specific data format.

LICENSE
SciPlot is Shareware !
Everybody can copy and distribute SciPlot as often as he wants. If you use SciPlot regularly please remit DM 50 or $ 35 (see below).

Registered users automatically receive updates of SciPlot and I shall also try to implement their special wishes (e.g. for scientific manipulation functions I perhaps never heard of before (source is welcome)).

Comercial distrubution is strictly forbidden without the permission of the author.

WARRANTY
There is no warranty whatsoever for SciPlot. The entire risk of using the program lies with you.

ACKNOWLEDGMENT
Some people from the usenet helped me with their suggestions and bug reports some other people with their  programing know how. My workgroup was (is) very helpful because I guinea-pigged them for excessive beta testing. And last not least thanks to Waruno Mahdi for implementing some of the mathematical stuff.

Send suggestions and bug reports to:
  
	 Michael Wesemann
	 Fritz-Haber-Institut der MPG
   	 Faradayweg 4-6, 1000 Berlin 30, Germany 	
	 mike@fiasko.rz-berlin.mpg.de
	 
	Verbraucherbank Berlin
	Blz: 20220300	Ktn: 5004997539	

Menu

This chapter describes the main menu of SciPlot.

Info/Info Panel
Displays the SciPlot info panel.

Info/Help
Activates the help function.

Document/New
Open a new document window.

Document/Open New
Open a new document window and load SciPlot file.

Document/Open
Load SciPlot file into the current document.

Document/Save
Save the current document.

Document/Save As
Save the current document after entering a filename in the Save Panel.

Document/Open Selective/Data
Load the data only from an SciPlot file.

Document/Open Selective/XY Range
Load the XY range information only from an SciPlot file.

Document/Open Selective/Graphic Attributes
Load the  graphic attributes only from an SciPlot file.

Document/Open Selective/Text & Graphic
Load the text and graphic objects only from an SciPlot file.

Document/Save Selective/Data
Save the data only to an SciPlot file.

Document/Save Selective/XY Range
Save the XY range information only to an SciPlot file.

Document/Save Selective/Graphic Attributes
Save the graphic attributes only to an SciPlot file.

Document/Save Selective/Text & Graphic
Save the text and grafik objects only to an SciPlot file.

Document/Import
Import ASCII file into the current document. For more information look up in the Import help text.

Document/Export
Export of data buffer to an ASCII file. For more information look up in the Export help text.

Document/Save EPS
Save the current document as EPS file.

Window/ ...
This submenu is the standard NeXTStep window submenu. Look up in the NeXT documentation for more information.

Tools/Inspector 
Bring up the Inspector.

Tools/File Inspector 
Bring up the File Inspector.

Tools/Color Panel 
Bring up the Color Panel.

Tools/Font Panel 
Bring up the Font Panel.

Tools/Window Defaults/ ...
This submenu contain items which represent default window formats.

Tools/Plot Frame Defaults/ ...
This submenu contain items which represent default plot frame formats.

Print 
Print the current document.

Edit/ ...
This submenu is the standard NeXTStep edit submenu. Look up in the NeXT documentation for more information.

Hide
Hide SciPlot .

Quit
Quit Sciplot.

Mouse Mode

A button matrix appears in the lower left corner of the Inspector which allows you to specify the mouse mode. Different mouse modes are necessary because SciPlot supports many mouse manipulation functions. If you click one of these buttons it will be highlighted and the name of the mode is displayed in the title row.

Y-Move, X-Move, XY-Move
Move the current buffer by clicking (somewhere inside the plotwindow) and dragging to the new position.

Y-Norm, X-Norm
Normalize or move or cut the selected buffers by entering values for the old and new  positions in the Normalize  Inspector. After clicking in the plotwindow, a horizontal or vertical mark appears and you can drag it to the first old value (position). This must be done twice, once for each value.

Text & Graphic
Create, move, delete, and duplicate text and grafik objects. For more information look up in the Text & Graphic Inspector help text.

Move Legend
Move the automatically generated legend by clicking inside it and dragging. 

Linear Background
Specify a linear Background by clicking one point and defining the desired line by dragging to a second point.

Shirley/Tougaard Background
For these backgrounds you have to click two points as range limits.

Bezier Background
After selecting this mode and clicking in the plotwindow a template bezier appears and you can change it by dragging any of the four reference points (look up in the Normalize Inspector  help text).

View
Add subviews to the current document by clicking inside the plotwindow and pull down a rectangle for the new subview.

Change Views 
This function allow graphically modifying the position and size of your views. Clicking inside a subview and dragging changes the position of the subview. Clicking to one of the marked edges of a subviewframe and dragging resizes the subview. Clicking to one of the marked edges of the plotframe (which could also be changed in the Main Graphic Inspector) and dragging resizes the plotframe.

Integrate
Integrate the selected buffers by dragging two vertical lines to the desired integration limits (see X-Norm, Y-Norm). The selected values are also sent to the linear regression part of the Fit Inspector.

Zoom
Zoom a specified region by clicking inside the plotwindow and pull down a rectangle.

Measure
Displays the mouse position in the Main Inspector  (look up in the Main Inspector  help text).

File Inspector

The File Inspector is the place to manage your data buffer. Within the File Inspector you can copy, delete, duplicate and swap data buffers.You can mark buffers as active and choose a buffer for current processing.

The table display in the File Inspector allocates a row for each buffer.  Every row contains information about the buffer like buffernumber, number of points, source, comment, etc.

Active (selected) buffers are displayed with a gray background. Switching between active and passive is simply done by clicking into the row (but outside the C,X,Y and L column, see below).  Another method for selecting is to click the buttons  Select, Unselect or Invert.

Control-Clicking to a row makes it the only one selected and  the current buffer.

Clicking the Remove button deletes all selected buffers. Clicking the Duplicate button duplicates all selected buffers.

Clicking and dragging a row over another (Û appears in the first row) swaps the two buffers, dragging between two rows  (Þ appears in the first row) moves the buffer. Dragging the row to an unused area  (ß appears in the first row) of the File Inspector duplicates it.

The Hide/Show switch changes the display mode for the current document. If Show is selected the current buffer will be plotted in black and all the other ones in light gray.

C Column
The current buffer is marked with an arrow in the C column of the File Inspector table. Clicking to a row in the C column changes the current buffer.

No Column
The No column shows the buffer number (e.g. needed for Add and Subtract)

X Column
The X column displays the number of the X axis (1 = lower X axis, 2 = upper X axis)  to which the buffer depends. Clicking inside this column toggles the X axis. (look up in the Data Grafik Inspector help text).

Y Column
The Y column displays the number of the Y axis (1 = left Y axis, 2 = right Y axis) to which the buffer depends. Clicking inside this column toggles the Y axis. (look up in the Data Grafik Inspector help text).

L Column
This column displays a bullet if the automatically generated legend for the buffer is on. Clicking inside this column toggles the legend for the buffer on/off. (look up in the Data Grafik Inspector help text).

Points Column
Displays the number of points in the buffer.

Source Column
Displays the Source (e.g. the filename) of the buffer.

Comment Column
Displays the comment for the buffer. In the field at the bottom of the File Inspector  the comment for the current file can be edited.

Import

After clicking the Import menu item an Open Panel appears and one or more ASCII file can be selected for importing.

SciPlot supports three ASCII formats (which can be selected in the Open Panel). In all formats any character which cannot be part of a number can serve as delimiter between numbers.

Multicolumn Import

    	[X-Value]   [Y1-Value]   [Y2-Value]   ...   [Yn-Value]

The X Column Field allows to specify the column number which is to be assigned to X (default is 1).

Error Bar Import
This method allows importing data in 2,3 or 4 columns. Mixing of 2,3 or 4 column rows in one file is possible.
         
           	[X-Value]   [Y-Value]  
 or      	[X-Value]   [Y-Value]    [plus/minus error] 
 or      	[X-Value]   [Y-Value]    [plus error]   [minus error]

One Column Import
Is for one column data. The complementary value (X or Y) will be set equal to the data point sequence number.

Comments
If Comment Enabled is selected (in the Open Panel) SciPlot supports the following syntax for importing comments and axis text:

COMMENT<n>: comment	import comment for column n
XTEXT: text 		import x axis text	
YTEXT: text 		import y axis text	

Begining from the first comment character (defined in the Comment Character  field) the rest of the line will be ignored. 

Export

After clicking the Export menu item an Save Panel appears and a filename can be selected for exporting. The Export Save Panel contains switches for selecting the export mode:

The first radio button defines which buffer should be exported. If Current Buffer  is selected only the current buffer will be exported. The All Buffer  mode exports all buffers and appends the buffer numbers to the filenames.

The second radio button lets you select the order in which  the data will be exported. There is also the possibillity to export either the X or Y value only.

The third radio button is used to enable/disable comment and axis text exporting.

With the last radio button the line-end-character can be defined. Lf  is the normal mode and Cr/Lf  is only needed for PC's or other low level computers.

Text

All SciPlot text functions support tokens which allow indexing and  plotting of special characters (e.g. Greek).

&^text&      	high index
&_text&      	low index   
^x           		single high index
_x          		single low index   
%%           	percent
%&           	ampersand
%_           	underline
%^           	circum
%0           	degree
%9	          	angstrem
%(a-z,A-Z)	Greek characters
%#xxx        	character xxx (decimal)
%$xxx        	symbol character xxx (decimal)
@       		axis exponent (only axis text function)

Colors

The default color for SciPlot is a white background with black texts and graphics. Other colors can be selected in the color panel. Clicking an item in the pulldown menu sets the object (background, frame background, frame, axis text, ticks/grid) to the currently selected color.

If you enter a text or graphic object it takes automatically the current color from the color panel. 

The data graphic inspectors Set Color  button works like the Set  button  (look up in the data graphic help text).

Fonts

Fonts can be changed via the NeXTStep font panel in the following way:  Select a font  in the font panel and click the Set button. After this is done click one of the four buttons in the pulldown menu to specify the place where the font should go. The Scale Text Font, Axis Text Font  and Legend Font  buttons directly effect the current plotwindow. The Text Font button places the font definition into the Text & Graphic Inspector.

Main Inspector

The Main Inspector is the lower part of the Inspector panel and consists of a few important controls.

Mouse Mode Button Matrix
This is used to switch between different mouse modes. If you click one of these buttons it will be highlighted and the name of the mode is displayed in the title row. For more information look up in the Mouse Mode help text.

1.Ax/2.Ax
The 1.Ax/2.Ax switch define the current work axis, e.g. for measure, normalize, relative text and graphic setting, etc.
 
Position Display
The position display shows the mouse position when the mouse mode is Measure (Xm, Ym) and when you do other manipulations with the mouse (Xc, Yc), e.g. zoom, normalize etc. 

The following buttons are part of the pulldown menu with Plot as the first button:

Plot
The Plot button updates your plotwindow. This is necessary after some operations, e.g. after changing the selection in the File Inspector.

Rescale
Clicking this button rescales your plotwindow so that all selected buffers are optimally displayed.

Upscale
After clicking this button your plot is 50% bigger. This is sometimes useful, e.g. to optimize the bezier background.

Scale and Set
Clicking the Set Button stores the XY-Range from the current window and the current axis. The Scale Button sets the  XY-Range to the values which are previously stored with Set (maybe from another document). 

Window Inspector

The Window Inspector controls the plotwindows and subviews.

Window Control
This part of the inspector  contains the controls for  defining the plot direction, plot range, quick plot mode, and the print magnification.  

The Quick Plot Radio button enables/disables the quick plot mode. The quick plot mode is useful with plots which contain a large number of data points.  

Normally the printer output has the same size as the screen graphic. With the Print Magnification slider you can change this.

Grid Control
The Grid Control allows the definition of a grid for all mouse actions in your documents.

View Control
The View Control displays (controls) the size and location of the current (sub)view.

Main Graphic Inspector

The Main Graphic Inspector controls the main graphic attributes of your plotwindow.

Left X Margin, Right X Margin,
Lower Y Margin, Upper Y Margin
This is the margin (in screen dimensions) between the plotframe and the windowframe. See also to the Mouse Mode help file (Change Views).

Tick Width, Minor Tick Width
The width of the ticks on the axes.

Tick Length, Minor Tick Length
The length of the ticks on the axes.

Frame Width
The width of the plotframe rectangle.

Frame Style
The Frame Style radio button selects the style of the plotframe.

Data Graphic Inspector

The Data Graphic Inspector controls the graphic attributes which belongs to a data buffer.

Line Size, Symbol Width, Dot Width 
Defines the width of the data symbols and lines.

Symbol 
Selects a symbol or line type for the current data buffer (works only if  Automatic Setting is off, see below).

Line Type 
The Line Type radio button defines the plotstyle for a data buffer.

Error Bars 
The Error Bar  control allows displaying of relative or absolute error bars in your graphic. If absolute (Abs) is selected you can enter a real value in the error field. If relative (Rel) is selected the input value will be treated as percent of the data point.

Automatic Setting 
The Automatic Setting radio button is used to switch between two different Set modes. If Off is selected the Set and Set Color button effects the current data buffer only. When On is selected the Set and Set Color button effects all selected buffers and assigns different symbols or colors for each.

Auto. Color Mode 
Defines the mode for automatic color setting. The radio button allow to switch between contrast mode and rainbow mode.

X Axis and Y Axis
The X Axis and Y Axis radio buttons allow to specifiy to which axis the current data buffer belongs. 

	1. Axis =  lower Y 	&   left X Axis
	2. Axis =  upper Y 	&   right X Axis  

Legend 
The Legend radio button toggles the automatically generated legend for each buffer on or off.

Axis Graphic Inspector

The Axis Graphic Inspector controls the axis graphic attributes.

The X1/Y1/X2/Y2 switch at the bottom of this inspector allows switching between the four axes.

Ticks, Minor Ticks 
Defines the tick style for the ticks on the X and Y axis.

Ticks Text, Minor Ticks Text
Toggles the text for the ticks and minor ticks on or off.

Axis Text
Defines the position for the axis text.

Tick Style
Defines the tick style both for ticks and minor ticks.

Scaling
Toggles between linear and logarithmic axis plotting.

Exponent Limit
Permits you to define the limit, above which numbers are plotted in exponential notation.  The number you define with the slider is the exponent of the limit.   

Automatic
Normally SciPlot determines the optimal distance between ticks and minor ticks automatically but if you select Off  within the Automatic control you can define the tick distances manually. In logarithmic mode only the Min. Steps value is relevant.

Text 
The text field in the Axis Inspector represents the axis text. The position for the axis scale decimal exponent is marked in the text field by an '@' and will be filled in by the program which computes the exponent automatically.

Edit Inspector

The Edit Inspector allows entering and changing of data values and error bar values from the current data buffer. Clicking the Set button sends the new values to the buffer. Clicking the New button creates a new buffer with the values from the Edit Inspector.

Possible line formats:

   	[X-Value]   [Y-Value]  
 or      	[X-Value]   [Y-Value]    [plus/minus error] 
 or      	[X-Value]   [Y-Value]    [plus error]   [minus error]

 Text & Graphic Inspector

Before you can manipulate text and graphic objects with the mouse you have to select the mouse mode Text & Graphic.

In the following description Object stands for Textfields or Graphics. The Object type can be selected by the button matrix in the middle of the inspector (from left to right: text, rectangles, circles, lines, four different arrows, four bezier curves, and symbols ) 

Adding New Objects
Click inside your plotwindow but outside all other objects, and drag the object to the desired position. 

Moving Objects
Click inside an existing object in your plotwindow and drag the object to the new position.

Changing Objects
After selecting an object inside your plotwindow (simply by clicking)  the object  will be marked with light gray signs  (text appears in the inspectors text edit field)  and you can edit the attributes in the inspector. When this is done click the Set button and the edited object appears in the plot window. You can also edit objects by clicking and dragging one of the gray signs.

Removing Objects
Clicking the Remove button removes the currently selected object and clicking the Remove All button removes all objects .

Duplicating Objects
Clicking the Duplicate button duplicates the currently selected object .

Absolute/Relative Radio Button
The Absolute/Relative switch allows two kinds of objects. Absolute means that the objects have a fixed position inside the plotframe. Relative objects move with the plot coordinates.

Free Lines Radio Button
Until Off is selected in the Free Line  radio button only horizontal and vertical lines are allowed.

Symbol Slider
This slider selects the line type (dash type) for rectangles, circles, lines, arrows and curves and the symbol type (visibles in the previewer).

Symbol Width
Defines the arrow and symbol width (visible in the previewer).

Line Width
Defines the line width for all graphic objects.

Text Angle
Defines the text angle.

Text Orientation
Defines the text orientation.

Font
Defines the font for text objects (look up in the Font help text).

Normalize Inspector

Normalize & Move & Cut
This function supports three manipulations: 
Moving of data,

	x=x+A		y=y+A
	
normalizing of data,

	x=A+Bx		y=A+By

and cutting data.
	
Normalizing manipulates the buffers by stretching or shrinking along the specified axis. The specified reference points in the spectrum are changed in such a way that the frist old value becomes the first new value and the second old value becomes the second new value.

If Move is selected (by the Mode radio button) only the first value (first row) is relevant. Clicking Execute moves the buffer in the specified direction (selcted with the Axis Radio button) from the old to the new value. 

If Cut  is selected the buffer will be cutted by using the defined ranges and the selected axis.

The values for this manipulation can also be entered via the mouse mode X Norm and Y Norm (look up in the mouse mode help file).

Linear Background Subtraction
The linear background subtraction is a manipulation of the following kind:

	y=y+A+Bx
	
The A and B values can be entered directly or with the mouse mode Linear Background  (look up in the Mouse Mode help file).

The Result Mode and Background radio buttons instruct SciPlot what to do with the results of these manipulations: Overwrite the input buffer or create a new one, and either save the background itself or forgett it.

Bezier Background Subtraction
Before you can manipulate the bezier curve with the mouse you have to select the mouse mode Bezier Background.

The Set Current Point buttons allow to define the referent point which should be currently manipulated with the mouse. This is handy for when it is outside the plotwindow and you cannot click it.

The Result Mode and Background radio buttons instruct SciPlot what to do with the results of these manipulations: Overwrite the input buffer or create a new one, and either save the background itself or forgett it.

Clicking the Reset button brings up the template bezier.

Fit Inspector

Smooth & Differentiate
This functions needs an effective smooth width as parameter. This is a measure for the intensity of smoothing which will also be implemented for differentiation.

The Find Int button calculates a interval which produces a good result and does not damage the spectrum.

The three Execute  buttons starts the different calculations: Least Square Smooth, FFT Smooth and Differentiation.

The Result Mode radio buttons instructs SciPlot what to do with the results of these manipulations: Overwrite the input buffer or create a new one.

For more information look up in the documentations which are mentioned in the Sources help file.

FFT (Fast Fourier Transfom)
This function makes a Fast Fourier Transform for all selected buffers. For more information look up in the documentations which are mentioned in the Sources help file.

The Result Mode radio buttons instructs SciPlot what to do with the results of these manipulations: Overwrite the input buffer or create a new one.

Linear Regression
This function calculates the linear regression between the X min and X max value by using the following functions.

y  	=   A + Bx
	
B  	=   (n*Sxy - Sx*Sy)  ¤ (n*Sx2 - (Sx)2)
	
A   	=   (Sy - B*Sx)  ¤ n 

r    	=   (n*Sxy-Sx*Sy)  ¤ (Ö((n*Sx2-(Sx)2)  * (n*Sy2-(Sy)2)))

Calculation Inspector

Subtract & Add Buffer
With this function buffers (specified by reference numbers from the File Inspector) can be added to or subtracted from each other, depending on the selection within the Mode radio button.

Data Reduction
Sometimes it is useful to reduce a large number of datapoints which consist mainly of noise to a more practical amount of points. This function takes n points (n is specified in the Factor  field), builds the average, and replaces the n points with the new one.

Integrate
This function calculates the integral between the X min and X max value, multiplicates and divides it by the given factors, and writes the result to the comment fields in the File Inspector. 

The Result Mode radio button selects the output format.
e.g.	Short Form:	Int=10.0
	LongForm:	Int(2.0,7.0)=10.0

Clicking the Make % button calculates the relative values of the integrals for all selected buffers in which an integral entry (as above) appears and appends the percentage to the integral entry.

Calculations
Three kinds of calculations are possible:

1. 	(x,y)  =  Value  (+,-,*,/)  (x,y)

2. 	(x,y)  =  (x,y)  (+,-,*,/)  Value

3. 	(x,y)  =  (Log,Log10,Exp,Exp10, Sin,Cos,^2,Sqrt) (x,y)

These calculations effect all selected buffers.

ESCA Calculations Inspector

ESCA stands for Electron Spectroscopy for Chemical Analysis and the items in the ESCA Inspector are special analysis functions for this method. For more information look up in the documentations which are mentioned in the Sources help file.

Shirley/Tougaard Background Subtraction
The two referent points can be defined directly or within the mouse mode Shirley Background.

The Find Y  button calculates an optimal Value  for Y Start  and Y End  by building the average for all points within the Interval which is specified in the X Int field. 

The Tougaard Background does not need the Y values.

The Result Mode and Background radio buttons instruct SciPlot what to do with the results of these manipulations: Overwrite the input buffer or create a new one, and either save the background itself or forgett it.

XPS Satellite Subtraction
This function calculates and subtracts the X-ray satellites form an X-ray photoelectron spectra. The excitation source can be selected with the Mg/Al button.

The Result Mode radio buttons instructs SciPlot what to do with the results of these manipulations: Overwrite the input buffer or create a new one.

Axis Conversion Inspector

Temperature Axis Conversion
The X or Y axis can be converted from degrees Celsius or Fahrenheit to degrees Kelvin and vice versa.

PES Axis Conversion
This function converts the energy (X) axis of photo electron spectra depending on the excitation energy, from binding energy to kinetic energy and vice versa.

XRD Axis Conversion
This function converts the X axis of X-ray diffraction spectra depending on the X-ray wavelength, from 2Theta to d and vice versa.

Sources

Satellite subtraction 
implemented by W.Mahdi
Recursive approximation using algorithm of
Attekum & Trooster, J.El.Sp. 11:363-370 (1977)

Parameters for Mg from:
Attekum, P.M.Th. van, & J.M. Trooster,
J.Electr.Spect.Rel.Phenom. 11:363-370 (1977)
consulted for oxide: Fischer & Baun
Spectrochim.Acta 21:443-450 (1965).

Parameters for Al from:
Krause, M.O., & J.G. Ferreira,
J.Phys. [B] 8:2007-2014 (1975).
also consulted: Fischer, D.W., & W.L. Baun,
J.Appl.Phys. 36:534-537 (1965).

Shirley Background Subtraction
implemented by W.Mahdi
D.A.Shirley
Phys.Rev. [B] 5:4709-4724 (1972)

Tougaard Background Subtraction
implemented by W.Mahdi
S.Tougaard 
J. Vac.Sci.Tech. [A] 8:2197-2203(1990)

Smooth
based on least square fit 
A.Savitzky & M.J.E. Golay 
Anal. Chem. 1964, 36,1627-1639

Differentiation
Numerical Recipes in C, Page 524
W.H.Press, B.P.Flannery, S.A.Teukolsky, W.T.Vetterling
Cambridge University Press

FFT (Fast Fourier Transform)
Numerical Recipes in C, Page 398ff
W.H.Press, B.P.Flannery, S.A.Teukolsky, W.T.Vetterling
Cambridge University Press

FFT Smooth
Numerical Recipes in C, Page 514ff
W.H.Press, B.P.Flannery, S.A.Teukolsky, W.T.Vetterling
Cambridge University Press