| 1 |
\section{Macros pour définir des surfaces } |
| 2 |
|
| 3 |
Il s'agit par exemple de représenter la partie du plan comprise entre la courbe représentative d'une fonction, l'axe des abscisses et les droites |
| 4 |
d'équation $x=a$ et $x=b$. |
| 5 |
|
| 6 |
\subsection{Représentation d'une surface \tkzcname{tkzDrawArea} ou \tkzcname{tkzArea}} \hypertarget{tda}{} |
| 7 |
|
| 8 |
\begin{NewMacroBox}{tkzDrawArea}{\oarg{local options}} |
| 9 |
Les options sont celles de \TIKZ. |
| 10 |
|
| 11 |
\begin{tabular}{lll} |
| 12 |
\toprule |
| 13 |
options & défaut & définition \\ |
| 14 |
\midrule |
| 15 |
\TOline{domain}{-5:5}{domaine de la fonction} |
| 16 |
\TOline{with}{a}{référence de la fonction} |
| 17 |
\TOline{color}{200}{nombre de points utilisés} |
| 18 |
\TOline{opacity} {no defaut}{trnsparence} |
| 19 |
\TOline{style}{black}{couleur de la ligne} |
| 20 |
\end{tabular} |
| 21 |
\end{NewMacroBox} |
| 22 |
|
| 23 |
\subsection{Naissance de la fonction logarithme népérien} |
| 24 |
|
| 25 |
\begin{tkzexample}[] |
| 26 |
\begin{tikzpicture}[scale=2] |
| 27 |
\tkzInit[xmin=0,xmax=3,xstep=1, |
| 28 |
ymin=-2,ymax=2,ystep=1] |
| 29 |
\tkzGrid |
| 30 |
\tkzAxeXY |
| 31 |
\tkzFct[domain= 0.4:3]{1./x} |
| 32 |
\tkzDefPointByFct(1) |
| 33 |
\tkzGetPoint{A} |
| 34 |
\tkzDefPointByFct(2) |
| 35 |
\tkzGetPoint{B} |
| 36 |
\tkzLabelPoints[above right](A,B) |
| 37 |
\tkzDrawArea[color=blue!30, |
| 38 |
domain = 1:2] |
| 39 |
\tkzFct[domain = 0.5:3]{log(x)} |
| 40 |
\tkzDrawArea[color=red!30, |
| 41 |
domain = 1:2] |
| 42 |
\tkzPointShowCoord(A) |
| 43 |
\tkzPointShowCoord(B) |
| 44 |
\tkzDrawPoints(A,B) |
| 45 |
\end{tikzpicture} |
| 46 |
\end{tkzexample} |
| 47 |
|
| 48 |
\subsection{Surface simple} |
| 49 |
\begin{tkzexample}[] |
| 50 |
\begin{tikzpicture}[scale=1.75] |
| 51 |
\tkzInit[xmin=0,xmax=800,xstep=100, |
| 52 |
ymin=0,ymax=2000,ystep=400] |
| 53 |
\tkzGrid |
| 54 |
\tkzAxeXY |
| 55 |
\tkzFct[domain = 0:800]{(1./90000)*\x*\x*\x-(1./100)*\x*\x+(113./36)*\x} |
| 56 |
\tkzDefPoint(450,400){a} |
| 57 |
\tkzDrawPoint(a) |
| 58 |
\tkzDrawArea[color=orange!50, domain =0:450] |
| 59 |
\tkzDrawArea[color=orange!80, domain =450:800] |
| 60 |
\end{tikzpicture} |
| 61 |
\end{tkzexample} |
| 62 |
|
| 63 |
%<---------------------------------------------------------------------------> |
| 64 |
|
| 65 |
\newpage |
| 66 |
\subsection{Surface et hachures} |
| 67 |
\begin{tkzexample}[] |
| 68 |
\begin{tikzpicture}[scale=2] |
| 69 |
\tkzInit[xmin=-3,xmax=4,ymin=-2,ymax=4] |
| 70 |
\tkzGrid(-3,-2)(4,4) |
| 71 |
\tkzDrawXY |
| 72 |
\tkzFct[domain = -2.15:3.2]{(2+\x)*exp(-\x)} |
| 73 |
\tkzDrawArea[pattern=north west lines,domain =-2:2] |
| 74 |
\tkzDrawTangentLine[draw,color=blue](0) |
| 75 |
\tkzDrawTangentLine[draw,color=blue](-1) |
| 76 |
\tkzDefPointByFct(2) \tkzGetPoint{C} |
| 77 |
\tkzDefPoint(2,0){B} |
| 78 |
\tkzDrawPoints(B,C) \tkzLabelPoints[above right](B,C) |
| 79 |
\tkzRep |
| 80 |
\end{tikzpicture} |
| 81 |
\end{tkzexample} |
| 82 |
%<---------------------------------------------------------------------------> |
| 83 |
|
| 84 |
\newpage |
| 85 |
\subsection{Surface comprise entre deux courbes \tkzcname{tkzDrawAreafg}} |
| 86 |
|
| 87 |
\hypertarget{tdafg}{} |
| 88 |
\begin{NewMacroBox}{tkzDrawAreafg}{\oarg{local options}} |
| 89 |
Cette macro permet de mettre en évidence une surface délimitée par les courbes représentatives de deux fonctions. La courbe (a) doit être au-dessus de la courbe (b). |
| 90 |
|
| 91 |
\medskip |
| 92 |
\begin{tabular}{lll} |
| 93 |
\toprule |
| 94 |
options & défaut & explication \\ |
| 95 |
\midrule |
| 96 |
\TOline{between} {a and b}{référence des deux courbes} |
| 97 |
\TOline{domain= min:max}{domain=-5:5}{Les options sont celles de \TIKZ.} |
| 98 |
\TOline{opacity} {0.5}{transparence} |
| 99 |
\bottomrule |
| 100 |
\end{tabular} |
| 101 |
|
| 102 |
\emph{L'option \tkzname{pattern} de \TIKZ\ peut être utile ! } |
| 103 |
\end{NewMacroBox} |
| 104 |
%<---------------------------------------------------------------------------> |
| 105 |
|
| 106 |
\subsection{Surface comprise entre deux courbes en couleur} |
| 107 |
Par défaut, la surface définie est comprise entre les deux premières courbes. |
| 108 |
|
| 109 |
\begin{tkzexample}[vbox] |
| 110 |
\begin{tikzpicture}[scale=1.5] |
| 111 |
\tkzInit[xmax=5,ymax=5] |
| 112 |
\tkzGrid \tkzAxeXY |
| 113 |
\tkzFct[domain = 0:5]{x} |
| 114 |
\tkzFct[domain = 1:5]{log(x)} |
| 115 |
\tkzDrawAreafg[color = orange!50,domain = 1:5] |
| 116 |
\end{tikzpicture} |
| 117 |
\end{tkzexample} |
| 118 |
|
| 119 |
%<---------------------------------------------------------------------------> |
| 120 |
\newpage |
| 121 |
\subsection{Surface comprise entre deux courbes avec des hachures} |
| 122 |
|
| 123 |
\begin{tkzltxexample}[] |
| 124 |
\tkzDrawAreafg[between= a and b,pattern=north west lines,domain = 1:5] |
| 125 |
\end{tkzltxexample} |
| 126 |
|
| 127 |
\begin{center} |
| 128 |
\begin{tkzexample}[vbox] |
| 129 |
\begin{tikzpicture}[scale=.8] |
| 130 |
\tkzInit[xmax=5,ymax=5] |
| 131 |
\tkzGrid |
| 132 |
\tkzAxeXY |
| 133 |
\tkzFct[domain = 0:5]{x} |
| 134 |
\tkzFct[domain = 1:5]{log(x)} |
| 135 |
\tkzDrawAreafg[between= a and b,pattern=north west lines,domain = 1:5] |
| 136 |
\end{tikzpicture} |
| 137 |
\end{tkzexample} |
| 138 |
\end{center} |
| 139 |
|
| 140 |
%<---------------------------------------------------------------------------> |
| 141 |
\subsection{Surface comprise entre deux courbes avec l'option \tkzname{between}} |
| 142 |
Attention à l'ordre des références dans l'option \tkzname{between}. Seule la partie de la surface (b) est au-dessus de (a) est représentée. |
| 143 |
|
| 144 |
\begin{tkzexample}[latex=7cm] |
| 145 |
\begin{tikzpicture}[scale=1.25] |
| 146 |
\tkzInit[ymin=-1,xmax=5,ymax=3] |
| 147 |
\tkzGrid |
| 148 |
\tkzAxeXY |
| 149 |
\tkzFct[domain = 0.5:5]{1/x}% courbe a |
| 150 |
\tkzFct[domain = 1:5]{log(x)}% courbe b |
| 151 |
\tkzDrawAreafg[between=b and a, |
| 152 |
color=magenta!50, |
| 153 |
domain = 1:4] |
| 154 |
\end{tikzpicture} |
| 155 |
\end{tkzexample} |
| 156 |
|
| 157 |
%<---------------------------------------------------------------------------> |
| 158 |
\newpage |
| 159 |
\subsection{Surface comprise entre deux courbes : courbes de Lorentz} |
| 160 |
Ici aussi, attention à l'ordre des références dans l'option \tkzname{between}. |
| 161 |
|
| 162 |
\begin{tkzexample}[vbox] |
| 163 |
\begin{tikzpicture}[scale=1.25] |
| 164 |
\tkzInit[xmax=1,ymax=1,xstep=0.1,ystep=0.1] |
| 165 |
\tkzGrid |
| 166 |
\tkzAxeXY |
| 167 |
\tkzFct[color = red,domain = 0:1]{(exp(\x)-1)/(exp(1)-1)} |
| 168 |
\tkzFct[color = blue,domain = 0:1]{\x*\x*\x} |
| 169 |
\tkzFct[color = green,domain = 0:1]{\x} |
| 170 |
\tkzDrawAreafg[between = c and b,color=purple!40,domain = 0:1] |
| 171 |
\tkzDrawAreafg[between = c and a,color=gray!60,domain = 0:1] |
| 172 |
\end{tikzpicture} |
| 173 |
\end{tkzexample} |
| 174 |
|
| 175 |
%<---------------------------------------------------------------------------> |
| 176 |
\subsection{Mélange de style} |
| 177 |
|
| 178 |
\begin{tkzexample}[] |
| 179 |
\begin{tikzpicture}[scale=2.5] |
| 180 |
\tkzInit[xmin=-1,xmax=4,ymin=0,ymax=5] |
| 181 |
\tkzGrid |
| 182 |
\tkzAxeXY |
| 183 |
\tkzFct[domain = -.5:4]{ 4*x-x**2+4/(x**2+1)**2} |
| 184 |
\tkzFct[domain = -.5:4]{x-1+4/(x**2+1)**2} |
| 185 |
\tkzDrawAreafg[color=green,domain = 1:4] |
| 186 |
\tkzDrawAreafg[pattern=north west lines,domain = -.5:1] |
| 187 |
\tkzRep |
| 188 |
\tkzText(2.5,4.5){$C_f$} |
| 189 |
\tkzText(2.5,1){$C_g$} |
| 190 |
\end{tikzpicture}% |
| 191 |
\end{tkzexample} |
| 192 |
|
| 193 |
\newpage %<---------------------------------------------------------------------------> |
| 194 |
\subsection{Courbes de niveaux} |
| 195 |
Le code est intéressant pour la définition des fonctions constantes aux lignes 10 et 11. |
| 196 |
|
| 197 |
\begin{tkzexample}[num] |
| 198 |
\begin{tikzpicture}[scale=.75] |
| 199 |
\tkzInit[xmax=20,ymax=12] |
| 200 |
\tkzGrid[color=orange,sub](0,0)(20,12) |
| 201 |
\tkzAxeXY |
| 202 |
\tkzFct[samples=400,domain =0:8]{(32-4*x)**(0.5)} % a |
| 203 |
\tkzFct[samples=400,domain =0:18]{(72-4*x)**(0.5)} % b |
| 204 |
\tkzFct[samples=400,domain =0:20]{(112-4*x)**(0.5)} % c |
| 205 |
\tkzFct[samples=400,domain =2:20]{(152-4*x)**(0.5)} % d |
| 206 |
\tkzFct[samples=400,domain =12:20]{(192-4*x)**(0.5)}% e |
| 207 |
\def\tkzFctgnuf{0} % f |
| 208 |
\def\tkzFctgnug{12}% g |
| 209 |
\tkzDrawAreafg[between= b and a,color=gray!80,domain = 0:8] |
| 210 |
\tkzDrawAreafg[between= b and f,color=gray!80,domain = 8:18] |
| 211 |
\tkzDrawAreafg[between= d and c,color=gray!50,domain = 2:20] |
| 212 |
\tkzDrawAreafg[between= g and c,color=gray!50,domain = 0:2] |
| 213 |
\tkzDrawAreafg[between= g and e,color=gray!20,domain =12:20] |
| 214 |
\end{tikzpicture}% |
| 215 |
\end{tkzexample} |
| 216 |
|
| 217 |
\endinput |