- 1 - 13th January, 1989 About TSNUM in General ====================== This package may be used and distributed freely for NON-COMMERCIAL, NON-INSTITUTIONAL, PRIVATE purposes, provided it is not changed in any way. For ANY other usage contact the author. No part of this package may be distributed separately. The programs are under development. Comments and contacts are welcome. If you have any comments, please do not hesitate to use electronic mail for communication. InterNet address: ts@chyde.uwasa.fi (preferred) Funet address: VAKK::SALMI Bitnet address: SALMI@FINFUN FidoNet address: 2:515/1 (Micro Maniacs Opus, To: Timo Salmi) The author shall not be liable to the user for any direct, indirect or consequential loss arising from the use of, or inability to use, any program or file howsoever caused. No warranty is given that the programs will work under all circumstances. Timo Salmi Professor of Accounting and Business Finance School of Business Studies, University of Vaasa P.O. BOX 297, SF-65101 Vaasa, Finland CONTENTS: 1. Summary 2. Common Features 3. Individual Program Abstracts 4. Release Notes 1. SUMMARY ======= Searching Archive: B:TSNUM12.ARC - Numerical Analysis by Timo Salmi Filename Comment Date Time -------- -------------------------------- ---- ---- BISE.EXE Solves f(x)=0, Bisection Method 11-03-88 21:01:26 EQ2.EXE Solve linear equations of 2 vars 11-02-88 23:28:46 IC.EXE Line's intercepts with the axes 11-03-88 21:04:08 LINE.EXE Equation of line thru two points 11-03-88 21:07:20 POLYR.EXE All roots of a polynomial 01-14-89 00:15:58 SECA.EXE Solves f(x)=0, Secant Method 11-03-88 21:08:40 SINTEG.EXE Integrates f(x), Simpson's rule 11-03-88 21:11:20 TSNUM.INF Document 01-13-89 TSPROG.INF List of PD programs from T.Salmi 12-19-88 14:32:02 - 2 - 2. COMMON FEATURES =============== The TSNUM programs are for numerical analysis. The general format of the calls to programs involving functions is PROGRAM {function} [the parameters] e.g. SECA x^2-7*x+5 1.0 ³ ÀÄa parameter ÀÄthe function No blanks are allowed in a function. The variable must be denoted by the letter x (case-independent). To get more information about an individual program use ? in the program call: e.g. SECA ? The operators available are + - * / ^ ( ) The functions available are abs() Absolute value arctan() Arctangent cos() Cosine deg() Radians to degrees ep() Exponentation fact() Factorial frac() Extract decimals int() Delete decimals ln() Natural logarithm log() Base 10 logarithm pi() The value of Pi rad() Degrees to radians rnd() Random value sin() Sine sqrt() Square root Many of the potential errors are trapped and pinpointed by the programs. Still, if you get the message Runtime error 205 at xxxx:xxxx it means that your formula has caused a floating overflow or underflow, or is otherwise invalid. For the theory and methods of numerical analysis see any good text-book on numerical analysis. Also many programming text-books give useful information on the subject. 3. INDIVIDUAL PROGRAM ABSTRACTS ============================ BISE.EXE (ver. 1.1) The program uses the bisection method for finding a root of f(x) = 0 between the initial values. To find the suitable initial values, first draw the function, e.g. with FNP.EXE, and/or tabulate it with FNT.EXE. They both are available in TSFUNCxx.ARC. Usage: BISE f(x) {initial value left} {initial value right} [decimals] e.g. BISE x^2-7*x+5 0 5 5 The parameters in the brackets [] are optional. By giving -1 as [decimals] you get the exponential representation. - 3 - EQ2.EXE (Ver. 1.1) The program solves simultaneous equations of two variables. a1*x1 + b1*x2 = c1 e.g. 5X1 + 5X2 = 400 a2*x1 + b2*x2 = c2 200X1 + 300X2 = 2100 Usage: EQ2 a1 b1 c1 a2 b2 c2 [decimals] e.g. EQ2 5 5 400 200 300 2100 5 The parameter in the brackets [] are optional. By giving -1 as [decimals] you get the exponential representation. ------------------------------------------------------------------------------ IC (Ver. 1.1) The program solves the incercepts of a line with the axes. Usage: IC a b c [decimals] e.g. IC 200 300 2100 5 ------------------------------------------------------------------------------ LINE.EXE (Ver. 1.1) Calculates the equation of a line passing through two given points. The equation of the line will be given in two different formats: 1) Y = a + bX 2) aX + bX = c If the latter contains fractional coefficients, the program will attempt to find an equivalent equation with integer coefficients. Usage: LINE x1 y1 x2 y2 [number of decimals] or: LINE ? By giving -1 as the optional [number of decimals] parameter you get the exponential representation. ------------------------------------------------------------------------------ POLYR.EXE: POLYnomial Roots, (Ver. 1.0) Usage: POLYR a(0) a(1) a(2) ... a(N) To solve a(0) + a(1)X + a(2)X^2 + ... + a(N)X^N = 0 or: POLYR ? This programs solves all the roots of a polynomial of the Nth degree. The algorithm is Laguerre's method as presented in Turbo Pascal 4.0 numerical toolbox by Borland International Inc. It is used in accordance with Borland's no-nonsense licence statement. ------------------------------------------------------------------------------ - 4 - SECA.EXE (Ver. 1.1) The program uses the secant method for finding a root of f(x) = 0 near the initial value. To find a suitable initial value, first draw the function, e.g. with FNP.EXE, and/or tabulate it with FNT.EXE. They both are available in TSFUNCxx.ARC. This is particularly useful if the function has several roots. Usage: SECA f(x) [initial value] [decimals] e.g. SECA x^2-7*x+5 1.0 5 ------------------------------------------------------------------------------ SINTEG.EXE (Ver, 1.1) ôa The program uses Simpson's method for evaluating the definite integral ³ f(x) õb Usage: SINTEG f(x) {lower bound} {upper bound} [intervals] [decimals] e.g. SINTEG x+ln(x) 1 2.7182818 100 5 ------------------------------------------------------------------------------ 4. RELEASE NOTES ============= Since versions 1.1 the programs recognize e.g. .1 as 0.1. Earlier using a decimal value without the leading zero caused an error. This resulted from the way Turbo Pascal converts strings into numerical values. Version 1.2 of the package introduces the POLYR.EXE program.