home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
calcultr
/
doit.arc
/
DO.DOC
< prev
next >
Wrap
Text File
|
1989-11-17
|
4KB
|
118 lines
21 Sep 1989 Bernardo Zamora
Manual for the units to convert to RPN and evaluate functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The self_unarcing file contains several units and a demo program.
The demo is called DO.PAS, and the executable DO.EXE.
This units aid in converting a function to RPN and later
evaluate it, optionally substituting all the 'x' in the
function for a passed parameter.
The demo program receives a parameter, it evaluates it
and prints the result (it's very useful as a desk accesory,
like a portable calculator with LOTS of functions).
The units are precompiled for TP5.5, if you want them for
other pascals (TP4 or TP5.0) recompile the source code for
all the units.
Brief explanation of the programs included
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
........DO.EXE/DO.PAS = demo file, shows how easy is to evaluate
a function (only 50 lines to ask for the function, concatenate it
evaluate it, and print a table with the original function, the
converted function [rpn] and the result).
........DO_TYPE.TPU/DO_TYPE.PAS = unit that has all the declarations
of variables, constants and types that you should know about
to convert a function to RPN (see the demo program to see how
to define a RPN variable).
You SHOULD INCLUDE this file to do any conversion/evaluation.
........DO_MATE.TPU/DO_MATE.PAS = unit with several mathematical functions
like tan, exp, log, etc.. you can use it alone in your
programs.. you DONT NEED to include it (it is automatically done).
........DO_RPN = main unit that receives a function in the rpn-variable
and converts it to rpn (leaving a simple string in rpn_string and
the real stack conversion in s1). This unit has only one function :
Procedure Convierte_a_polaca(var rpn:rpn_type);
to use it, declare a variable type rpn_type and fill the
fun_string with the function to be converted.. then pass that
variable as a parameter. You NEED to include this unit.
The error field will contain 0 if no error occured, and if an
error occured, the MESSAGE field will contain the error (see
the unit DO_TYPE.PAS that contains all error messages).
........DO_EVAL = unit that evaluates the pre-converted function. The only
procedure (public) declared here is :
Function Evalua_polaca(var rpn : rpn_type, value : real) : real;
This function returns the value of the function evaluated. For
example if the function (4-1) was converted and then evaluated,
it would return (3).
The error field will contain 0 if no error occured, and if an
error occured, the MESSAGE field will contain the error (see
the unit DO_TYPE.PAS that contains all error messages).
The VALUE parameter is a value that is to be substituted for
all occurences of the letter 'X'. Check the field ERROR to
verify that the result is a meaningful one.
EASY EXPLANTATION OF USAGE
~~~~~~~~~~~~~~~~~~~~~~~~~~
To make a program that receives a function, converts it and shows
the evaluated result you must include the DO_TYPE, DO_RPN and
DO_EVAL units.
The you should ask the function, put it into the field fun_string
of a rpn_type variable.
Call the procedure to convert fun_string to rpn. That function also
fills the field rpn_string.
Call the evaluating function with a value to substitute for 'X'.
Print the result.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Any questions? Forward them to
===========================
Bernardo Zamora
Paseo de la Herradura #126
La herradura
CP 53920
Mexico, DF
MEXICO
===========================
... or through BITNET
=======================
Bernardo Zamora BL306971@TECMTYVM (nick : "BEAR")
or
Bernardo Zamora PL306971@TECMTYVM
or ask for me with
Fausto Ibarra EM304599@VMTECMEX
=======================