| 1 |
\section{Defining a function} |
| 2 |
|
| 3 |
It is possible to define \Index{functions} usable in a PostScript environment. |
| 4 |
|
| 5 |
The domain can be $\mathbb{R}$, $\mathbb{R}^2$ |
| 6 |
or $\mathbb{R}^3$, and the codomain can be $\mathbb{R}$, $\mathbb{R}^2$ or $\mathbb{R}^3$. |
| 7 |
|
| 8 |
The definition is made with the macro \verb+\defFunction+. This macro comes with six |
| 9 |
arguments, where the first is optional. |
| 10 |
|
| 11 |
|
| 12 |
\verb!\defFunction[<options>]{<name>}(<var>){<x(var)>}{<y(var)>}{<z(var)>}! |
| 13 |
|
| 14 |
\begin{table}[h] |
| 15 |
\begin{tabular}{p{2cm}p{11cm}} |
| 16 |
\verb!<options>! & We insert the options typical to PSTricks, like |
| 17 |
\verb!linewidth! etc., and, some of them defined by |
| 18 |
\verb!pst-solides3d!. A very nice and helpful option is \verb!algebraic!, |
| 19 |
with which one can avoid RPN (Reverse Polish |
| 20 |
Notation). All the options are key value pairs separated with commas.\\ |
| 21 |
|
| 22 |
\verb!<name>! & This is a unique name of your choice---but be careful: avoid |
| 23 |
names that contain accents, PostScript doesn't like them at all.\\ |
| 24 |
|
| 25 |
\verb!<var>! & We insert at most three variables, arbitrarily chosen and separated with commas.\\ |
| 26 |
|
| 27 |
\verb!<x(var)>! \verb!<y(var)>! \verb!<z(var)>! & |
| 28 |
Here, we place functions defining the three Euclidean components $x,\,y,\,z$. |
| 29 |
If one of the three components is not wanted, just enter a 0 within |
| 30 |
parentheses---this will also allow you to define some projections of the lines of functions. |
| 31 |
\end{tabular} |
| 32 |
\end{table} |
| 33 |
|
| 34 |
Once you have defined a function, this function is always called by its chosen name \verb!<name>!. |
| 35 |
|
| 36 |
Here some examples: |
| 37 |
\begin{compactitem} |
| 38 |
\item \verb!\defFunction{moncercle}(t){t cos 3 mul}{0}{t sin 3 mul}! |
| 39 |
|
| 40 |
draws a circle with radis 3 in the $xOz$ plane (notation RPN). |
| 41 |
\item \verb!\defFunction[algebraic]{helice}(t){cos(t)}{sin(t)}{t}! |
| 42 |
|
| 43 |
draws a helix in algebraic notation. |
| 44 |
\item \verb!\defFunction[algebraic]{F}(t){t}{}{}! |
| 45 |
|
| 46 |
draws a function from $\mathbb{R}$ in $\mathbb{R}$ |
| 47 |
\item \verb!\defFunction[algebraic]{F}(t){t}{t}{}! |
| 48 |
|
| 49 |
draws a function from $\mathbb{R}$ in $\mathbb{R}^2$ |
| 50 |
\item \verb!\defFunction[algebraic]{F}(t){t}{t}{t}! |
| 51 |
|
| 52 |
draws a function from $\mathbb{R}$ in $\mathbb{R}^3$ |
| 53 |
|
| 54 |
\end{compactitem} |
| 55 |
|
| 56 |
There remains work to be done on this macro. For the moment it does not permit an arbitrary |
| 57 |
choice of names of variables, as this risks conflict with existing names. Please use |
| 58 |
names analogous to those used in the documentation. A good strategy is to systematically use |
| 59 |
one or more numerical characters at the end of the names of your variables. |
| 60 |
|
| 61 |
\endinput |