% Well - this file is an input-file for \LaTeX\. If you do not have it - here
% is a short description how to read this file:
% Everything beginning with a \ is a command (e.g. \bf stand for bold, so the
% next text will be printed in bold face). Every line starting with a % (like
% these ones) are comments. The normal text (and that is most of the file)
% is human-readable.
% If you have \TeX\ and you have problems with this file: I used a style-file
% amigauml you may not have. As far as I remember, the only thing I used was
% the \copyright command in the title. Replace it with an equivalence one and
% it should work.

\documentstyle[amigauml]{article}
\def\RETURN {$<$RETURN$>$\ }
\def\MathPlot {{\bf MathPlot\ }}
\parindent 0pt

\begin{document}

\vspace{6cm}
\title{\MathPlot V1.04}
\author{\copyright by R\"udiger Dreier 1991}

\maketitle

\begin{center}
\MathPlot is SHAREWARE
\newpage
\end{center}
\tableofcontents
\newpage
\parindent 0pt

\part{Introduction}
\section{Important}
{\sl
     THE AUTHOR  UNDERTAKES  NO  LIABILITY FOR  ANY  DAMAGE CAUSED  BY  THE
     APPROPRIATE OR NOT APPROPRIATE USE OF THIS PROGRAM !

     THE AUTHOR  UNDERTAKES  NO LIABILITY  FOR  THE FAULTLESSNESS  OF  THIS
     PROGRAM !

     USE IT AT YOUR OWN RISK !
}

\vspace{.5cm}
\begin{center}
\MathPlot is {\sl{\bf SHAREWARE}}.
\end{center}
\vspace{.5cm}

\subsection{Copying}
This version is a demo version (with some options disabled).
It may be freely copied under the following conditions:

\begin{enumerate}
\item The copyright text must be included (unchanged).
\item Noncommercial use (only a little fee for Disk, postage etc).
\item The program must not be changed.
\item The program must be complete: The following files must be included:
 \begin{itemize}
  \item The complete unchanged documentation
  \item One working copy of \MathPlot
  \item A version of mtool.library
 \end{itemize}
\item Everybody  who wants  to use \MathPlot (or a  part of it) or the
      mtool.library (or a part of it) in a commercial sense needs the written
      permission of the author.
\item It {\bf is} allowed to translate the text of the menu item etc. (file
      TextDaten) into other languages and include it into any copy of this
      program.
\end{enumerate}

\subsection{Shareware}
\MathPlot is {\bf ShareWare}. If you use this program, you may want to
pay the registration fee. It is \$ 20,-- or DM 30,--. Please send this
money to the address below and add the name and version of the program
(and perhaps where you found this program). 'Why should I', you may ask.
Well, you will get
\begin{enumerate}
\item The newest (full) version of \MathPlot. This Version {\bf must not} be
      given to others.
\item A printed manual (this here, please tell me, if you want to have
      the german or english version).
\item Updateservice. You may get new versions of \MathPlot by sending a disk,
      envelope, postage and your registration number to me. If there is no
      newer version, I will wait until there is one. So it may take a little
      time until you get the newest version. Please tell me, which version
      you have.
\end{enumerate}

\subsection{Source}
The source is {\bf not} freely distributable. The source is available
(for registrated users only) by sending \$ 20,-- or DM 30,-- to the
address below. To use the source in a commercial sense, you need the
written permisson of the author.


\section{What it does}
     \MathPlot is a  little program to plot twodimensional functions. You
     can enter up  to 10 functions and plot them  all. In addition, you can
     plot the first and  second differentiation of the functions (numerical
     and symbolic). A discussion and numerical integration is also possible.
     So the program can be used i.e. to control your own results.

\section{What you need}
 {\bf The program only works on Amigas with Kickstart 2.0 or higher !}. 512kB
 memory should be enough (I hope), 1MB chip mem and new custom chips are
 very nice for big screen (productivity mode etc.). The stack should be
 20000 bytes or more. In LIBS:, you need
\begin{enumerate}
  \item mathieeedoubbas.library
  \item mathieeedoubtrans.library
  \item asl.library
  \item mtool.library (should be also on this disk)
\end{enumerate}
In S: you can (but need not) have
\begin{enumerate}
  \item Funktionen, some example functions
  \item Colours, some example colours
  \item MPlotDef.info, this icon is used for Iconify and iff--files.
\end{enumerate}
\newpage
%
%
%
\part{The menus}
\section{Project}
\subsection{New}
       You are asked whether to clear the screen or not. A HP--output
       ends (see \ref{HP}). The screen clears automatically after changing
       the intervall.
\subsection{IFF Save as}
       To use this item, you need the ilbm.library in libs:. If the program
       cannot find this library, a requester appears ({\sl ilbm.library ?}).
       Otherwise, you are asked for the name of the file. If an error occurs,
       another requester appears.

       If a file s:MPlotDef.info exists, the icon is used for your iff--file.
\subsection{Load/Save functions}
       You are asked for the name of the file to save or load.
       The lines in the file are loaded as functions or the functions
       are saved in a file. Look at
       the demo--file to see the format of this files, it is very simple.
\subsection{Load/Save macros}
\label{lsm}
       Here you can load or save the macro definitions.
\subsection{Load/Save constants}
       See (\ref{lsm}). But here with constants \dots
\subsection{Load colours}
       You are asked for the name of the file to load. Look at the demo--
       file to see the format of this file (it should have 12 lines).

{\bf   All file that are loaded must end with a Return (0x0a). Most editors
       produce this return at the end of a file automatically.}
\subsection{Print}
       Prints the screen on your preferences printer (as big as possible).
       While printing, the colour of the screen is changed. A HP--output
       ends (see \ref{HP})
\subsection{Iconify}
       The window is closed and an icon appears on workbench. A doubleclick
       on this icon starts the program again. The last functions are
       still available. If there is not enough memory to open a screen,
       the program terminates. As icon, the file S:MPlotDef is used, so this
       option only works, if this file is available.
\subsection{About}
       You  get some pice of  information about this program (Version, my
       address). Click in the gadget or hit any key to close the window.
\subsection{QUIT}
       A requester appears and asks you whether to quit or not. If you
       agree, the program terminates.
%
%
%
\section{Plot}
\subsection{Change function}
       A  submenu  with  the  ten functions (you entered or loaded)
       appears  (only  the  first  14 characters are displayed).
       Here  you can select one of the functions. A window appears and you
       can change  it. The function should be a correct expression.
       If  you enter  something like sin((x),  the window  appears again as
       long as there is one bracket too much. See (\ref{FTerme}) for a short
       description of those things, you may enter. If you hit Return or
       select OK, the changed functions is used, otherwise the changes are
       ignored. Please enter only lower case.
\subsection{Function, 1st/2nd Diff num/symb}
       Each  of this five items  has the same submenu  as Change. Selecting
       one of the functions plots it (or its 1st or 2nd differentiation).
       Numerical  differentiations are calculated using  the secant method.
       So it may be not very good. Even the first differentiation may be
       very unprecise.
       Symbolic differentiations  are  calculated first  and then  the  new
       function is plotted (e.g.  for sin(x): first cos(x) is calculated as
       the differentiation of sin(x) and then sin(x) is plotted).
       Symbolic  differentiations are  more precise but  there are problems
       with some function (abs, sgn, ln). E.g. for ln you get the function
       1/x plotted even for negativ x. Symbolic differentiations are
       calculated in a recursive way, so the stack should be at least
       20000 bytes. If you get a guru, just try a larger stack.
       When an  error  was  found during  plotting  (division by  zero  for
       example) a requester appears with the message "There was an error"
       and
       the number of the error is displayed. See table (\ref{Fehler}) for a
       description of the errors. The number may be the sum of some different
       errors.
\subsection{Discussion}
       Here you can get some pice of information about the function:
       The  intervall  is  displayed  as  well  as  the  first  and  second
       differentiation. Also  the points where the function  is zero, has a
       min or max or a turning point. You are first asked, whether the
       program has to stop after every part of the diskussion. If so,
       you are asked after every part whether to continue or clear the
       screen and continue.

       For some  functions,  the differentiation  is  not correct  for  all
       values. Table (\ref{ABLEITUNGEN}) shows the differentiations
       that are used. Some of them are not correct for all values and it
       is a good idea to test sometimes the result.
       The differentiations are not optimized (i.e. you will
       see things like $x^{2-1}$).

\begin{table}
\caption{The differentiations}
\label{ABLEITUNGEN}
\begin{center}
\begin{tabular}{|r|r|l|}
\hline
1. & $+-*/$ & The usual \\
2. & $x^a$ & $a*x^{(a-1)}$ \\
3. & $a^x$ & $a^x*\ln{a}$ \\
4. & $f(x)^{g(x)}$ & $(g(x)*\ln(f(x)))'*f(x)^{g(x)}$ \\
5. & trigonometr. Functions & The usual \\
6. & abs($x$) & sgn($x$) (For $x$=0 not correct) \\
7. & int($x$) & 0 (Well ...) \\
8. & sgn($x$) & 0 (Well ...) \\
\hline
\end{tabular}
\end{center}
\end{table}


{\sl
       THE  AUTHOR UNDERTAKES  NO  LIABILITY  FOR THE  CORRECTNESS  OF  THE
       DIFFERENTIATION !!  BEFORE YOU USE ANY OF THE RESULTS, RECALCULATE
       THEM BY HAND !!!
}

\subsection{Num. Integration}
       Here you can integrate a function numerically.
       A window appears and shows the selected function (you can even
       change the function or enter a new function).
       You are asked for the intervall and the number of steps to use for
       the numerical integration. If you use more steps, the result becomes
       better but you have to wait longer.
       Press \RETURN in the third gadget or click
       on OK to start the integration. The result is displayed in the window.
       If an error was detected, the number is displayed, too. See  table
       (\ref{Fehler}) for a description of the codes. The cursor should be
       in the first gadget again. So you can start from the beginning.
       To close the window, select QUIT.
       \vspace{.5cm}

{\bf
       Before any of these actions it done (except change), the used macros
       are expanded.
       During this action, the colour of the screen is changed. A recursion
       in the macros is {\sl not} detected. So it is on your own responsibility
       to detect such things (therefore the different colour).
}

{\bf
       Some of the actions (plotting, discussion, macroexpansion) can be
       stop. A little window with a gadget (stop action) is displayed. Just
       click in the window.
}

\begin{table}
\caption{Errorcodes}
\label{Fehler}
\begin{center}
\begin{tabular}{|l|r|l|}
\hline
DIVBYZERO   &   1  &  You tried to divide by zero \\
LOGNEG      &   2  &  You tried $\log(\leq 0)$ \\
SQRTNEG     &   4  &  You tried $\sqrt{ < 0}$ \\
ATRIG       &   8  &  You tried asin, acos with arg $>1$ or $<1$ \\
UNPAKLAM    &   16 &  Too much brackets \\
TEST        &   32 &  Not used \\
NOFUNC      &   64 &  No function given  \\
NO\_KONST   &  128 &  No such constant  \\
NO\_MEM     &  256 &  No memory     \\
POWERROR    &  512 &  You tried $(<0) \uparrow (a/b)$\\
NO\_FUNC    & 1024 &  No function found\\
\hline
\end{tabular}
\end{center}
\end{table}


%
%
%
\section{Edit}
\subsection{Axis}
       Selection this item plots the axis. If the axis are from $-1$ to $1$
       and there is some text like $10\uparrow$, this means that the intervall
       $[0.1\, , \, 10]$ is displayed (log--plot).
\subsection{Zoom}
       You  get a rubberbanding  and can  select the part  of the intervall
       which will be plottet next.
       A HP--output ends (see \ref{HP}).
\subsection{Insert text}
       You can enter a text and place it with your mouse. Click at the right
       place and a requester appears to ask you for the colour to use.
       Normaly, you can choose between four colours, but if HP--Output is
       active, you can choose between eight colours.
\subsection{Precision}
       You get  a submenu  with three  items (low,  med and  high). If  you
       select med or high, the program needs more time to plot and the plot
       becomes better.
\subsection{Intervall}
       A window with four stringgadgets, two cyclegadgets and two normal
       gadgets appears. In the text gadgets you can enter the intervall,
       with the cyclegadgets, you can tell the program how to use this
       values, e.g.: you want to plot $[-\pi,\pi]$. You can enter
       $-pi$ and $pi$ and $*1$ in the cyclegadget. But you can also enter
       $-1$, $1$ and $*pi$ in the cyclegadget. Try both and plot axis, you
       will see the difference. To get a log/log plot, choose $10\uparrow$
       in both cyclegadgets and so on.
\subsection{Constants}
\label{const}
       A window with an active cyclegadget and an inactive stringgadget
       appears. Choose a character with the cyclegadgets or press a key, then
       hit \RETURN. The stringgadget should become active. Now you can
       enter the definition for the constant, you named before. You can
       use constants in other functions by their name, e.g: define a
       constant z by entering $pi$. Then you can use $z$ in any function
       instead of $pi$. Do not use $x$ or $e$ as name of a constant because
       they cannot be used later ($e$ is defined as $2.7\cdots$).
\subsection{Macros}
\label{macro}
       A similar window as decribed in (\ref{const}) appears.
       Enter your macro--definition in the
       stringgadget. Macros are used in functions via \_MACRONAME or
       \_MACRONAME (Parameter), e.g. \_a or \_a(2*x). If you use the second way,
       every $x$ in the macro is replaced by $paramter$.
\subsection{Plot--Output}
\label{HP}
       This item has two subitems (on,off). $>$On$<$ asks you for a name for a file
       to write the data in. $>$Off$<$ switches HP--Output off (automatically
       done when changing the intervall or printing). After selection
       off, the file contains HP--Plotter compatible data to plot all those
       functions and text you plottet after selection $>$on$<$.

       I have no HP--Plotter, I used the PLT:--Device and it works.

\newpage
%
%
%
\part{Options and inputformats}
\section{Format of functions}
\label{FTerme}
       The  functions can  consist  of
       ()+-*/$\uparrow$, sin,  cos, tan, log,
       int, sgn, abs,  sqr, asin, acos, atan,
       ln and  the constants a-z (without x and e) and the  variable x.
       e (2.7...)
       and pi (3.14...) are already  set. Numbers must be in a usual format
       (1; 1.1;  .1;  3e5;  5d-7...). Macros are used as \_NAME or.
       \_NAME(parameter).
       All  characters  must be  lower  case !!

       Use brackets to make sure, \MathPlot calculates the function, you want.
       It uses the normal mathematical rules ($\uparrow$ before $*,/$
       before $+,-$).

\section{Options}
\label{Optionen}
       \MathPlot load S:Colours and S:Funktionen on startup. See table \ref{Colours}
       and \ref{Funktionen} for some examples.

       When you start \MathPlot from Workbench, you can change the dimension of
       the plot--area via the .info--File. \MathPlot knows the following keyword:
       {\sl WIDTH, HEIGHT, TEXT, VIEW} and {\sl ROUND}.

       {\bf WIDTH} and {\bf HEIGHT} define the dimension of the screen.
       {\bf TEXT} must be followed by the name of the file containing the
       textdefinitions for menus etc. (so you can translate them).
       {\bf ROUND} may be {\sl TRUE} or {\sl FALSE}. Here you can define,
       whether discussion can round little number to zero or not.
       With {\bf VIEW} you define the ViewMode of the screen. Table
       (\ref{VIEWS}) shows some values, you may enter. You can add the
       values (except the vga\dots ones) to get your favorite one.



\begin{table}
\caption{Some values for ViewModes}
\label{VIEWS}
\begin{center}
\begin{tabular}{|l|r|}
\hline
NTSC\_MONITOR\_ID & 69632 \\
PAL\_MONITOR\_ID  & 135168 \\
HIRES\_KEY       & 32768  \\
SUPER\_KEY       & 32800  \\
INTERLACE       & 4      \\
VGAPRODUCT\_KEY  & 233508 \\
VGAPRODUCTLACE\_KEY & 233509 \\
\hline
\end{tabular}
\end{center}
\end{table}


\begin{table}
\caption{Example for a Colours--File}
\label{Colours}
\begin{center}
\begin{tabular}{|l|l|}
\hline
aaa & \verb|Normal   Background| \\
679 & \verb|         TitleBar|   \\
fff & \verb|         Title|      \\
000 & \verb|         Plotting|   \\
fff & \verb|Printing Background| \\
f0f & \verb|         TitleBar|   \\
5f0 & \verb|         Title|      \\
000 & \verb|         Plotting|   \\
09e & \verb|HP-Out   Background| \\
0b0 & \verb|         TitleBar|   \\
fff & \verb|         Title|      \\
000 & \verb|         Plotting|   \\
\hline
\end{tabular}
\end{center}
\end{table}

\begin{table}
\caption{Example for a Funktionen--File}
\label{Funktionen}
\begin{center}
\begin{tabular}{|l|l|}
\hline
sin(x) & Will be the first function \\
cos(x) & Will be the second function \\
tan(x) & etc. \\
x & etc.\\
$x\uparrow 2$ &etc. \\
$x\uparrow 3$ &etc. \\
sqr(x) & etc.\\
log(x) & etc.\\
sgn(x) & etc.\\
abs(x) & etc.\\
\hline
\end{tabular}
\end{center}
\end{table}
\newpage

%
%
%

\part{Some remarks}
\section{Stack--checking}
 This version of \MathPlot is compiled using the --v Option of the SAS--Compiler
 that is without stack--checking. The program will not detect a stack overflow.
 Use a stack of at least 20k, that should be enough.

\section{Known bugs}
I do not know any bugs yet. Please write me if you find one.


%\begin{enumerate}
%\end{enumerate}

The text at the axis sometimes overwrites itself. Perhaps I will find
a solution.

The program and all windows are Font--independent (I hope). With Fonts
$>15$ and a 640--Screen you get problems mit the menus (they are too wide,
they may become too high). Some window become too big to be opened. But
there will be no message to tell you that it is not possible to open a
special window. It is always possible to quit the program using $Amiga-Q$
(I hope). There should be no guru because of a too big font\dots

\newpage
%
%
%
\part{Tutorial}
\section{Introduction}
 This Tutorial tries to help you to work with \MathPlot. Let's say, you
 want to plot the following functions:
$$\sin(x)+\cos(x)$$
$$2*\sin(x)$$
$$\sin(2*x)$$
 As intervall, you want $[-\pi,\pi]$.
\section{Preparation}
 Make sure that you have the following files in LIBS:
\begin{enumerate}
\item mathieeedoubbas.library
\item mathieeedoubtrans.library
\item asl.library
\item tool.library
\end{enumerate}
 If you work often with \MathPlot, copy the following files to S:
\begin{enumerate}
\item Colours
\item Funktionen
\end{enumerate}
 You should also enter the dimension of the plot--area. Click one time on the
 \MathPlot--icon an select Icons/information. Modify the text in Tool--Types until
 you have the following:
\begin{verbatim}
            WIDTH=640
            HEIGHT=200
            TEXT=TextDaten_E
            VIEW=32768
\end{verbatim}
 Then select SAVE and start \MathPlot.
\section{Enter the functions}
 Well, the three functions are quite short, but to make clear how to use it,
 use the macros:
\subsection{Enter the macros}
 Select the item Macros. A window should appear with two gadgets. Press
 the key \verb|a|. An $a$ should appear in the first gadget. Press \RETURN
 In the second gadget, enter \verb|sin(x)| and press \RETURN.
 Select Macros again. Enter \verb|b| and \verb|cos(x)|.
\subsection{Enter the functions}
 Now you can enter the functions. Select three subitems of the item \verb|Change|.
 A window should appear with a gadget. If there is already some text, delete it
 with right--Amiga--x. Then enter \verb|_a+_b|. Press
 \RETURN. The window disappears and appears right again. Enter the second
 function (that is \verb|2*_a|). After \RETURN, you can enter the last
 function (that is \verb|_a(2*x)|, see (\ref{macro})).
 If you look at the subitem of \verb|Change|, you should see your functions.
\section{Enter the intervall}
 Select Intervall. Enter for x--min \verb|-pi|, for
 x--max \verb|pi|, for y--min \verb|-20| and for y--max \verb|20|. Both
 cyclegadgets should be $*1$.
\section{Plot the functions}
 Select at Function/\dots your three functions. They will be plotted. You
 will see, that -20/20 was too much.
\section{Change the intervall}
 You could select Intervall and change it. But you can also use the mouse: Select
 Zoom, select one corner of your new intervall, move the mouse and select the
 second corner. The screen should be cleared.
\section{Discussion}
 If you want to know more about one of the functions, select Discussion/function.

%
%
%

\part{The End}

\section{The End}
     If you  have hints,  questions (please  add postage  for the  answer),
     bug--reports  or want to pay the registration fee,
     here  is  my address:

\subsection{Address}
\begin{verbatim}
                 Ruediger Dreier
                 Gustav-Winkler Str. 40
          W-4800 Bielefeld 18
                 Germany

\end{verbatim}

\begin{center}
       Have fun with my program !!
\end{center}

\end{document}
