summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-fct/doc/latex/TKZdoc-fct-area.tex
blob: c87045bbec67740f882e7236c9551565676a6db4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
%!TEX root = /Users/ego/Boulot/TKZ/tkz-fct/doc-fr/TKZdoc-fct-main.tex  
\section{Macros pour définir  des surfaces  }

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 
 d'équation $x=a$ et $x=b$.

\subsection{Représentation d'une surface \tkzcname{tkzDrawArea} ou \tkzcname{tkzArea}}  \hypertarget{tda}{} 

\begin{NewMacroBox}{tkzDrawArea}{\oarg{local options}} 
Les options sont celles de \TIKZ.

\begin{tabular}{lll}
\toprule
options             & défaut & définition                         \\ 
\midrule
\TOline{domain}{-5:5}{domaine de la fonction} 
\TOline{with}{a}{référence de la fonction}
\TOline{color}{200}{nombre de points utilisés}
\TOline{opacity} {no defaut}{trnsparence}
\TOline{style}{black}{couleur de la ligne}
\end{tabular}
\end{NewMacroBox}

\subsection{Naissance de la fonction logarithme népérien}

\begin{tkzexample}[]
\begin{tikzpicture}[scale=2]
 \tkzInit[xmin=0,xmax=3,xstep=1,
          ymin=-2,ymax=2,ystep=1]
 \tkzGrid
 \tkzAxeXY
 \tkzFct[domain= 0.4:3]{1./x}
 \tkzDefPointByFct(1)
 \tkzGetPoint{A}
 \tkzDefPointByFct(2)
 \tkzGetPoint{B}
 \tkzLabelPoints[above right](A,B)
 \tkzDrawArea[color=blue!30,
              domain = 1:2]
 \tkzFct[domain = 0.5:3]{log(x)}
 \tkzDrawArea[color=red!30,
              domain = 1:2]
 \tkzPointShowCoord(A)
 \tkzPointShowCoord(B) 
 \tkzDrawPoints(A,B)  
\end{tikzpicture} 
\end{tkzexample}

\subsection{Surface simple}
\begin{tkzexample}[]
  \begin{tikzpicture}[scale=1.75]
   \tkzInit[xmin=0,xmax=800,xstep=100,
            ymin=0,ymax=2000,ystep=400]
   \tkzGrid
   \tkzAxeXY
   \tkzFct[domain = 0:800]{(1./90000)*\x*\x*\x-(1./100)*\x*\x+(113./36)*\x}
   \tkzDefPoint(450,400){a}
   \tkzDrawPoint(a)
   \tkzDrawArea[color=orange!50, domain =0:450]
   \tkzDrawArea[color=orange!80, domain =450:800]
  \end{tikzpicture}
\end{tkzexample}

%<--------------------------------------------------------------------------->

\newpage
\subsection{Surface et hachures}
\begin{tkzexample}[]
\begin{tikzpicture}[scale=2]
  \tkzInit[xmin=-3,xmax=4,ymin=-2,ymax=4]
  \tkzGrid(-3,-2)(4,4)
  \tkzDrawXY 
  \tkzFct[domain = -2.15:3.2]{(2+\x)*exp(-\x)}
  \tkzDrawArea[pattern=north west lines,domain =-2:2]   
  \tkzDrawTangentLine[draw,color=blue](0)
  \tkzDrawTangentLine[draw,color=blue](-1)
  \tkzDefPointByFct(2)  \tkzGetPoint{C}  
  \tkzDefPoint(2,0){B}
  \tkzDrawPoints(B,C)  \tkzLabelPoints[above right](B,C)
  \tkzRep
\end{tikzpicture}
\end{tkzexample}
   %<--------------------------------------------------------------------------->

\newpage
\subsection{Surface comprise entre  deux courbes \tkzcname{tkzDrawAreafg}} 

\hypertarget{tdafg}{} 
\begin{NewMacroBox}{tkzDrawAreafg}{\oarg{local options}} 
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). 

\medskip
\begin{tabular}{lll}
 \toprule
 options             & défaut & explication    \\ 
\midrule 
\TOline{between} {a and b}{référence des deux courbes} 
\TOline{domain= min:max}{domain=-5:5}{Les options sont celles de \TIKZ.} 
\TOline{opacity} {0.5}{transparence}
\bottomrule
\end{tabular}

\emph{L'option \tkzname{pattern} de \TIKZ\ peut être utile !  }
\end{NewMacroBox}
%<--------------------------------------------------------------------------->

\subsection{Surface comprise entre deux courbes en couleur}
Par défaut, la surface définie est comprise entre les deux premières courbes.

\begin{tkzexample}[vbox]
 \begin{tikzpicture}[scale=1.5]
   \tkzInit[xmax=5,ymax=5]
   \tkzGrid  \tkzAxeXY
   \tkzFct[domain = 0:5]{x}
   \tkzFct[domain = 1:5]{log(x)} 
   \tkzDrawAreafg[color  = orange!50,domain = 1:5]
 \end{tikzpicture}
\end{tkzexample}

%<--------------------------------------------------------------------------->
\newpage
\subsection{Surface comprise entre deux courbes avec des hachures}

\begin{tkzltxexample}[]
\tkzDrawAreafg[between= a and b,pattern=north west lines,domain = 1:5]
\end{tkzltxexample}

\begin{center}
  \begin{tkzexample}[vbox]
  \begin{tikzpicture}[scale=.8]
    \tkzInit[xmax=5,ymax=5]
    \tkzGrid
    \tkzAxeXY
    \tkzFct[domain = 0:5]{x}
    \tkzFct[domain = 1:5]{log(x)}
    \tkzDrawAreafg[between= a and b,pattern=north west lines,domain = 1:5]
  \end{tikzpicture}
  \end{tkzexample} 
\end{center}

%<--------------------------------------------------------------------------->
\subsection{Surface comprise entre deux courbes avec l'option \tkzname{between}}
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. 

\begin{tkzexample}[latex=7cm]
\begin{tikzpicture}[scale=1.25]
 \tkzInit[ymin=-1,xmax=5,ymax=3]
 \tkzGrid
 \tkzAxeXY  
 \tkzFct[domain = 0.5:5]{1/x}% courbe a 
 \tkzFct[domain = 1:5]{log(x)}% courbe b
 \tkzDrawAreafg[between=b and a,
            color=magenta!50,
            domain = 1:4]
\end{tikzpicture}
\end{tkzexample}

%<--------------------------------------------------------------------------->
\newpage
\subsection{Surface comprise entre deux courbes : courbes de Lorentz}
Ici aussi, attention à l'ordre des références dans l'option \tkzname{between}.

\begin{tkzexample}[vbox]
\begin{tikzpicture}[scale=1.25]
  \tkzInit[xmax=1,ymax=1,xstep=0.1,ystep=0.1]
  \tkzGrid
  \tkzAxeXY   
  \tkzFct[color   = red,domain = 0:1]{(exp(\x)-1)/(exp(1)-1)}
  \tkzFct[color   = blue,domain = 0:1]{\x*\x*\x}
  \tkzFct[color  = green,domain = 0:1]{\x}
  \tkzDrawAreafg[between = c and b,color=purple!40,domain = 0:1]
  \tkzDrawAreafg[between = c and a,color=gray!60,domain = 0:1]
\end{tikzpicture}  
\end{tkzexample} 

%<--------------------------------------------------------------------------->
\subsection{Mélange de style}

\begin{tkzexample}[]
\begin{tikzpicture}[scale=2.5]
   \tkzInit[xmin=-1,xmax=4,ymin=0,ymax=5]
   \tkzGrid
   \tkzAxeXY
   \tkzFct[domain = -.5:4]{ 4*x-x**2+4/(x**2+1)**2}
   \tkzFct[domain = -.5:4]{x-1+4/(x**2+1)**2}
   \tkzDrawAreafg[color=green,domain = 1:4]
   \tkzDrawAreafg[pattern=north west lines,domain = -.5:1]
   \tkzRep
   \tkzText(2.5,4.5){$C_f$}
   \tkzText(2.5,1){$C_g$}
\end{tikzpicture}%
\end{tkzexample}

\newpage  %<--------------------------------------------------------------------------->
\subsection{Courbes de niveaux}
Le code est intéressant pour la définition des fonctions constantes  aux lignes 10 et 11. 

\begin{tkzexample}[num]
\begin{tikzpicture}[scale=.75]
 \tkzInit[xmax=20,ymax=12]
 \tkzGrid[color=orange,sub](0,0)(20,12)
 \tkzAxeXY
 \tkzFct[samples=400,domain =0:8]{(32-4*x)**(0.5)}   % a
 \tkzFct[samples=400,domain =0:18]{(72-4*x)**(0.5)}  % b
 \tkzFct[samples=400,domain =0:20]{(112-4*x)**(0.5)} % c
 \tkzFct[samples=400,domain =2:20]{(152-4*x)**(0.5)} % d
 \tkzFct[samples=400,domain =12:20]{(192-4*x)**(0.5)}% e
 \def\tkzFctgnuf{0} % f
 \def\tkzFctgnug{12}% g
 \tkzDrawAreafg[between= b and a,color=gray!80,domain = 0:8]
 \tkzDrawAreafg[between= b and f,color=gray!80,domain = 8:18]
 \tkzDrawAreafg[between= d and c,color=gray!50,domain = 2:20]
 \tkzDrawAreafg[between= g and c,color=gray!50,domain = 0:2]
 \tkzDrawAreafg[between= g and e,color=gray!20,domain =12:20]
\end{tikzpicture}%
\end{tkzexample}

\endinput