TFunctionParser           
		  by Marianne H. Goeltl-SchuberthTFunctionParser  is a non-visual DELPHI component for evaluating 
mathematical functions. The function term is a user given string 
like 'sin(x)*x'. The function term can by changed during runtime.

TFunctionParser provides more than 40 mathematical intrinsic 
functions.

Contents:
  1. Features of TFunctionParser
  2. Information
  3. How to install TFunctionParser
  4. How to work with TFunctionParser 
  5. List of operations and functions



1. Features of TFunctionParser

	- Algebraic syntax following PASCAL notation,
              not case sensitive
	- Brackets ()
	- Variables x, y, z and t
	- Floating point numbers (extended)
	- Implemented mathematical constants e, pi, C
	- Userdefined constants
        - Operations +, -, *, /, ^
	- More than 40 mathematical functions (cf. list below)
        - Angles in radians or degrees



2. Information

TFunctionParser is FREEWARE.
It may be used and distributed unmodified (complete ZIP-file, no
single files) without registration fee.
You are obliged to quote my copyright in your applications 
(method Showinfo).
If you intent to use TFunctionParser for COMMERCIAL purposes you
are requested to contact me concerning the license conditions.

My address is:
			Marianne H. Goeltl-Schuberth	
			Egerlandstr. 18	
			D-91083 Baiersdorf	
			Germany

         eMail:		schuberth@t-online.de             

If you find any bug, please don't hesitate to inform me. Any 
suggestions, questions, and comments are very welcome.


----------------------------------
THE LEGAL DISCLAIMER
----------------------------------
THE INFORMATION AND CODE PROVIDED HEREUNDER (COLLECTIVELY REFERRED
TO AS "SOFTWARE") IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, 
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DAMAGES WHATSOEVER
INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF 
BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF THE AUTHOR HAS BEEN 
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 



3. How to Install TFunctionParser

The file FCTPRS16.ZIP includes the following files:

		DEMO.DPR		providing a simple demo
		DEMO1.DFM
		DEMO1.PAS

		FCTPARS.DCU		containing the component
		FCTPARS.DCR                       TFunctionParser
		FCTPARS1.DCU
		FCTPARS1.DFM
		FCTPARS2.DCU
		FCTPARS2.DFM

		FCTPARS.TXT		short ASCII formatted Info
		FILE_ID.DIZ		dto.
NEW!		NATCONST.DAT	        selection of physical 
                                           constants (not tested !)
		README.TXT		this file

For installing the component TFunctionParser you need the files	
                                        FCTPARS.DCU
					FCTPARS.DCR
					FCTPARS1.DCU
					FCTPARS2.DCU
					FCTPARS1.DFM
					FCTPARS2.DFM.

- Choose from the menu Options | Install Components
- Choose Add
- Choose Browse
- Select the file format *.DCU
- Select FCTPARS.DCU
- Choose OK and wait while the compiler adds the new component to 
  your library 
- You find TFunctionParser now on the palette, page MHGS. 



4. How to Work with TFunctionParser


Input Properties:

TFunctionParser.Term
	Term is a (huge) string (e.g. 'sin(x)') defining the given
	function. Spaces are ignored. Lower or upper cases are not 
	distinguished. Arguments of functions must be in brackets.

TFunctionParser.x 
	The variable value of x is stored in TFunctionParser.x  
	(y, z, t  analoguously).

TFunctionParser.Constants
	You can define as many constants as you like in 
	TFunctionParser.Constants using the notation e.g. 
	'ABC=1.5e-3'. 
	Reserved abbreviations are x, y, z, t, e, pi, and C.
        The component doesn't check multiple usage of identifiers. 

TFunctionParser.Radians
	Only relevant for trigonometric functions and their 
	inverses (arc functions).
        If TFunctionParser.Radians is true the unit for angles is 
	rad (full angle =2*pi) else it is degrees (full angle =360).

TFunctionParser.About 
	indicates whether the infoscreen is shown. 


Methods:

TFunctionParser.analyze
	checks the syntax of the function term and translates 
	(as an interpreter) it into an internal format.  
	You must call TFunctionParser.analyze before calling one 
	of the following routines. After analyzing you can perform 
	as many evaluations as you need. If you change the function 
	term you must analyze anew. 

TFunctionParser.execute / TFunctionParser.calculate
	For evaluation you can either use TFunctionParser.execute 
	or TFunctionParser.calculate. 
	The difference is that TFunctionParser.calculate is a 
	function that takes only one argument x (you don't have to
	set TFunctionParser.x) and yields the result directly 
	while TFunctionParser.execute is a procedure without argument.
	The necessary variable values x, y, z and t must be set by 
	the user first. The values of not required variables are 
	ignored and should be omitted.

TFunctionParser.DoAll   
	The simpliest use is TFunctionParser.DoAll which contains 
	conversion of the termstring and evaluation. It is a 
	combination of TFunctionParser.Analyze and 
	TFunctionParser.Execute and should be used only if there 
	aren't multiple evaluations of one function to make.

TFunctionParser.ShowInfo
	If you want to see the infoscreen call TFunctionParser.ShowInfo;


Output Properties:

TFunctionParser.result 
	The function value is stored in TFunctionParser.result as an 
	extended number. 

TFunctionParser.valid / TFunctionParser.errormessage 
	If any error occured TFunctionParser.valid becomes FALSE
	and TFunctionParser.errormessage tries to tell you why.


Events:

TFunctionParser.OnError
	Any error (syntax error, division by zero, ...) will raise 
	the event TFunctionParser.OnError.



The use of TFunctionParser is recommented as follows:

1. Only one evaluation of the given formula:
	Initialize Term, (Constants if necessary), Arguments
	Call procedure DoAll          
	Read Result (and check Valid)

2. Multiple evaluations, but only one variable (must be x)        
 	Initialize Term, (Constants if necessary)
	Call procedure Analyze (only once)
 	For each variable value:
		Call function Calculate(x)
		(Check Valid)

3. General case 
	Initialize Term, (Constants if necessary)	
	Call procedure Analyze (only once)
	For each set of arguments:
		Initialize Arguments	
		Call procedure Execute	
		Read Result 
		(Check Valid)

4. Multiple Function Terms to Evaluate
	Use multiple TFunctionParser components
	or change Term at runtime
	Proceed like above



Sample Program:

The demoprogram DEMO.DPR contains the following code.
Clicking on the OK button will induce the program to read the 
function term and the variable value from the respective edit fields,
evaluate these, and write the result as the caption of a label. 

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
   with functionparser1 do begin
    term:=edit1.text;
    x:=strtofloat(edit2.text);
    doall;
    if valid then label3.caption:='Result = '+floattostr(result)
             else label3.caption:=errormessage;
   end;
   {It is indeed that easy to program a calculator}
end;




5. List of Operations and Functions

Adding:				+
Subtracting:			-
Multiplying:			*
Dividing:			/
				rez 	reciprocal
Powers:				^
				sqr 	square
				exp 	exponential
Roots:				sqrt 	squareroot
				cbrt    cubic root
Logarithms:			ln	log. with base e
				lg	log. with base 10
				lb	log. with base 2
Trigonometric Function:		sin	sine
				cos	cosine
				tan	tangent
				cot	cotangent
Arc Functions:			arcsin	arcus sine
				arccos	arcus cosine
				arctan	arcus tangent
				arccot	arcus cotangent
Hyperbolic Functions:		sinh	hyperbolic sine
				cosh	hyperbolic cosine
				tanh	hyperbolic tangent
				coth	hyperbolic cotangent
Area Functions:			arsinh	area sine
				arcosh	area cosine
				artanh	area tangent
				arcoth	area cotangent
Statistical Function:		gauss	normal distribution
				erf	error function
				inverf	inverse of error function
Random Numbers:			rnd	random number  in [0,x[ 
Bessel Functions:		J0	0th ord
				J1	1st order
				J2	2nd order
				J3	3rd order
				J4	4th order
				J5	5th order
Integral Functions:		Si	integral sine
				Ci	integral cosine
				Ei	integral exponential
				li	integral logarith
Gammafunction:			gamma	gamma function
Stepfunctions:			theta	=1 if arg.>0, else =0
				sgn	signum function
				int	integer part of argument
Miscellaneous Functions:	abs	absolute | |
				frac	non-integer part of argument	
Mathematical Constants	:	pi	circumference/diameter of circle
				e	base of natural logarithms
				C	Euler's constant

                                                                                  