| 1 |
\section{Macros pour tracer des tangentes } |
| 2 |
|
| 3 |
Si une seule fonction est utilisée, elle est stockée avec comme nom |
| 4 |
\tkzcname{tkzFcta}, si une deuxième fonction est utilisée, elle sera stockée avec comme nom \tkzcname{tkzFctb}, et ainsi de suite\ldots Si plusieurs fonctions sont présentent dans un même environnement alors l'option \tkzname{with} permet de choisir celle qui sera mise à contribution. |
| 5 |
|
| 6 |
\tkzHandBomb Il faut bien évidemment, avoir initialisé l'environnement à l'aide \tkzcname{tkzInit}, avant d'appeler \tkzcname{tkzFct} et \tkzcname{tkzDrawTangentLine}. Pour la longueur des vecteurs représentants les demi-tangentes, il faut attribuer une valeur aux coefficients \tkzname{kl} et \tkzname{kr}. $kl=0$ ou $kr=0$ annule le dessin de la demi-tangente correspondante (l=left) et (r=right). Si \tkzname{xstep=1} et \tkzname{ystep=1} alors si la pente est égale à 1, la demi-tangente a pour mesure $\sqrt{2}$. |
| 7 |
Dans les autres cas si AT est la longueur de la demi-tangente et si $p$ est la pente alors $\vec{AT}$ a pour coordonnées (\tkzname{kl},\tkzname{kl*p}.) |
| 8 |
|
| 9 |
|
| 10 |
\subsection{Représentation d'une tangente \tkzcname{tkzDrawTangentLine}} |
| 11 |
\hypertarget{tdtl}{} |
| 12 |
\begin{NewMacroBox}{tkzDrawTangentLine}{\oarg{local options}\parg{a}} |
| 13 |
\emph{On l'emploie soit juste après l'utilisation de \tkzcname{tkzFct}, sinon il faut donner la référence de la fonction à l'aide de l'option \tkzname{with}.} |
| 14 |
|
| 15 |
\medskip |
| 16 |
\begin{tabular}{lll} |
| 17 |
\toprule |
| 18 |
options & exemple & explication \\ |
| 19 |
\midrule |
| 20 |
\TAline{a}{\tkzcname{tkzDrawTangentLine(0)}}{tangente au point d'abscisse $0$} |
| 21 |
\bottomrule |
| 22 |
\end{tabular} |
| 23 |
|
| 24 |
Les options sont celles de \TIKZ comme \tkzname{color} ou \tkzname{style} plus les options suivantes |
| 25 |
|
| 26 |
\begin{tabular}{lll} |
| 27 |
\toprule |
| 28 |
options & défaut & définition \\ |
| 29 |
\midrule |
| 30 |
\TOline{draw}{false}{booléen si true alors le point de contact est tracé} |
| 31 |
\TOline{with}{a}{permet de choisir une fonction} |
| 32 |
\TOline{kr}{1}{coefficient pour la longueur de la demi-tangente à droite} |
| 33 |
\TOline{kl} {1}{coefficient pour la longueur de la demi-tangente à gauche} |
| 34 |
\end{tabular} |
| 35 |
\end{NewMacroBox} |
| 36 |
%<---------------------------------------------------------------------------> |
| 37 |
\subsection{Tangente avec \tkzname{xstep} et \tkzname{ystep} différents de 1} |
| 38 |
|
| 39 |
\begin{tikzpicture}[xscale=1.5] |
| 40 |
\tikzset{tan style/.style={-}} |
| 41 |
\tkzInit[xmin=0,xmax=800,xstep=100,ymin=0,ymax=1800,ystep=400] |
| 42 |
\tkzGrid[color=brown,sub,subxstep=50,subystep=200](0,0)(800,1800) |
| 43 |
\tkzAxeXY |
| 44 |
\tkzFct[color=red,samples=100,domain = 0:800]% |
| 45 |
{(1./90000)*\x*\x*\x-(1./100)*\x*\x+(113./36)*\x} |
| 46 |
\tkzDrawTangentLine[draw,color=blue,kr=300,kl=450](450) |
| 47 |
\tkzText[draw,color = black,fill = brown!50,opacity = 0.8](300,1200)% |
| 48 |
{$f(x)=\dfrac{1}{90000}x^3 -\dfrac{1}{{100}}x^2 +\dfrac{113}{36}x$} |
| 49 |
\end{tikzpicture} |
| 50 |
|
| 51 |
Il faut remarquer qu'il n'est point nécessaire de faire des calculs. Il suffit d'utiliser les valeurs qui correspondent aux graduations. |
| 52 |
|
| 53 |
On peut changer le style des tangentes avec, par exemple, |
| 54 |
|
| 55 |
\tkzcname{tikzset\{tan style/.style=\{-\}\}} par défaut on a : |
| 56 |
|
| 57 |
\tkzcname{tikzset\{tan style/.style=\{->,>=latex\}\}} |
| 58 |
|
| 59 |
\begin{tkzexample}[code only] |
| 60 |
\begin{tikzpicture}[xscale=1.5] |
| 61 |
\tikzset{tan style/.style={-}} |
| 62 |
\tkzInit[xmin=0,xmax=800,xstep=100, |
| 63 |
ymin=0,ymax=1800,ystep=400] |
| 64 |
\tkzGrid[color=brown,sub,subxstep=50,subystep=200](0,0)(800,1800) |
| 65 |
\tkzAxeXY |
| 66 |
\tkzFct[color=red,samples=100,domain = 0:800]% |
| 67 |
{(1./90000)*\x*\x*\x-(1./100)*\x*\x+(113./36)*\x} |
| 68 |
\tkzDrawTangentLine[color=blue,kr=300,kl=450](450) |
| 69 |
\tkzText[draw, color = black,% |
| 70 |
fill = brown!50, opacity = 0.8](300,1200)% |
| 71 |
{$f(x)=\dfrac{1}{90000}x^3 -\dfrac{1}{{100}}x^2 +\dfrac{113}{36}x$} |
| 72 |
\end{tikzpicture} |
| 73 |
\end{tkzexample} |
| 74 |
%<---------------------------------------------------------------------------> |
| 75 |
\subsection{Les options \tkzname{kl}, \tkzname{kr} et l'option \tkzname{draw}} |
| 76 |
Si l'un des deux nombres \tkzname{kl} ou \tkzname{kr} est nul alors seulement une demi-tangente est tracée sinon ces nombres représentent un pourcentage de la longueur initiale de la tangente. L'option \tkzname{draw} permet de tracer le point de contact. |
| 77 |
|
| 78 |
\begin{tkzexample}[] |
| 79 |
\begin{tikzpicture}[scale=1.5] |
| 80 |
\tkzInit[xmin=-3,xmax=4,ymin=-4,ymax=2] |
| 81 |
\tkzGrid \tkzDrawXY \tkzClip |
| 82 |
\tkzFct[domain = -2.15:3.2]{(-x*x)+2*x} |
| 83 |
\tkzDefPointByFct[draw](2) |
| 84 |
\tkzDrawTangentLine[kl=0,draw](-1) |
| 85 |
\tkzDrawTangentLine[draw](1) |
| 86 |
\tkzDrawTangentLine[kr=0,draw](3) |
| 87 |
\tkzRep |
| 88 |
\end{tikzpicture} |
| 89 |
\end{tkzexample} |
| 90 |
|
| 91 |
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> |
| 92 |
\subsection{Tangente et l'option \tkzname{with}} |
| 93 |
Soit on place la macro \tkzcname{tkzDrawTangentLine} après la ligne |
| 94 |
qui définit la première fonction $(a)$, soit on trace une autre fonction avant, et dans ce cas, il est nécessaire de préciser quelle fonction sera utilisée. pour se faire, on utilise l'option \tkzname{with}. |
| 95 |
|
| 96 |
\begin{tkzexample}[] |
| 97 |
\begin{tikzpicture}[scale=4] |
| 98 |
\tkzInit[xmax=3,ymax=2] |
| 99 |
\tkzAxeXY |
| 100 |
\tkzGrid(0,0)(3,2) |
| 101 |
\tkzFct[color = red, domain = 1/3:3]{0.125*(3*x-1)+0.375*(3*x-1)/(x*x)} |
| 102 |
\tkzFct[color = blue, domain = 1/3:3]{0.125*(3*x-1)} |
| 103 |
\tkzDrawTangentLine[with=a, |
| 104 |
color=blue](1) |
| 105 |
\tkzText[draw, |
| 106 |
color= red](1,1.5)% |
| 107 |
{$f(x)=\frac{1}{8}(3x-1)+\frac{3}{8}\left(\frac{3x-1}{x^2}\right)$} |
| 108 |
\tkzText[draw, |
| 109 |
color= blue](2,0.3)% |
| 110 |
{$g(x)=\frac{1}{8}(3x-1)$} |
| 111 |
\end{tikzpicture} |
| 112 |
\end{tkzexample} |
| 113 |
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> |
| 114 |
\subsection{Quelques tangentes } |
| 115 |
|
| 116 |
\begin{tkzexample}[] |
| 117 |
\begin{tikzpicture}[scale=2] |
| 118 |
\tkzInit[xmin=-5,xmax=2,ymin=-1, ymax=3] |
| 119 |
\tkzDrawX |
| 120 |
\tkzDrawY |
| 121 |
\tkzText[draw,color = red,fill = orange!20]( 1.5,1.5){$y = xe^x$} |
| 122 |
\tkzFct[color = red, domain = -5:1]{x*exp(x)}% |
| 123 |
\tkzDrawTangentLine[color=blue,kr=2,kl=2](-2) |
| 124 |
\tkzDrawTangentLine[color=green,kr=2,kl=2](-1) |
| 125 |
\tkzDrawTangentLine[color=blue](0) |
| 126 |
\tkzDrawTangentLine[color=blue,kr=0](1) |
| 127 |
\end{tikzpicture} |
| 128 |
\end{tkzexample} |
| 129 |
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> |
| 130 |
\subsection{Demi-tangentes } |
| 131 |
Il faut remarquer que les tangentes sont en réalité deux demi-tangentes ce qui permet d'obtenir simplement le résultat ci-dessous. |
| 132 |
|
| 133 |
Poosible sont les écritures \tkzname{(((x+1)*x)*x)**0.5}, \tkzname{(x**3+x**2)**0.5} et \tkzname{(x*x*x+x*x)**(0.5)}. |
| 134 |
|
| 135 |
Dans cet exemple, les deux demi-tangentes sont obtenues automatiquement : |
| 136 |
|
| 137 |
\begin{tkzexample}[] |
| 138 |
\begin{tikzpicture}[scale=2.75] |
| 139 |
\tkzInit[xmin=-2,xmax=3,ymax=3] |
| 140 |
\tkzGrid[color=orange](-2,0)(3,3) |
| 141 |
\tkzAxeX |
| 142 |
\tkzAxeY |
| 143 |
\tkzFct[color = red ,domain = -1:2]{(((x+1)*x)*x)**0.5} |
| 144 |
\tkzDrawTangentLine(0) |
| 145 |
\tkzText[draw,color = red,fill = orange!20](2,1){$f(x)=\sqrt{x^3+x^2}$} |
| 146 |
\end{tikzpicture} |
| 147 |
\end{tkzexample} |
| 148 |
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––> |
| 149 |
\subsection{Demi-tangentes Courbe de Lorentz } |
| 150 |
|
| 151 |
Ici, on ne veut que les demi-tangentes comprises entre 0 et 1, pour cela il suffit dans un cas de donner la valeur 0 à \tkzname{kr} et dans l'autre à \tkzname{kl}. |
| 152 |
|
| 153 |
\begin{center} |
| 154 |
\begin{tkzexample}[vbox] |
| 155 |
\begin{tikzpicture}[scale=1.25] |
| 156 |
\tkzInit[xmax=1,ymax=1,xstep=0.1,ystep=0.1] |
| 157 |
\tkzGrid(0,0)(1,1) |
| 158 |
\tkzAxeXY |
| 159 |
\tkzFct[color = red,thick, domain =0:1]{(exp(\x)-1)/(exp(1)-1)} |
| 160 |
\tkzSetUpPoint[size=4] |
| 161 |
\tkzDrawTangentLine[draw, kl = 0, kr = 0.4](0) |
| 162 |
\tkzDrawTangentLine[draw, kl = 0.4,kr = 0 ](1) |
| 163 |
\tkzText[draw,color = red,fill = orange!20](0.5,0.6)% |
| 164 |
{$f(x)=\dfrac{\text{e}^x-1}{\text{e}-1}$} |
| 165 |
\end{tikzpicture} |
| 166 |
\end{tkzexample} |
| 167 |
\end{center} |
| 168 |
%<---------------------------------------------------------------------------> |
| 169 |
\subsection{Série de tangentes} |
| 170 |
|
| 171 |
|
| 172 |
\begin{tkzexample}[vbox] |
| 173 |
\begin{tikzpicture}[scale=2] |
| 174 |
\tikzstyle{tan style}=[-] |
| 175 |
\tkzInit[xmin=-5,xmax=2,ymin=-1,ymax=3] |
| 176 |
\tkzDrawXY |
| 177 |
\tkzText[draw,color = red, fill = orange!20](1.5,1.5){$y = xe^x$} |
| 178 |
\tkzFct[line width = 0.01 pt,color = red, domain = -5:1]{x*exp(x)} |
| 179 |
\foreach \x in {-4,-3.8,...,0}{% |
| 180 |
\tkzDrawTangentLine[color=blue,line width=.4pt,kr=1,kl=0.5](\x)} |
| 181 |
\foreach \x in {0.6,0.8,1}{% |
| 182 |
\tkzDrawTangentLine[color=blue,line width=.4pt, kr=0,kl=0.5](\x)} |
| 183 |
\end{tikzpicture} |
| 184 |
\end{tkzexample} |
| 185 |
%<---------------------------------------------------------------------------> |
| 186 |
\subsection{Série de tangentes sans courbe} |
| 187 |
|
| 188 |
Pour cela, il faut définir la dernière expression avec la syntaxe de \tkzname{fp.sty}. |
| 189 |
|
| 190 |
Définition de \tkzcname{tkzFctLast} |
| 191 |
\begin{tkzltxexample}[] |
| 192 |
\global\edef\tkzFctLast{x*exp(x)} |
| 193 |
\end{tkzltxexample} |
| 194 |
|
| 195 |
\subsubsection{Utilisation de \tkzcname{tkzFctLast}} |
| 196 |
\begin{tkzexample}[vbox] |
| 197 |
\begin{tikzpicture}[scale=2] |
| 198 |
\tikzstyle{tan style}=[-] |
| 199 |
\tkzInit[xmin=-5,xmax=2,ymin=-1,ymax=3] |
| 200 |
\tkzDrawXY |
| 201 |
\tkzText[draw,color = red, fill = orange!20](1.5,1.5){$y = xe^x$} |
| 202 |
\global\edef\tkzFctLast{x*exp(x)}% c'est la ligne importante |
| 203 |
\foreach \v in {-4,-3.8,...,0}{% |
| 204 |
\tkzDrawTangentLine[color=blue,line width=.4pt,kl=1](\v)} |
| 205 |
\foreach \v in {0.6,0.8,1}{% |
| 206 |
\tkzDrawTangentLine[color=blue,line width=.4pt,kr=0,kl=.75](\v)} |
| 207 |
\end{tikzpicture} |
| 208 |
\end{tkzexample} |
| 209 |
|
| 210 |
|
| 211 |
\newpage |
| 212 |
\subsection{Calcul de l'antécédent} |
| 213 |
|
| 214 |
Un problème surgit si on emploie une expression contenant des parenthèses dans l'argument, ainsi \tkzname{(\{1/exp(1)\})} est correct mais \tkzname{(1/exp(1))} donne une erreur. Il est aussi possible d'évaluer l'antécédent postérieurement comme cela~: |
| 215 |
\subsubsection{Valeur numérique de l'antécédent} |
| 216 |
\begin{tkzltxexample}[] \FPeval\vx{1/exp(1)} |
| 217 |
\end{tkzltxexample} |
| 218 |
|
| 219 |
\subsubsection{Utilisation de la valeur numérique} |
| 220 |
\begin{center} |
| 221 |
\begin{tkzexample}[] |
| 222 |
\begin{tikzpicture}[scale=1] |
| 223 |
\tkzInit[xmax=1,xstep=0.1,ymin=0.5,ymax=1,ystep=0.1] |
| 224 |
\tkzGrid \tkzAxeXY |
| 225 |
\tkzFct[domain = 0.00001:1]{(\x**\x)} |
| 226 |
\tkzDrawTangentLine[draw,color = red, kr = 0.2,kl = 0.2]({1/exp(1)}) |
| 227 |
\end{tikzpicture} |
| 228 |
\end{tkzexample} |
| 229 |
\end{center} |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
\endinput |
| 234 |
|