| 1 |
\section{Placer un point sur une courbe \tkzcname{tkzDefPointByFct}} \hypertarget{tptfct}{} |
| 2 |
|
| 3 |
\begin{NewMacroBox}{tkzDefPointByFct}{\parg{$decimal number$}} |
| 4 |
\emph{Cette macro permet de calculer l'image par la fonction définie précédemment, d'un nombre décimal.} |
| 5 |
|
| 6 |
\medskip |
| 7 |
\begin{tabular}{lll} |
| 8 |
\toprule |
| 9 |
argument & exemple & explication \\ |
| 10 |
\midrule |
| 11 |
\TAline{decimal number}{\tkzcname{tkzDefPointByFct(0)}}{définit un point d'abscisse $0$} |
| 12 |
\bottomrule |
| 13 |
\end{tabular} |
| 14 |
|
| 15 |
\begin{tabular}{lll} |
| 16 |
option & defaut & explication \\ |
| 17 |
\midrule |
| 18 |
\TOline{draw}{false}{permet de tracer le point avec le style courant} |
| 19 |
\TOline{with}{a}{permet de choisir la fonction} |
| 20 |
\TOline{ref}{empty}{permet de donner une référence au point} |
| 21 |
\bottomrule |
| 22 |
\end{tabular} |
| 23 |
|
| 24 |
\emph{C'est donc la dernière fonction définie qui est utilisée. Si une autre fonction, est utilisée alors il faut utiliser l'ancienne macro \tkzcname{tkzFctPt}. Le point est défini sous un nom générique \tkzname{tkzPointResult} mais non tracé. Afin de le tracer il faut utiliser la macro \tkzcname{tkzDrawPoint}.} |
| 25 |
\end{NewMacroBox} |
| 26 |
|
| 27 |
\subsection{Exemple avec \tkzcname{tkzGetPoint}} |
| 28 |
Cela permet de référencer le point créé par \tkzcname{tkzDefPointByFct}. |
| 29 |
|
| 30 |
\begin{center} |
| 31 |
\begin{tkzexample}[vbox] |
| 32 |
\begin{tikzpicture}[scale=1.25] |
| 33 |
\tkzInit[xmin=-2,xmax=2,xstep=1, |
| 34 |
ymin=-8,ymax=24,ystep=8] |
| 35 |
\tkzGrid \tkzAxeXY |
| 36 |
\tkzFct[domain =-1.5:1]{3.0-1.3125*x**5-2.5*x**3} |
| 37 |
\tkzDefPointByFct(.5) \tkzGetPoint{A}\tkzDrawPoint(A) |
| 38 |
\tkzLabelPoint[above right](A){$A_0$} |
| 39 |
\end{tikzpicture} |
| 40 |
\end{tkzexample} |
| 41 |
\end{center} |
| 42 |
|
| 43 |
|
| 44 |
\newpage |
| 45 |
\subsection{Exemple avec \tkzcname{tkzGetPoint} et \tkzname{tkzPointResult}} |
| 46 |
Il est possible de ne pas référencer le point et d'utiliser la référence générique. |
| 47 |
|
| 48 |
\begin{tkzexample}[latex=7cm,small] |
| 49 |
\begin{tikzpicture}[scale=1.25] |
| 50 |
\tkzInit[xmin=-2,xmax=2,xstep=1, |
| 51 |
ymin=-8,ymax=24,ystep=8] |
| 52 |
\tkzGrid |
| 53 |
\tkzAxeXY |
| 54 |
\tkzFct[domain =-1.5:1]{3.0-1.3125*x**5-2.5*x**3} |
| 55 |
\tkzDefPointByFct(.5) |
| 56 |
\tkzDrawPoint(tkzPointResult) |
| 57 |
% ou bien \tkzDefPointByFct[draw](.5) |
| 58 |
\end{tikzpicture} |
| 59 |
\end{tkzexample} |
| 60 |
|
| 61 |
\subsection{Options \tkzname{draw} et \tkzname{ref}} |
| 62 |
Cela permet de tracer un point directement avec les options usuelles donc sans possibilités de personnaliser et d'attribuer une référence à ce point. |
| 63 |
|
| 64 |
\begin{tkzexample}[latex=7cm,small] |
| 65 |
\begin{tikzpicture}[scale=1.25] |
| 66 |
\tkzInit[xmin=-2,xmax=2,xstep=1, |
| 67 |
ymin=-8,ymax=24,ystep=8] |
| 68 |
\tkzGrid |
| 69 |
\tkzAxeXY |
| 70 |
\tkzFct[domain =-1.5:1]{3.0-1.3125*x**5-2.5*x**3} |
| 71 |
\tkzDefPointByFct[draw,ref=A](.5) |
| 72 |
\tkzLabelPoint[above right](A){$a$} |
| 73 |
\end{tikzpicture} |
| 74 |
\end{tkzexample} |
| 75 |
|
| 76 |
\newpage |
| 77 |
\subsection{Placer des points sans courbe} |
| 78 |
Attention, ceci est délicat. Il suffit de définir la macro \tkzcname{tkzFctLast} qui est la dernière expression traduite avec la syntaxe de \tkzname{fp.sty}. Les points sont donc déterminer avec \tkzname{fp.sty}. |
| 79 |
|
| 80 |
\begin{tkzexample}[] |
| 81 |
\begin{tikzpicture}[xscale=3,yscale=2] |
| 82 |
\tkzInit[xmin=-2,xmax=2,xstep=1, |
| 83 |
ymin=-8,ymax=24,ystep=8] |
| 84 |
\tkzGrid |
| 85 |
\tkzAxeXY |
| 86 |
\global\edef\tkzFctLast{3.0-1.3125*x^5-2.5*x^3} |
| 87 |
\foreach \va in {-1.5,-1.4,...,1}{% |
| 88 |
\tkzDefPointByFct[draw](\va)} |
| 89 |
\end{tikzpicture} |
| 90 |
\end{tkzexample} |
| 91 |
|
| 92 |
\newpage\null |
| 93 |
\subsection{Placer des points sans se soucier des coordonnées} |
| 94 |
|
| 95 |
Cette fois, le domaine s'étend de 0 à 800, les valeurs prises par la fonction de $0$ à $\numprint{2000}$. \tkzname{xstep=100} donc il faut utliser |\x| à la place de $x$. Une petite astuce au niveau de gnuplot, 1. et 113. permettent d'obtenir une division dans les décimaux sinon la division se fait dans les entiers. |
| 96 |
|
| 97 |
Ensuite, j'utilise les macros pour placer des points |
| 98 |
|
| 99 |
\begin{tkzexample}[] |
| 100 |
\begin{tikzpicture}[scale=1.6] |
| 101 |
\tkzInit[xmin = 0, xmax = 800, |
| 102 |
ymin = 0, ymax = 2000, |
| 103 |
xstep = 100,ystep = 400] |
| 104 |
\tkzGrid |
| 105 |
\tkzAxeXY |
| 106 |
\tkzFct[color = blue, |
| 107 |
domain = 0:800]% |
| 108 |
{(1./90000)*\x*\x*\x-(1./100)*\x*\x+(113./36)*\x} |
| 109 |
\foreach \va in {0,450,800}{% |
| 110 |
\tkzDefPointByFct[draw](\va)} |
| 111 |
\end{tikzpicture} |
| 112 |
\end{tkzexample} |
| 113 |
|
| 114 |
\newpage |
| 115 |
\subsection{Placer des points avec deux fonctions} |
| 116 |
|
| 117 |
\medskip |
| 118 |
Revoir \tkzcname{tkzSetUpPoint} et \tkzcname{tkzText} du module \tkzname{tkz-base.sty} |
| 119 |
|
| 120 |
|
| 121 |
\begin{tkzexample}[code only] |
| 122 |
\begin{tikzpicture}[scale=4] |
| 123 |
\tkzInit[xmax=3,ymax=2] |
| 124 |
\tkzAxeX |
| 125 |
\tkzAxeY |
| 126 |
\tkzGrid(0,0)(3,2) |
| 127 |
\tkzFct[color = red,domain = 1./3:3]{0.125*(3*x-1)+0.375*(3*x-1)/(x*x)} |
| 128 |
\tkzFct[color = green,domain = 1./3:3]{0.125*(3*x-1)} |
| 129 |
\tkzSetUpPoint[shape=circle, size = 4, color=black, fill=lightgray] |
| 130 |
\tkzDefPointByFct[draw,with = a](1) |
| 131 |
\tkzDefPointByFct[draw,with = a](2) |
| 132 |
\tkzDefPointByFct[draw,with = a](3) |
| 133 |
\tkzDefPointByFct[draw,with = b](3) |
| 134 |
\tkzDefPointByFct[draw,with = b](1/3) |
| 135 |
\tkzText[draw,color= red,fill=red!20](1,1.5) % |
| 136 |
{$f(x)=\frac{1}{8}(3x-1)+\frac{3}{8}% |
| 137 |
\left(\frac{3x-1}{x^2}\right)$} |
| 138 |
\tkzText[draw,color= green!50!black,fill=green!20]% |
| 139 |
(2,0.3){$g(x)=\frac{1}{8}(3x-1)$} |
| 140 |
\end{tikzpicture} |
| 141 |
\end{tkzexample} |
| 142 |
|
| 143 |
\begin{tikzpicture}[scale=4] |
| 144 |
\tkzInit[xmax=3,ymax=2] |
| 145 |
\tkzAxeX |
| 146 |
\tkzAxeY |
| 147 |
\tkzGrid(0,0)(3,2) |
| 148 |
\tkzFct[color = red,domain = 1./3:3]{0.125*(3*x-1)+0.375*(3*x-1)/(x*x)} |
| 149 |
\tkzFct[color = green,domain = 1./3:3]{0.125*(3*x-1)} |
| 150 |
\tkzSetUpPoint[shape=circle, size = 4, color=black, fill=lightgray] |
| 151 |
\tkzDefPointByFct[draw,with = a](1) |
| 152 |
\tkzDefPointByFct[draw,with = a](2) |
| 153 |
\tkzDefPointByFct[draw,with = a](3) |
| 154 |
\tkzDefPointByFct[draw,with = b](3) |
| 155 |
\tkzDefPointByFct[draw,with = b](1/3) |
| 156 |
\tkzText[draw,color= red,fill=red!20](1,1.5) % |
| 157 |
{$f(x)=\frac{1}{8}(3x-1)+\frac{3}{8}% |
| 158 |
\left(\frac{3x-1}{x^2}\right)$} |
| 159 |
\tkzText[draw,color= green!50!black,fill=green!20]% |
| 160 |
(2,0.3){$g(x)=\frac{1}{8}(3x-1)$} |
| 161 |
\end{tikzpicture} |
| 162 |
|
| 163 |
\endinput |