TMathControl V1.0 Component for Borland Delphi
Copyright 1996, John Merrit, Analog Species in a Digital World Productions.
All Rights Reserved.

This component and the associated demoprogram (DEMOCAL.DPR, source code included)
may be freely distributed for evaluation purposes.
This demoprogram may NOT!!! be altered or sold, in any way, without written
permission from the author.

Instead of providing a helpfile, I've opted to supply a
demoprogram that demonstrates the TMathControl (DEMOCAL.DPR).
Some source code for this program is also included.
The control itself contains a registration message (this will randomly(!)* show up when
the user applies a function and also makes free use of the demoprogram
a bit of a pain).
I've NOT provided ALL the source code for the demoprogram!!!
If you recompile the supplied source code, no (compilation) errors will occur
but the *.exe won't do much usefull.

* The control itself contains the following code in one of its procedures.
  This allows the tester to use the control in a program outside the Delphi IDE but also
  preserves illegal usage of the unregistered control in commercial programs.

     randomize;
     i:= random(500); { Don't make this message appear too often... }
     if i mod 25 = 0 then
     MessageDlg('This program uses an unregistered version of TMathControl (1996, John Merrit).' +
     ' Contact the vendor if you payed for this (illegal) program!',
     mtWarning, [mbOK], 0);

Built in functions and properties of TMathControl:
*Trigonometry: sin, cos, tan, arcsin, arccos, arctan;
*Hyperbolic: sinh, cosh, tanh, arcsinh, arccosh, arctanh;
*Logaritmic: log, ln, alog, exp;
*power: x to power y, y-th root of x, 1/x, x, sqrt(x);
*Misc. complex number algebra: absolute value, argument, conjugate, 
 a real number -> complex number and vice versa; 
*Statistic: combinations, permutations, faculty (windows calculator =< 170, mine > 1500!)
    
These functions work on both real and complex numbers (if appropriate).
To reduce errormessages, some functions allow input of a complex number while they actually require a
real number. The complex part will be omitted in this cases.
e.g.
Faculty requires a real (actually a positive integer*) number.
If you entered the complex number (25,12) and push the faculty button (!), the calculator
calculates 25! instead of returning an errormessage.
This is the case for the following functions:
rad to degrees (R->D), degrees to rad (D->R), faculty (!), combinations (Comb), permutations (Perm).
Also, real numbers will be converted to integer (round) when needed
i.e.
  3.25! will calculate 3!.
(!, combinations (Comb), permutations (Perm))

*To make bigger (smaller) calculations possible, a trick has being used to force these functions to
 work with (the integer part) of a real (extended) number.
 For example:
 Using longint as datatype would restrict us to calculate faculties for numbers =< 12.
 Now, the control is capable of calculating the faculty of a number > 1500.
 I've never needed this BIG numbers but knowing how for example Newton's Binomium works, it's
 easy to believe someone has some benefits from them. 

Controlproperties:
*Accuracy: accuracy of calculations (optional, see source code);
*MathFunc: function (sin, cos, etc...);


Controlevents (speak for themself):
Note that the control uses extended datatypes (3.4 * 10-4932 ... 1.1 * 10+4932) so you'll have to
do strange things if you want (for example) to make an overflow occur.
This has also one drawback: this control (and demoprogram) can't be used on a machine without a mathematical
coprocessor, but since we live in 1996, we'll assume that everybody has one...
*OnInvalidOp
*OnOverflow
*OnUnderflow  
*OnZeroDivide

Component Installation:
Install the component (MATHCONT.DCU) into the Delphi VCL by
following the instructions in the Delphi manual. 

Demoprogram
------------
The demoprogram is a 4 level stack RPN calculator build in the spirit of the
famous(?) Hewlett Packard handcalculators (28S, 48S, 48G, etc...).
I'm not gonna give a full description on how to work with this calculator.
Most functions speak for themself.
Besides, you got this one (almost) for free...
Note:
I did NOT write a keyboard interface so you'll have to use the buttons (with your mouse)
on the calculator (it's only a demoprogram!).
Two things need to be clearified by me:
1. In some countries the '.' character is used as comma, in others the ','.
To denote a complex number (a + bi) in this calculator, rewrite this as (a;b) and not (a,b).
This distinction has to be made to make a difference between a number like 
2.71828182845905 (exp(1) or e, in some countries written as 2,71...) and a complex number like
(0,2.71828182845905) (i.e. i*exp(1)).
Note that the complex unit (i.e. (0,1)) will be denoted as i.
In some books (electromagnetics!) this unit is denoted as j (or somethong else) to distinguish it
from the symbol for electric current (I).
2. For those who are not familiar with higher mathematics:
The following expressions are perfectly valid:
Sin((2,4)) =  sin(2)*cosh(4) + ... (sin of complex number 2 + 4*i);
Log(-100) = ... (log of negative number);
Ln(-145) = (ln of negative number);
Log((1,25)) =  (log of complex number 1 + 25*i);
etc...
Registration will fill this further in (see lower).
Remember that it's a R(eversed) P(olish) N(otation) calculator, not an algebraic one.
What's the difference? An Algebraic calculator uses algebraic logic...
Note that there's no '=' button on the calculator.
This is not because I forgot to add one (RPN calculators do not need one)!
Just play around with it! (Practice makes perfect...)
For those who never used a RPN calculator, here are some calculation examples:
1. calculate 15 * 6:
RPN sequence: 15 enter 6 * (or 15 enter 6 enter *)
2. calculate log(125):
RPN sequence: 125 log (you do not need to enter the argument, you may though...)
3. calculate sin(45 + 30):
RPN sequence: 45 enter 30 + sin
4. calculate sin(45 + 30i):
RPN sequence: 45 enter 30 enter i * + sin (or 45 enter 30 R->C sin)



Disclaimer:
Nothing can survive in a vacuum and therefore this component (and calculator)
may still contain some
imperfections. If you use this component as demonstrated in the demoprogram
everything should run fine, but still:
"TMathControl is supplied as is.  The author disclaims all
warranties, expressed or implied, including, without limitation,
the warranties of merchantability and of fitness for any purpose.
The author assumes no liability for damages, direct or conse-
quential, which may result from the (mis-)use of TMathControl."
Those who can't live with this: lay yourself down in dreamland, perfect's not for real.
For the others:
Bugreports, suggestions or even complaints are welcome (see info for contacting me below).


Registration info.

This component is not freeware but distributed as shareware.
Registration to use the component in program development:
This includes the full source code for the control and (the working version of the) calculator** --> 25$ (U.S.);
**The author (me) holds the copyrights for the calculator!
  Buying a component does not automatically give you the rights to reproduce and publish(!) the calculator
  for commercial purposes.
  (I'm well aware of the fact that most of you are nasty minded and will ignore this...
   If you paid the registrationfee, you may do with the source code whatever you like.)  

You're totally free on how to pay (I'm not bottered if you send me for example
German Marks), as long as it's equivalent to the charge above and I can get
the money in my hand it's fine.	

Author info:

Those who don't have access to the Internet:
  My adress:    John Meert
                Van Duyststraat 145
                2100 Deurne (Antwerpen)
                Belgium

Contact via Internet: john.merrit@NET4ALL.BE




Terminat hora diem, terminat auctor opus.

