\section{Placer un point sur une courbe \tkzcname{tkzDefPointByFct}} \hypertarget{tptfct}{} \begin{NewMacroBox}{tkzDefPointByFct}{\parg{$decimal number$}} \emph{Cette macro permet de calculer l'image par la fonction définie précédemment, d'un nombre décimal.} \medskip \begin{tabular}{lll} \toprule argument & exemple & explication \\ \midrule \TAline{decimal number}{\tkzcname{tkzDefPointByFct(0)}}{définit un point d'abscisse $0$} \bottomrule \end{tabular} \begin{tabular}{lll} option & defaut & explication \\ \midrule \TOline{draw}{false}{permet de tracer le point avec le style courant} \TOline{with}{a}{permet de choisir la fonction} \TOline{ref}{empty}{permet de donner une référence au point} \bottomrule \end{tabular} \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}.} \end{NewMacroBox} \subsection{Exemple avec \tkzcname{tkzGetPoint}} Cela permet de référencer le point créé par \tkzcname{tkzDefPointByFct}. \begin{center} \begin{tkzexample}[vbox] \begin{tikzpicture}[scale=1.25] \tkzInit[xmin=-2,xmax=2,xstep=1, ymin=-8,ymax=24,ystep=8] \tkzGrid \tkzAxeXY \tkzFct[domain =-1.5:1]{3.0-1.3125*x**5-2.5*x**3} \tkzDefPointByFct(.5) \tkzGetPoint{A}\tkzDrawPoint(A) \tkzLabelPoint[above right](A){$A_0$} \end{tikzpicture} \end{tkzexample} \end{center} \newpage \subsection{Exemple avec \tkzcname{tkzGetPoint} et \tkzname{tkzPointResult}} Il est possible de ne pas référencer le point et d'utiliser la référence générique. \begin{tkzexample}[latex=7cm,small] \begin{tikzpicture}[scale=1.25] \tkzInit[xmin=-2,xmax=2,xstep=1, ymin=-8,ymax=24,ystep=8] \tkzGrid \tkzAxeXY \tkzFct[domain =-1.5:1]{3.0-1.3125*x**5-2.5*x**3} \tkzDefPointByFct(.5) \tkzDrawPoint(tkzPointResult) % ou bien \tkzDefPointByFct[draw](.5) \end{tikzpicture} \end{tkzexample} \subsection{Options \tkzname{draw} et \tkzname{ref}} 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. \begin{tkzexample}[latex=7cm,small] \begin{tikzpicture}[scale=1.25] \tkzInit[xmin=-2,xmax=2,xstep=1, ymin=-8,ymax=24,ystep=8] \tkzGrid \tkzAxeXY \tkzFct[domain =-1.5:1]{3.0-1.3125*x**5-2.5*x**3} \tkzDefPointByFct[draw,ref=A](.5) \tkzLabelPoint[above right](A){$a$} \end{tikzpicture} \end{tkzexample} \newpage \subsection{Placer des points sans courbe} 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}. \begin{tkzexample}[] \begin{tikzpicture}[xscale=3,yscale=2] \tkzInit[xmin=-2,xmax=2,xstep=1, ymin=-8,ymax=24,ystep=8] \tkzGrid \tkzAxeXY \global\edef\tkzFctLast{3.0-1.3125*x^5-2.5*x^3} \foreach \va in {-1.5,-1.4,...,1}{% \tkzDefPointByFct[draw](\va)} \end{tikzpicture} \end{tkzexample} \newpage\null \subsection{Placer des points sans se soucier des coordonnées} 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. Ensuite, j'utilise les macros pour placer des points \begin{tkzexample}[] \begin{tikzpicture}[scale=1.6] \tkzInit[xmin = 0, xmax = 800, ymin = 0, ymax = 2000, xstep = 100,ystep = 400] \tkzGrid \tkzAxeXY \tkzFct[color = blue, domain = 0:800]% {(1./90000)*\x*\x*\x-(1./100)*\x*\x+(113./36)*\x} \foreach \va in {0,450,800}{% \tkzDefPointByFct[draw](\va)} \end{tikzpicture} \end{tkzexample} \newpage \subsection{Placer des points avec deux fonctions} \medskip Revoir \tkzcname{tkzSetUpPoint} et \tkzcname{tkzText} du module \tkzname{tkz-base.sty} \begin{tkzexample}[code only] \begin{tikzpicture}[scale=4] \tkzInit[xmax=3,ymax=2] \tkzAxeX \tkzAxeY \tkzGrid(0,0)(3,2) \tkzFct[color = red,domain = 1./3:3]{0.125*(3*x-1)+0.375*(3*x-1)/(x*x)} \tkzFct[color = green,domain = 1./3:3]{0.125*(3*x-1)} \tkzSetUpPoint[shape=circle, size = 4, color=black, fill=lightgray] \tkzDefPointByFct[draw,with = a](1) \tkzDefPointByFct[draw,with = a](2) \tkzDefPointByFct[draw,with = a](3) \tkzDefPointByFct[draw,with = b](3) \tkzDefPointByFct[draw,with = b](1/3) \tkzText[draw,color= red,fill=red!20](1,1.5) % {$f(x)=\frac{1}{8}(3x-1)+\frac{3}{8}% \left(\frac{3x-1}{x^2}\right)$} \tkzText[draw,color= green!50!black,fill=green!20]% (2,0.3){$g(x)=\frac{1}{8}(3x-1)$} \end{tikzpicture} \end{tkzexample} \begin{tikzpicture}[scale=4] \tkzInit[xmax=3,ymax=2] \tkzAxeX \tkzAxeY \tkzGrid(0,0)(3,2) \tkzFct[color = red,domain = 1./3:3]{0.125*(3*x-1)+0.375*(3*x-1)/(x*x)} \tkzFct[color = green,domain = 1./3:3]{0.125*(3*x-1)} \tkzSetUpPoint[shape=circle, size = 4, color=black, fill=lightgray] \tkzDefPointByFct[draw,with = a](1) \tkzDefPointByFct[draw,with = a](2) \tkzDefPointByFct[draw,with = a](3) \tkzDefPointByFct[draw,with = b](3) \tkzDefPointByFct[draw,with = b](1/3) \tkzText[draw,color= red,fill=red!20](1,1.5) % {$f(x)=\frac{1}{8}(3x-1)+\frac{3}{8}% \left(\frac{3x-1}{x^2}\right)$} \tkzText[draw,color= green!50!black,fill=green!20]% (2,0.3){$g(x)=\frac{1}{8}(3x-1)$} \end{tikzpicture} \endinput