1 \section{Curves of real-valued and
\Index{parameterised functions
}}
3 \subsection{Curve of a real-valued function
}
5 The object
\Lkeyword{courbe
} allows us to draw a curve, where the
6 name is given with the option
\Lkeyword{function
}. This
\Index{function
},
7 with values in $
\mathbb{R
}$, has to be defined by the macro
8 \verb+
\defFunction+ (see the appropriate paragraph for more
11 We can define this function either in algebraic notation, with the
12 option
\Lkeyword{algebraic
}, or in Reverse Polish Notation (RPN),
13 with variables like $(x,u,t
\ldots)$, using an expression of the
18 \defFunction[algebraic
]{nom_fonction
}(x)
{x*sin(x)
}{}{}
22 \defFunction{nom_fonction
}(x)
{x dup sin mul
}{}{}
26 \encadre{This expression needs to be included within a
27 \texttt{pspicture
} environment.
}
29 The limits of the variables are defined by the option
30 \texttt{\Lkeyword{range
}=$xmin$ $xmax$
}, and the option
\texttt{argument=$n$
}
31 defines the number of points to be plotted when drawing the
\Index{curve
}.
33 \begin{LTXexample
}[width=
7.5cm
]
34 \begin{pspicture
}(-
3,-
3)(
4,
3.5)
%
35 \psframe*
[linecolor=blue!
50](-
3,-
3)(
4,
3.5)
36 \psset{lightsrc=
50 20 20,viewpoint=
50 30 15,Decran=
60}
38 \defFunction[algebraic
]{1_sin
}(x)
{2*sin(
1/x)
}{}{}
39 \psSolid[object=grille,
41 linewidth=
0.5\pslinewidth,linecolor=gray,
]
42 %% definition du plan de projection
46 base=-
3.2 3.2 -
2.2 2.2,
56 \psProjection[object=courbe,
58 range=-
3 3,resolution=
720,
61 \axesIIID(
4,
2,
2)(
5,
4,
3)
65 \subsection{\Index{Parameterised curves
}}
67 The technique used here is analogous to the above, with the
68 difference that the values now come from $
\mathbb{R
}^
2$, and the
69 object for the macro
\Lcs{psProjection
} is now
\Lkeyword{courbeR2
}.
71 For example, to draw a circle of radius $
3$ and centre $O$, we
75 \defFunction[algebraic
]{cercle
}(t)
{3*cos(t)
}{3*sin(t)
}{}
79 Another example:
\Index{Lissajous
} curves.
82 \begin{LTXexample
}[width=
7.5cm
]
83 \begin{pspicture
}(-
3,-
3)(
4,
3.5)
%
84 \psframe*
[linecolor=blue!
50](-
3,-
3)(
4,
3.5)
85 \psset{lightsrc=
50 20 20,viewpoint=
50 30 15,Decran=
60}
87 \defFunction[algebraic
]{F
}(t)
{2*sin(
0.57735*t)
}{2*sin(
0.707*t)
}{}
88 \psSolid[object=grille,
90 linewidth=
0.5\pslinewidth,linecolor=gray,
]
91 %% definition du plan de projection
95 base=-
3.2 3.2 -
2.2 2.2,
100 \psSolid[object=plan,
105 \psProjection[object=courbeR2,
106 range=-
25.12 25.12,resolution=
720,
107 normal=
1 1 2,linecolor=red,
110 \axesIIID(
4,
2,
2)(
5,
4,
3)