% 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$>$}
\parindent 0pt

\begin{document}

\vspace{6cm}
\title{Plotter V3.98}
\author{\copyright by R\"udiger Dreier 1988--91}

\maketitle

\begin{center}
Plotter is FREEWARE
\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}
 Plotter is {\sl{\bf FREEWARE}}.
\end{center}
\vspace{.5cm}

     The program may be freely copied under the following conditions:

\begin{enumerate}
\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 Plotter
 \end{itemize}

\item A version of the mtool.library must be included (at least version 2.05).
\item The copyright text must be included.
\item Everybody  who wants  to use the  Plotter (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.
\end{enumerate}

\section{What it does}
     The Plotter 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).

\section{What you need}
You should have
\begin{enumerate}
\item An Amiga with at least 512kB (more is better)
\item Kickstart 1.2 or 1.3 (2.0 should work, too)
\item A stack of at least 20000
\item in LIBS:
 \begin{enumerate}
  \item mathieeedoubbas.library
  \item mathieeedoubtrans.library
  \item tool.library (should be also on this disk)
 \end{enumerate}
\item in S:
 \begin{enumerate}
  \item Funktionen, some example functions
  \item Colours, some example colours
 \end{enumerate}
\end{enumerate}
\newpage
%
%
%
\part{The menus}
\section{C-Plot}
\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}
       Here you  can enter the intervall, the function  is plotted for. You
       are asked for x-min, x-max, y-min and y-max. You can enter everything
       you can use in a function, too. See chapter (\ref{FTerme})
\subsection{Constants}
\label{Konst}
       You will get a window with two gadgets, the second one disabled.
       In the first one, you should enter one charater (a-z, lower case, do not
       use x or e, you can never use them). That is the name of your constant.
       Press \RETURN and the second
       gadget becomes enabled. If there was already a value for this
       constant, it is displayed. Enter your new constant. That's it.
\subsection{Macros}
\label{macro}
       A window as described in (\ref{Konst}) appears. Enter the name of the
       macro (here you can use x and e). Enter your macro--definition in the
       second gadgets. 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{About}
       You  get some pice of  information about this program.  Click in the
       window to close it.
\subsection{QUIT}
       A requester appears and asks you whether to quit or not.

\section{Function}
\subsection{Change}
       A  submenu  with  the  ten functions  appears  (only  the  first  14
       characters are displayed). Here  you can select one of the functions
       and change  it. Therefore, a window with a gadget appears.
       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.
\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.
       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 it 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.
       When an  error  was  found during  plotting  (division by  zero  for
       example) a requester appears with the message "There was an error".
       To {\bf stop}  plotting, click in the window. A  requester appears and you
       can select whether to continue or stop.
\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.
       For some  functions,  the differentiation  is  not correct  for  all
       values. Table \ref{ABLEITUNGEN} shows the differentiations
       that are used.
       During a discussion, you can stop it with a mouse--click. You are asked
       whether to continue or stop. You can do this for every one of the three
       parts of a discussion.

\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 !!
}

\subsection{Num. Integration}
       A window appears and shows the first part of the selected function.
       You are asked for the intervall and the number of steps to use for
       the numerical integration. 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.
       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.
       You can stop the macro--expansion (e.g. because you produced a recursion),
       just click the mouse. You are asked whether to continue or stop.
}

\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{Graphics}
\subsection{Dim1, Dim2}
       Plotter offers two plot--areas. Here you can select, on which one
       you want to plot. Normaly, the big one does not fit on the screen, so
       you can use the cursor--keys to scroll through it. With ESC, you jump
       to the upper left corner.

       Plotter's preset is 640x200 for Dim1 and
       1000x300 for Dim2. To change this, see chapter \ref{Optionen}.

\subsection{Clear}
       You are asked whether to clear the screen or not. A HP--output
       ends (see \ref{HP})
\subsection{Zoom}
       You  get a rubberbanding  and can  select the part  of the intervall
       which will be plottet next. Using Dim2 (see above) you can
       scroll through the screen using the cursor--keys and ESC. 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.

\section{File}
\subsection{Load/Save functions}
       You are asked for the name of the file to save or load. Look at
       the demo--file to see the format of this files
\subsection{Load/Save macros}
\label{lsm}
       Here you can load or save the macrodefinitions.
\subsection{Load/Save constants}
       See (\ref{lsm}).
\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)
\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{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, dimension 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.
       All  characters  must be  lower  case !!

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

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

       When you start Plotter from Workbench, you can change the dimension of
       the plot--area via the .info--File. Plotter knows the following keyword:
       {\bf WIDTH1, WIDTH2, HEIGHT1, HEIGHT2, TEXT1} and {\bf TEXT2}.

       WIDTH2 should be greater than WIDTH1 and HEIGHT2 $>$ HEIGHT1.
       With TEXT1 and TEXT2 you can change the itemtext Dim1 and Dim2. Add two
       leading spaces, look at the example .info--File.

       Plotter opens a screen with the Dimension WIDTH1/HEIGHT1 and allocates
       memory for a bitmap of the dimension WIDTH2/HEIGHT2. So you should have
       enough memory for the second dimension.


\begin{table}
\caption{Example for a Colours--File}
\label{Colours}
\begin{center}
\begin{tabular}{|l|l|}
\hline
fff & \verb|Printing Background| \\
f0f & \verb|         TitleBar|   \\
5f0 & \verb|         Title|      \\
000 & \verb|         Plotting|   \\
aaa & \verb|Normal   Background| \\
679 & \verb|         TitleBar|   \\
fff & \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 Plotter is compiled using the --v Option of the Lattice--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}
\begin{enumerate}
 \item The value of a  function is sometimes calculated to zero (even when
     it is not). This bug is not reproducible. (I did not see it for a long time)
 \item Sometimes I get a TrapV-exeption. Also not reproducible.
 \item Using the HP--Output I get sometimes files, that can be displayed
       via the s--option of the PLT:--device, but cannot be printet.
\end{enumerate}

\section{Changes}
Here is a list of changes between the published versions of Plotter.
\subsection{V3.96 -- V3.98}
\begin{itemize}
\item Plotter now works correct on FPU--Amigas.
\end{itemize}
\subsection{V3.71 -- V3.96}
\begin{itemize}
\item Two known bugs in Ableitung.c are corrected. Now $x^x$ and one more sort
of functions are differentiated correctly.
\item A new feature are macros (see \ref{macro}).
\item Now you can load and save functions, macros and constants. You can also
load a palette.
\item Numerical integration is now possible.
\item Plotter can do HP--Output, so together with the PLT:--device, you get
good prints.
\item Entering text in the plot--area is now possible.
\item The dimension of the plot--area can be changed via the .info--file (see
\ref{Optionen}).
\end{itemize}
\newpage
%
%
%
\part{Tutorial}
\section{Introduction}
 This Tutorial tries to help you to work with the Plotter. 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 tool.library
\end{enumerate}
 If you work often with Plotter, 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
 Plotter--icon an select Workbench/info. Modify the text in Tool--Types until
 you have the following:
\begin{verbatim}
            WIDTH1=640
            WIDTH2=1000
            HEIGHT1=200
            HEIGHT2=300
            TEXT1=   640x200
            TEXT2=  1000x300
\end{verbatim}
 That is except TEXT1 and TEXT2 the preset, if you start Plotter from CLI.
 Then select SAVE and start the Plotter.
\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. In the first,
 enter \verb|a|. 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|.
\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 cleaned.
\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  (wrong differentiation)  or  money  for me,  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}
