Debian Codegraph @

texmf-dist/doc/latex/tkz-grapheur/tkz-grapheur-doc-en.tex

raw
1 % !TeX TXS-program:compile = txs:///arara
2 % arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode}
3 % arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode}
4 % arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)')
5
6 \documentclass[11pt,a4paper]{ltxdoc}
7 \usepackage[T1]{fontenc}
8 \usepackage[utf8]{inputenc}
9 \usepackage[english]{tkz-grapheur}
10 \pgfplotsset{compat=newest}
11 \usepackage{amsmath}
12 \usepackage{fancyvrb}
13 \usepackage{fancyhdr}
14 \usepackage{hyperref}
15 \usepackage{nicefrac}
16 \usepackage{fontawesome5}
17 \usepackage{tcolorbox}
18 \usepackage{minted2}
19 \tcbuselibrary{skins,minted}
20 \fancyhf{}
21 \renewcommand{\headrulewidth}{0pt}
22 \lfoot{\sffamily\small [tkz-grapheur]}
23 \rfoot{\sffamily\small - \thepage{} -}
24 \usepackage{hologo}
25 \providecommand\tikzlogo{Ti\textit{k}Z}
26 \providecommand\TeXLive{\TeX{}Live\xspace}
27 \providecommand\PSTricks{\textsf{PSTricks}\xspace}
28 \let\pstricks\PSTricks
29 \let\TikZ\tikzlogo
30
31 \urlstyle{same}
32 \hypersetup{pdfborder=0 0 0}
33 \usepackage[margin=2cm]{geometry}
34 \setlength{\parindent}{0pt}
35 \def\TPversion{\tkzgrapheurversion}
36 \def\TPdate{\tkzgrapheurdateversion}
37 \usepackage{soul}
38 \usepackage{codehigh}
39 \usepackage{tabularray}
40 \usepackage{alphalph}
41 \sethlcolor{lightgray!25}
42 \NewDocumentCommand\MontreCode{ m }{%
43 \hl{\vphantom{\texttt{pf}}\texttt{#1}}%
44 }
45 \usepackage[english]{babel}
46
47 \renewcommand{\footnoterule}{\vfill\kern -3pt \hrule width 0.4\columnwidth \kern 2.6pt}
48
49 \begin{document}
50
51 \pagestyle{fancy}
52
53 \thispagestyle{empty}
54
55 \begin{center}
56 \begin{minipage}{0.88\linewidth}
57 \begin{tcolorbox}[colframe=yellow,colback=yellow!15]
58 \begin{center}
59 \begin{tabular}{c}
60 {\Huge \texttt{tkz-grapheur [en]}}\\
61 \\
62 {\LARGE A grapher, based}\\
63 \\
64 {\LARGE on \textsf{\TikZ} and \textsf{xint}.}\\
65 \\
66 {\small \texttt{Version \TPversion{} -- \TPdate}}
67 \end{tabular}
68 \end{center}
69 \end{tcolorbox}
70 \end{minipage}
71 \end{center}
72
73 \begin{center}
74 \begin{tabular}{c}
75 \texttt{Cédric Pierquet}\\
76 {\ttfamily c pierquet -- at -- outlook . fr}\\
77 \texttt{\url{https://github.com/cpierquet/latex-packages/tree/main/tkz-grapheur}} \\
78 \end{tabular}
79 \end{center}
80
81 \hrule
82
83 \vfill
84
85 \begin{tcolorbox}[colframe=lightgray,colback=lightgray!5,halign=center]
86 \begin{GraphTikz}[x=0.85cm,y=0.35cm,Xmin=0,Xmax=10,Ymin=0,Ymax=16]
87 %préparation de la fenêtre
88 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{0,1,...,10}{0,2,...,16}
89 %déf des fonctions avec nom courbe + nom fonction + expression
90 \DefineCurve[Name=cf]<f>{3*x-6}
91 \DefineCurve[Name=cg]<g>{-(x-6)^2+12}
92 %antécédents et intersection
93 \FindIntersections[Disp=false,Name=K]{cf}{cg}
94 \FindCounterimage[DispLine,Color=orange,Name=I]{cg}{8}
95 \FindCounterimage[Disp=false,Name=J]{cg}{0}
96 %intégrale sous une courbe, avec intersection
97 \DrawIntegral%
98 [Colors=blue/purple,Bounds=nodes,Style=hatch,Hatch=bricks]%
99 {g(x)}%
100 {(I-2)}{(J-2)}
101 %intégrale entre les deux courbes
102 \DrawIntegral[Bounds=nodes,Type=fct/fct]{f(x)}[g(x)]{(K-1)}{(K-2)}
103 %tracé des courbes et des points
104 \DrawCurve[Color=red]{f(x)}
105 \DrawCurve[Color=teal]{g(x)}
106 \MarkPts<\small>{(K-1)/below right/L,(K-2)/above left/M}%
107 \MarkPts[violet]<\small>{(I-1)/above left/D,(I-2)/above right/E}%
108 %essai de tangente
109 \DrawTangent[Colors=pink!75!black/yellow,OffsetL=2,OffsetR=2,DispPt]{g}{5}
110 %essai d'image
111 \DrawRanges[Colors=cyan]{g}{7,7.25,7.5}
112 %surimpression des axes
113 \DrawAxisGrids[Grads=false,Grid=false,Enlarge=2.5mm]{0,1,...,10}{0,2,...,16}
114 \end{GraphTikz}
115 \end{tcolorbox}
116
117 \vspace*{5mm}
118
119 \begin{tcolorbox}[colframe=lightgray,colback=lightgray!5,halign=center]
120 \begin{GraphTikz}%
121 [x=3.5cm,y=4cm,
122 Xmin=0,Xmax=3.5,Xgrid=pi/12,Xgrids=pi/24,
123 Ymin=-1.05,Ymax=1.05,Ygrid=0.2,Ygrids=0.05]
124 %préparation de la fenêtre
125 \DrawAxisGrids[Grads=false,Enlarge=2.5mm,Format=ntrig/nsqrt]%
126 {pi/6,pi/4,pi/3,pi/2,2*pi/3,3*pi/4,5*pi/6,pi}
127 {0,sqrt(2)/2,1/2,sqrt(3)/2,1,-1,-sqrt(3)/2,-1/2,-sqrt(2)/2}
128 %rajouter des valeurs
129 \AddXvalues{0.25,1.4,3.3}{0.25,1.4,3.3}
130 %fonction trigo (déf + tracé)
131 \DefineCurve[Name=ccos,Start=0,End=pi]<fcos>{cos(x)}
132 \DefineCurve[Name=csin,Start=0,End=pi]<fsin>{sin(x)}
133 %intégrale
134 \FindIntersections[Disp=false,Name=JKL]{ccos}{csin}
135 %\DefinirPts{FIN/pi/0}
136 \DrawIntegral%
137 [Bounds=node/abs,Type=fct/fct,Colors=cyan/cyan!50]%
138 {fsin(x)}[fcos(x)]%
139 {(JKL-1)}{pi}
140 %tracé des courbes
141 \DrawCurve[Color=red,Start=0,End=pi]{fcos(x)}
142 \DrawCurve[Color=olive,Start=0,End=pi]{fsin(x)}
143 %antécédent(s)
144 \DrawCounterimage[Color=blue/teal!50!black,Lines]{ccos}{-0.25}
145 \DrawCounterimage[Colors=red/magenta!50!black,Lines]{csin}{0.5}
146 \DrawCounterimage[Colors=orange/orange!50!black,Lines]{csin}{sqrt(2)/2}
147 \DrawCounterimage[Colors=green!50!black/green,Lines]{csin}{sqrt(3)/2}
148 %surimpression axes
149 \DrawAxisGrids[Grid=false,Enlarge=2.5mm,Format=ntrig/nsqrt]%
150 {pi/6,pi/4,pi/3,pi/2,2*pi/3,3*pi/4,5*pi/6,pi}
151 {0,sqrt(2)/2,1/2,sqrt(3)/2,1,-1,-sqrt(3)/2,-1/2,-sqrt(2)/2}
152 \end{GraphTikz}
153 \end{tcolorbox}
154
155 \vfill
156
157 \hfill{\footnotesize\textit{\ttfamily To my Dad.}}
158
159 \vspace*{5mm}
160
161 \pagebreak
162
163 \phantomsection
164
165 \hypertarget{matoc}{}
166
167 \tableofcontents
168
169 \vspace*{5mm}
170
171 \hrule
172
173 \vspace*{5mm}
174
175 \pagebreak
176
177 \section{Introduction}
178
179 \subsection{Description and general ideas}
180
181 With this modest package, far from the capabilities offered by the excellent packages \MontreCode{tkz-*}\footnote{for example tkz-base \url{https://ctan.org/pkg/tkz-base} and tkz- fct \url{https://ctan.org/pkg/tkz-fct}.} (by Alain Matthes) or \MontreCode{tzplot}\footnote{CTAN: \url{https://ctan.org/pkg/ tzplot}.} (by In-Sung Cho), it is possible to work on function graphs, in \TikZ\ language, in an \textit{intuitive} and \textit{explicit} way.
182
183 \smallskip
184
185 Concerning the overall operation:
186
187 \smallskip
188
189 \begin{itemize}
190 \item particular styles for the objects used have been defined, but they can be modified locally;
191 \item the name of the commands is in \textit{operational} form, so that the construction of the graphic elements has an almost \textit{algorithmic} form.
192 \end{itemize}
193
194 \subsection{Overall operation}
195
196 To schematize, it \textit{is enough}:
197
198 \smallskip
199
200 \begin{itemize}
201 \item to declare the parameters of the graphics window (\textbf{units in cm !});
202 \item to display grid/axes/graduations;
203 \item to declare functions or interpolation curves;
204 \item to possibly declare particular points;
205 \item to place a point scatter.
206 \end{itemize}
207
208 \smallskip
209
210 It will then be possible:
211
212 \begin{itemize}
213 \item to draw curves;
214 \item to graphically determine images or backgrounds;
215 \item to add elements of derivation (tangents) or integration (domain);
216 \item to draw a linear fit line or the curve of another fit.
217 \end{itemize}
218
219 \subsection{Packages used, and package options}
220
221 The package uses:
222
223 \smallskip
224
225 \begin{itemize}
226 \item \MontreCode{tikz}, with the libraries \MontreCode{calc,intersections,patterns,patterns.meta,bbox};
227 \item \MontreCode{simplekv}, \MontreCode{xintexpr}, \MontreCode{xstring}, \MontreCode{listofitems};
228 \item \MontreCode{xint-regression}\footnote{CTAN: \url{https://ctan.org/pkg/xint-regression}.} (for regressions, switchable via \MontreCode{[noxintreg]}).
229 \end{itemize}
230
231 \smallskip
232
233 The package also loads \MontreCode{siunitx} with the classic options, but it is possible not to load it using the \MontreCode{[nosiunitx]} option.
234
235 \smallskip
236
237 The package also loads the \TikZ\ \MontreCode{babel} library, but it is possible not to load it using the \MontreCode{[notikzbabel]} option.
238
239 \smallskip
240
241 The different options are obviously cumulative.
242
243 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
244 %loading by default, with french setup of siunitx
245 \usepackage{tkz-grapheur}
246 %loading by default, with normal setup of siunitx
247 \usepackage[english]{tkz-grapheur}
248
249 %loading without sinuitx, to be loaded manually
250 \usepackage[nosiunitx]{tkz-grapheur}
251
252 %loading without tikz.babel
253 \usepackage[notikzbabel]{tkz-grapheur}
254 \end{tcblisting}
255
256 Also note that certain commands can use packages like \MontreCode{nicefrac}, which will therefore have to be loaded if necessary.
257
258 \smallskip
259
260 Concerning the \textit{calculations} and \textit{plots} part, the \MontreCode{xint} package takes care of it.
261
262 \subsection{Warnings}
263
264 It is possible, due to the (multiple) calculations carried out internally, that the compilation time may be a little \textit{long}.
265
266 \smallskip
267
268 The precision of the (determination) results seems to be around $10^{-4}$, which should normally guarantee \textit{satisfactory} plots and readings. It is still advisable to be cautious about the results obtained and those expected.
269
270 \subsection{Introductory example}
271
272 For example, we can start from the following example to \textit{illustrate} the flow of the commands for this package. The commands and syntax will be detailed in the following sections!
273
274 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
275 \begin{GraphTikz}%
276 [x=7.5cm,y=7.5cm,Xmin=0,Xmax=1.001,Xgrid=0.1,Xgrids=0.02,
277 Ymin=0,Ymax=1.001,Ygrid=0.1,Ygrids=0.02]
278 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]%
279 {0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1}
280 {0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1}
281 \DefineCurve[Name=cf,Start=0,End=1]<f>{x*exp(x-1)}
282 \DefineCurve[Name=delta,Start=0,End=1]<D>{x}
283 \DrawIntegral[Type=fct/fct]{f(x)}[D(x)]{0}{1}
284 \DrawCurve[Color=red]{f(x)}
285 \DrawCurve[Color=teal]{D(x)}
286 \DrawRanges[Colors=blue/cyan,Lines]{f}{0.8,0.9}
287 \DrawCounterimage[Colors=green!50!black/olive,Lines]{cf}{0.5}
288 \end{GraphTikz}
289 \end{tcblisting}
290
291 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,text only}
292 \begin{GraphTikz}%
293 [x=7.5cm,y=7.5cm,Xmin=0,Xmax=1.001,Xgrid=0.1,Xgrids=0.02,
294 Ymin=0,Ymax=1.001,Ygrid=0.1,Ygrids=0.02]
295 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]%
296 {0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1}
297 {0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1}
298 \DefineCurve[Name=cf,Start=0,End=1]<f>{x*exp(x-1)}
299 \DefineCurve[Name=delta,Start=0,End=1]<D>{x}
300 \DrawIntegral[Type=fct/fct]{f(x)}[D(x)]{0}{1}
301 \DrawCurve[Color=red]{f(x)}
302 \DrawCurve[Color=teal]{D(x)}
303 \DrawRanges[Colors=blue/cyan,Lines]{f}{0.8,0.9}
304 \DrawCounterimage[Colors=green!50!black/olive,Lines]{cf}{0.5}
305 \end{GraphTikz}
306 \end{tcblisting}
307
308 \newpage
309
310 \section{Basic Styles and Environment Creation}
311
312 \subsection{Basic Styles}
313
314 The styles used for plots are given below.
315
316 \smallskip
317
318 For \textit{simplicity} purposes, only the color of the elements can be configured, but if the user wishes, he can redefine the proposed styles.
319
320 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
321 %parameters declared and stored (usable in the environment a posteriori)
322 \tikzset{
323 Xmin/.store in=\pflxmin,Xmin/.default=-3,Xmin=-3,
324 Xmax/.store in=\pflxmax,Xmax/.default=3,Xmax=3,
325 Ymin/.store in=\pflymin,Ymin/.default=-3,Ymin=-3,
326 Ymax/.store in=\pflymax,Ymax/.default=3,Ymax=3,
327 Origx/.store in=\pflOx,Origx/.default=0,Origx=0,
328 Origy/.store in=\pflOy,Origy/.default=0,Origy=0,
329 Xgrid/.store in=\pflgrillex,Xgrid/.default=1,Xgrid=1,
330 Xgrids/.store in=\pflgrillexs,Xgrids/.default=0.5,Xgrids=0.5,
331 Ygrid/.store in=\pflgrilley,Ygrid/.default=1,Ygrid=1,
332 Ygrids/.store in=\pflgrilleys,Ygrids/.default=0.5,Ygrids=0.5
333 }
334 \end{tcblisting}
335
336 We therefore find:
337
338 \smallskip
339
340 \begin{itemize}
341 \item the origin of the mark (\MontreCode{Origx}/\MontreCode{Origy});
342 \item the extreme values of the axes (\MontreCode{Xmin}/\MontreCode{Xmax}/\MontreCode{Ymin}/\MontreCode{Ymax});
343 \item the parameters of the main and secondary grids (\MontreCode{Xgrid}/\MontreCode{Xgrids}/\MontreCode{Ygrid}/\MontreCode{Ygrids}).
344 \end{itemize}
345
346 \smallskip
347
348 Concerning the styles of \textit{objects}, they are given below.
349
350 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
351 \tikzset{tkzgrphnode/.style={}}
352 \tikzset{tkzgrphpoint/.style={line width=0.95pt}}
353 \tikzset{tkzgrphpointc/.style={radius=1.75pt}}
354 \tikzset{tkzgrphscatter/.style={radius=1.75pt}}
355 \tikzset{tkzgrphframe/.style={line width=0.8pt,gray}}
356 \tikzset{tkzgrphcurve/.style={line width=1.05pt}}
357 \tikzset{tkzgrphline/.style={line width=0.8pt}}
358 \tikzset{tkzgrpharrowl/.style={<-,>=latex}}
359 \tikzset{tkzgrpharrowr/.style={->,>=latex}}
360 \tikzset{tkzgrpharrowlr/.style={<->,>=latex}}
361 \tikzset{tkzgrphcounterimage/.style={line width=0.9pt,densely dashed}}
362 \tikzset{tkzgrphrange/.style={line width=0.9pt,densely dashed,->,>=latex}}
363 \tikzset{tkzgrphgridp/.style={thin,lightgray}}
364 \tikzset{tkzgrphgrids/.style={very thin,lightgray}}
365 \tikzset{tkzgrphaxes/.style={line width=0.8pt,->,>=latex}}
366 \end{tcblisting}
367
368 The idea is therefore to be able to redefine styles globally or locally, and possibly add elements, using \mintinline{latex}|mystyle/.append style={...}|.
369
370 \subsection{Creating the environment}\label{creaenvt}
371
372 \subsubsection{Manual values}
373
374 The proposed environment is based on \TikZ, so that any \textit{classic} command linked to \TikZ\ can be used alongside the package commands!
375
376 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
377 \begin{GraphTikz}[tikz options]<keys>
378 %code(s)
379 \end{GraphTikz}
380 \end{tcblisting}
381
382 The \MontreCode{[tikz options]} are the \textit{classic} options that can be passed to a \TikZ\ environment, as well as the \textsf{axes/grids/window} keys presented previously.
383
384 \smallskip
385
386 The specific (and optional) \MontreCode{<keys>} are:
387
388 \smallskip
389
390 \begin{itemize}
391 \item \MontreCode{ThickGrad}: size of the axis graduations (\MontreCode{3pt} for 3pt \textit{above} and 3pt \textit{below});
392 \item \MontreCode{Frame}: boolean (\MontreCode{false} by default) to display a frame which delimits the graphic window (excluding possible graduations).
393 \end{itemize}
394
395 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
396 \begin{GraphTikz}
397 [x=0.075cm,y=0.03cm,Xmin=0,Xmax=160,Xgrid=20,Xgrids=10,
398 Origy=250,Ymin=250,Ymax=400,Ygrid=25,Ygrids=5]
399 <Frame>
400 \end{GraphTikz}
401 \end{tcblisting}
402
403 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
404 \begin{GraphTikz}%
405 [x=0.9cm,y=0.425cm,Xmin=4,Xmax=20,Origx=4,
406 Ymin=40,Ymax=56,Ygrid=2,Ygrids=1,Origy=40]
407 <Frame>
408 \end{GraphTikz}
409 \end{tcblisting}
410
411 It will obviously be more meaningful with the added graphic elements!
412
413 \subsubsection{With choice of dimensions}
414
415 It is also possible (currently being tested) to specify the dimensions of the graph, letting the code determine the correct units.
416
417 In this case, the keys and arguments differ slightly, notably via the key \MontreCode{<Size=width/height>}:
418
419 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
420 %fixed dimensions (excluding graduations)
421 \begin{GraphTikz}%
422 [Xgrid=10,Xgrids=5,Ygrid=50,Ygrids=25]
423 %Xgrid(s) and/or Ygrid(s) in this case
424 <Xmin=0,Xmax=100,Ymin=0,Ymax=250,Size={10cm/5cm}>
425 \DrawAxisGrids[]{auto}{auto}
426 \end{GraphTikz}
427 \end{tcblisting}
428
429 \pagebreak
430
431 \subsection{Grids and axes}\label{creaaxesgr}
432
433 The first command \textit{useful} will allow you to create the grids, axes and graduations.
434
435 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
436 %in the GraphiqueTikz environment
437 \DrawAxisGrids[keys]{gradX}{gradY}
438 \end{tcblisting}
439
440 The optional \MontreCode{[keys]} available are:
441
442 \smallskip
443
444 \begin{itemize}
445 \item \MontreCode{Grid}: boolean (\MontreCode{true} by default) to display the grids (for a single grid, simply set the identical parameters for \MontreCode{Xgrid}/\MontreCode{Xgrids} or \MontreCode {Ygrid}/\MontreCode{Ygrids});
446 \item \MontreCode{Enlarge}: addition at the end of the axes (\MontreCode{0} by default);
447 \item \MontreCode{Grads}: boolean (\MontreCode{true} by default) for graduations;
448 \item \MontreCode{Font}: global font for graduations {\MontreCode{empty} by default};
449 \item \MontreCode{Format}: special formatting (see below) of the axis values.
450 \end{itemize}
451
452 \smallskip
453
454 Concerning the \MontreCode{Format} key, it allows you to specify a specific setting for the axis values.
455
456 \smallskip
457
458 It can be given in the form \MontreCode{fmt} for combined formatting, or in the form \MontreCode{fmtX/fmtY} to differentiate the formatting.
459
460 \smallskip
461
462 The possible options are:
463
464 \smallskip
465
466 \begin{itemize}
467 \item \MontreCode{num}: format with \textsf{siunitx};
468 \item \MontreCode{year}: format in year;
469 \item \MontreCode{frac}: format as fraction \textsf{frac};
470 \item \MontreCode{dfrac}: format as fraction \textsf{dfrac};
471 \item \MontreCode{nfrac}: format as fraction \textsf{nicefrac};\hfill (to load!)
472 \item \MontreCode{trig}: format in trig with \textsf{frac};
473 \item \MontreCode{dtrig}: format in trig with \textsf{dfrac};
474 \item \MontreCode{ntrig}: format in trig with \textsf{nfrac};
475 \item \MontreCode{sqrt}: format in root with \textsf{frac};
476 \item \MontreCode{dsqrt}: format in root with \textsf{dfrac};
477 \item \MontreCode{nsqrt}: format in root with \textsf{nicefrac}.
478 \end{itemize}
479
480 \smallskip
481
482 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
483 \begin{GraphTikz}
484 [x=0.075cm,y=0.03cm,Xmin=0,Xmax=160,Xgrid=20,Xgrids=10,
485 Origy=250,Ymin=250,Ymax=400,Ygrid=25,Ygrids=5]
486 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{0,10,...,160}{250,275,...,400}
487 \end{GraphTikz}
488 \end{tcblisting}
489
490 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
491 \begin{GraphTikz}%
492 [x=0.9cm,y=0.425cm,Xmin=4,Xmax=20,Origx=4,
493 Ymin=40,Ymax=56,Ygrid=2,Ygrids=1,Origy=40]
494 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{4,5,...,20}{40,42,...,56}
495 \end{GraphTikz}
496 \end{tcblisting}
497
498 Note that there are the Boolean keys \MontreCode{[Behind]} (without the graduations) and \MontreCode{[Above]} (without the grid) to display the axes in \textit{under/over}-printing mode in the case of integrals for example.
499
500 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
501 \begin{GraphTikz}%
502 [x=2.75cm,y=3cm,
503 Xmin=0,Xmax=3.5,Xgrid=pi/12,Xgrids=pi/24,
504 Ymin=-1.05,Ymax=1.05,Ygrid=0.2,Ygrids=0.05]
505 \DrawAxisGrids[Enlarge=2.5mm,Format=dtrig/nsqrt,Font=\footnotesize]%
506 {pi/6,pi/4,pi/3,pi/2,2*pi/3,3*pi/4,5*pi/6,pi}
507 {0,sqrt(2)/2,1/2,sqrt(3)/2,1,-1,-sqrt(3)/2,-1/2,-sqrt(2)/2}
508 \end{GraphTikz}
509 \end{tcblisting}
510
511 In the case where the formatting does not give satisfactory result(s), it is possible to use a generic command for placing the graduations.
512
513 \subsection{Adding values manually}\label{additionvals}
514
515 It is also possible to use a specific command to place values on the axes, independently of an \textit{automated} formatting system.
516
517 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
518 in the environment
519 \AddXvalues[keys]{grads}{formatted values}
520 \AddYvalues[keys]{grads}{formatted values}
521 \end{tcblisting}
522
523 The optional \MontreCode{[keys]} available are:
524
525 \smallskip
526
527 \begin{itemize}
528 \item \MontreCode{Font}: global font for graduations {\MontreCode{empty} by default};
529 \item \MontreCode{Lines}: boolean to add the tick marks {\MontreCode{true} by default}.
530 \end{itemize}
531
532 \smallskip
533
534 The mandatory arguments correspond to the x-coordinates (in \TikZ\ language) and to the labels (in \LaTeX\ language) of the graduations.
535
536 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
537 \begin{GraphTikz}%
538 [x=2.75cm,y=3cm,
539 Xmin=0,Xmax=3.5,Xgrid=pi/12,Xgrids=pi/24,
540 Ymin=-1.05,Ymax=1.05,Ygrid=0.2,Ygrids=0.05]
541 \DrawAxisGrids[Grads=false,Enlarge=2.5mm]{}{}
542 \AddXvalues
543 {0.15,0.6,pi/2,2.8284}
544 {\num{0.15},$\frac35$,$\displaystyle\frac{\pi}{2}$,$\sqrt{8}$}
545 \AddYvalues
546 {-1,0.175,0.3,sqrt(3)/2}
547 {\num{-1},\num{0.175},$\nicefrac{3}{10}$,$\frac{\sqrt{3}}{2}$}
548 \end{GraphTikz}
549 \end{tcblisting}
550
551 \pagebreak
552
553 \subsection{Nodes for window or axis}
554
555 Alongside the creation of the window (and possibly the axes), nodes are created for later reuse (e.g., text placement).
556
557 \begin{itemize}
558 \item 9 \textcolor{red}{nodes} for window:
559 \begin{itemize}
560 \item \MontreCode{(graph-nw)}, \MontreCode{(graph-n)}, \MontreCode{(graph-ne)} ;
561 \item \MontreCode{(graph-w)}, \MontreCode{(graph-c)}, \MontreCode{(graph-e)} ;
562 \item \MontreCode{(graph-sw)}, \MontreCode{(graph-s)}, \MontreCode{(graph-se)} ;
563 \end{itemize}
564 \item 4 \textcolor{blue}{nodes} for axis:
565 \begin{itemize}
566 \item \MontreCode{(xaxis-w)}, \MontreCode{(xaxis-e)} ;
567 \item \MontreCode{(yaxis-s)}, \MontreCode{(yaxis-n)} ;
568 \end{itemize}
569 \item 1 \textcolor{violet}{node} for origin:
570 \begin{itemize}
571 \item \MontreCode{(axis-orig)} ;
572 \end{itemize}
573 \item 2 \textcolor{purple}{nodes} for \textit{enlarge} axis:
574 \begin{itemize}
575 \item \MontreCode{(xaxis-ee)} ;
576 \item \MontreCode{(yaxis-nn)}.
577 \end{itemize}
578 \end{itemize}
579
580 \begin{center}%démo !!
581 \begin{GraphTikz}[Xmin=-7,Xmax=4,Ymin=-3,Ymax=5,Xgrids=0.5,Ygrids=0.5]
582 \tikzset{labellegende/.style={outer sep=2.25pt,inner sep=0.75pt,font=\scriptsize\ttfamily,fill=white}}
583 \DrawAxisGrids[Enlarge=5mm]{}{}
584 %nœuds (v0.30a)
585 \draw[red,fill=yellow] (graph-nw) circle[radius=2pt] node[above left,labellegende] {nw} ;
586 \draw[red,fill=yellow] (graph-n) circle[radius=2pt] node[above,labellegende] {n} ;
587 \draw[red,fill=yellow] (graph-ne) circle[radius=2pt] node[above right,labellegende] {ne} ;
588 \draw[red,fill=yellow] (graph-e) circle[radius=2pt] node[right,labellegende] {e} ;
589 \draw[red,fill=yellow] (graph-se) circle[radius=2pt] node[below right,labellegende] {se} ;
590 \draw[red,fill=yellow] (graph-s) circle[radius=2pt] node[below,labellegende] {s} ;
591 \draw[red,fill=yellow] (graph-sw) circle[radius=2pt] node[below left,labellegende] {sw} ;
592 \draw[red,fill=yellow] (graph-w) circle[radius=2pt] node[left,labellegende] {w} ;
593 \draw[red,fill=yellow] (graph-c) circle[radius=2pt] node[above,labellegende] {c} ;
594 \draw[blue,fill=orange] (xaxis-w) circle[radius=2pt] node[left,labellegende] {w} ;
595 \draw[blue,fill=orange] (xaxis-e) circle[radius=2pt] node[above,labellegende] {e} ;
596 \draw[blue,fill=orange] (yaxis-s) circle[radius=2pt] node[below,labellegende] {w} ;
597 \draw[blue,fill=orange] (yaxis-n) circle[radius=2pt] node[right,labellegende] {n} ;
598 \draw[violet,fill=teal] (axis-orig) circle[radius=2pt] node[above right,labellegende] {orig} ;
599 \draw[purple,fill=gray] (xaxis-ee) circle[radius=2pt] node[right,labellegende] {ee} ;
600 \draw[purple,fill=gray] (yaxis-nn) circle[radius=2pt] node[above,labellegende] {nn} ;
601 \end{GraphTikz}
602 \end{center}
603
604 \pagebreak
605
606 \section{Specific definition commands}
607
608 \subsection{Draw a line}\label{tracstraight}
609
610 The idea is to propose a command to draw a line (or an asymptote), from:
611
612 \begin{itemize}
613 \item of two points (or nodes);
614 \item of a point (or node) and the slope.
615 \end{itemize}
616
617 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
618 %in the GraphiqueTikz environment
619 \DrawLine[keys]{point or node}{point or node or slope}
620 \DrawAsymptote[keys]{x value}
621 \end{tcblisting}
622
623 The optional \MontreCode{[keys]} available are:
624
625 \smallskip
626
627 \begin{itemize}
628 \item \MontreCode{Name}: possible name of the plot (for reuse);
629 \item \MontreCode{Slope}: boolean to specify that the slope is used (\MontreCode{false} by default);
630 \item \MontreCode{Start}: start of the plot (\MontreCode{\textbackslash pflxmin} by default);
631 \item \MontreCode{End}: end of the plot (\MontreCode{\textbackslash pflxmax} by default);
632 \item \MontreCode{Color}: color of the trace (\MontreCode{black} by default).
633 \end{itemize}
634
635 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
636 \begin{GraphTikz}%
637 [x=0.8cm,y=1cm,Xmin=-7,Xmax=4,Ymin=-3,Ymax=5]
638 \DrawAxisGrids[Enlarge=2.5mm]{auto}{auto}
639 \DefinePts[Mark,Color=gray]{A/-4/3,B/2/0,C/0/-1}
640 \DrawLine[Color=red]{(-2,-1)}{(2,4)}
641 \DrawLine[Color=blue,Start=-5,End=3]{(A)}{(B)}
642 \DrawLine[Color=olive,Slope]{(C)}{0.25}
643 \DrawAsymptote[Color=brown]{-6}
644 \end{GraphTikz}
645 \end{tcblisting}
646
647 \pagebreak
648
649 \subsection{Define a function, draw the curve of a function}\label{deftracfct}
650
651 The idea is to define a function, for later reuse. This command \textit{creates} the function, without tracing it, because in certain cases elements will have to be traced beforehand.
652
653 \smallskip
654
655 There is also a command to plot the curve of a previously defined function.
656
657 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
658 %in the GraphiqueTikz environment
659 \DefineCurve[keys]<fct name>{xint formula}
660 \DrawCurve[keys]{xint formula}
661 \end{tcblisting}
662
663 The optional \MontreCode{[keys]} for definition or tracing are:
664
665 \smallskip
666
667 \begin{itemize}
668 \item \MontreCode{Start}: lower bound of the definition set (\MontreCode{\textbackslash pflxmin} by default);
669 \item \MontreCode{End}: lower bound of the definition set (\MontreCode{\textbackslash pflxmax} by default);
670 \item \MontreCode{Name}: name of the curve (important for the rest!);
671 \item \MontreCode{Color}: color of the trace (\MontreCode{black} by default);
672 \item \MontreCode{Step}: plot step (it is determined \textit{automatically} at the start but can be modified);
673 \item \MontreCode{Trace}: boolean to also trace the curve (\MontreCode{false} by default).
674 \end{itemize}
675
676 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
677 \begin{GraphTikz}%
678 [x=0.9cm,y=0.425cm,Xmin=4,Xmax=20,Origx=4,
679 Ymin=40,Ymax=56,Ygrid=2,Ygrids=1,Origy=40]
680 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{4,5,...,20}{40,42,...,56}
681 %definition of the function + drawing of the curve
682 \DefineCurve[Name=cf,Start=5,End=19]<f>{-2*x+3+24*log(2*x)}
683 \DrawCurve[Color=red,Start=5,End=19]{f(x)}
684 %or in a single command if "sufficient"
685 %\DefineCurve[Name=cf,Start=5,End=19,Trace]<f>{-2*x+3+24*log(2*x)}
686 \end{GraphTikz}
687 \end{tcblisting}
688
689 \pagebreak
690
691 \subsection{Define/draw an interpolation curve (simple)}\label{deftracinterpo}
692
693 It is also possible to define a curve via support points, therefore a simple interpolation curve.
694
695 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
696 %in the GraphiqueTikz environment
697 \DefineInterpoCurve[keys]{list of support points}
698 \DrawInterpoCurve[keys]{list of support points}
699 \end{tcblisting}
700
701 The optional \MontreCode{[keys]} for definition or tracing are:
702
703 \smallskip
704
705 \begin{itemize}
706 \item \MontreCode{Name}: name of the interpolation curve (important for the rest!);
707 \item \MontreCode{Color}: color of the trace (\MontreCode{black} by default);
708 \item \MontreCode{Tension}: setting the \textit{tension} of the interpolation plot (\MontreCode{0.5} by default);
709 \item \MontreCode{Trace}: boolean to also trace the curve (\MontreCode{false} by default).
710 \end{itemize}
711
712 The mandatory argument allows you to specify the list of support points in the form \MontreCode{(x1,y1)(x2,y2)...}.
713
714 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
715 \begin{GraphTikz}%
716 [x=0.8cm,y=1cm,Xmin=-7,Xmax=4,Ymin=-3,Ymax=5]
717 \DrawAxisGrids[Enlarge=2.5mm]{-7,-6,...,4}{-3,-2,...,5}
718 %simple interpolation curves (with diff tension)
719 \DefineInterpoCurve[Name=interpotest,Color=blue,Trace]%
720 {(-6,4)(-2,-2)(3,3.5)}
721 \DefineInterpoCurve[Name=interpotest,Color=red,Trace,Tension=1]%
722 {(-6,4)(-2,-2)(3,3.5)}
723 \end{GraphTikz}
724 \end{tcblisting}
725
726 \newpage
727
728 \subsection{Define/draw an interpolation curve (Hermite)}\label{deftracfctspline}
729
730 It is also possible to define a curve via support points, therefore an interpolation curve with derivative control.
731
732 \smallskip
733
734 Some operations require different techniques depending on the type of function used, a \textsf{Boolean} key \MontreCode{Spline} will allow the code to adapt its calculations depending on the object used.
735
736 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
737 %in the GraphiqueTikz environment
738 \DefineSplineCurve[keys]{list of support points}[\macronomspline]
739 \DrawSplineCurve[keys]{list of support points}[\macronomspline]
740 \end{tcblisting}
741
742 The optional \MontreCode{[keys]} for definition or tracing are:
743
744 \smallskip
745
746 \begin{itemize}
747 \item \MontreCode{Name}: name of the interpolation curve (important for the rest!);
748 \item \MontreCode{Coeffs}: modify (see the \textsf{ProfLycee}\footnote{CTAN documentation: \url{https://ctan.org/pkg/proflycee}} the \textit{coefficients} of the spline;
749 \item \MontreCode{Color}: color of the trace (\MontreCode{black} by default);
750 \item \MontreCode{Trace}: boolean to also trace the curve (\MontreCode{false} by default).
751 \end{itemize}
752
753 The mandatory argument allows you to specify the list of support points in the form \MontreCode{x1/y1/f'1§x2/y2/f'2§...} with:
754
755 \begin{itemize}
756 \item \MontreCode{xi/yi} the coordinates of the point;
757 \item \MontreCode{f'i} the derivative at the support point.
758 \end{itemize}
759
760 \smallskip
761
762 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
763 \begin{GraphTikz}%
764 [x=0.8cm,y=1cm,Xmin=-7,Xmax=4,Ymin=-3,Ymax=5]
765 \DrawAxisGrids[Enlarge=2.5mm]{-7,-6,...,4}{-3,-2,...,5}
766 %definition of the list of spline support points
767 \def\LISTETEST{-6/4/-2§-5/2/-2§-4/0/-2§-2/-2/0§1/2/2§3/3.5/0.5}
768 %definition and plot of the cubic spline
769 \DefineSplineCurve[Name=splinetest,Trace,Color=olive]{\LISTETEST}
770 \end{GraphTikz}
771 \end{tcblisting}
772
773 \pagebreak
774
775 \subsection{Define points as nodes}\label{defpts}
776
777 The second idea is to work with \TikZ nodes, which could be useful for tangent plots, representations of integrals$\ldots$
778
779 \smallskip
780
781 It is also possible to define nodes for \textit{image} points.
782
783 \smallskip
784
785 Certain commands (explained later) allow you to determine particular points of curves in the form of nodes, so it seems interesting to be able to define them directly.
786
787 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
788 %by coordinates
789 \DefinePts[keys]{Name1/x1/y1,Name2/x2/y2,...}
790 \end{tcblisting}
791
792 The optional \MontreCode{[keys]} available are:
793
794 \smallskip
795
796 \begin{itemize}
797 \item \MontreCode{Mark}: boolean to mark points (\MontreCode{false} by default);
798 \item \MontreCode{Color}: color of the points, if \MontreCode{Mark=true} (\MontreCode{black} by default).
799 \end{itemize}
800
801 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
802 %as image
803 \DefineRange[keys]{object}{abscissa}
804 \end{tcblisting}
805
806 The optional \MontreCode{[keys]} available are:
807
808 \smallskip
809
810 \begin{itemize}
811 \item \MontreCode{Name}: node name (\MontreCode{empty} by default);
812 \item \MontreCode{Spline}: boolean to specify that a spline is used (\MontreCode{false} by default).
813 \end{itemize}
814
815 The first mandatory argument is the \textit{object} considered (name of the curve for the spline, function otherwise); the second is the abscissa of the point considered.
816
817 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
818 \begin{GraphTikz}%
819 [x=0.9cm,y=0.425cm,Xmin=4,Xmax=20,Origx=4,
820 Ymin=40,Ymax=56,Ygrid=2,Ygrids=1,Origy=40]
821 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{4,5,...,20}{40,42,...,56}
822 %definition of the function + drawing of the curve
823 \DefineFunction[Name=cf,Start=5,End=19,Trace,Color=red]<f>{-2*x+3+24*log(2*x)}
824 %manual nodes
825 \DefinePts[Mark,Color=brown]{A/7/42,B/16/49}
826 %imagenode
827 \DefineRange[Name=IMGf]{f}{14}
828 \MarkPts*[Style=x,Color=blue]{(IMGf)} %see next section;-)
829 \end{GraphTikz}
830 \end{tcblisting}
831
832 \pagebreak
833
834 \subsection{Mark Points}\label{markpts}
835
836 The idea is to offer something to score points with a particular style.
837
838 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
839 %in the GraphiqueTikz environment
840 \MarkPts(*)[keys]<font>{list}
841 \end{tcblisting}
842
843 The \textit{starred} version scores the points without the \textit{names}, while the \textit{unstarred} version displays them:
844
845 \begin{itemize}
846 \item in the case of the \textit{starred} version, the list should be given in the form \MontreCode{(ptA),(ptB),...};
847 \item otherwise, the list should be given in the form \MontreCode{(ptA)/poslabelA/labelA,...}.
848 \end{itemize}
849
850 \smallskip
851
852 The optional \MontreCode{[keys]} available are:
853
854 \smallskip
855
856 \begin{itemize}
857 \item \MontreCode{Color}: color (\MontreCode{black} by default);
858 \item \MontreCode{Style}: style of marks (\MontreCode{o} by default).
859 \end{itemize}
860
861 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
862 \begin{GraphTikz}[x=1.5cm,y=1.5cm,Ymin=-2]
863 \DrawAxisGrids[Enlarge=2.5mm]{auto}{auto}
864 \DefinePts{A/1.75,-1.25}\MarkPts[Color=pink]{(A)/below/A} %round (default)
865 \MarkPts[Color=teal]{(1,1)/below/M}
866 \MarkPts[Color=red,Style=x]{(1.25,1)/below/$A$} %cross
867 \MarkPts[Color=orange,Style=+]<\small\sffamily>{(1.5,1)/below/K} %plus
868 \MarkPts[Color=blue,Style=c]{(1.75,1)/below/P} %square
869 \MarkPts[Color=gray,Style=d]{(2,1)/below/P} %diamond
870 \MarkPts*[Color=orange/yellow]{(2,2),(2.5,2.25)} %two-tone round
871 \MarkPts*[Style=+,Color=red]{(1,2)}
872 \MarkPts*[Style=x,Color=blue]{(2.25,1)}
873 \MarkPts*[Style=c,Color=magenta]{(-2,-1)}
874 \MarkPts[Color=red,Style=x]{(-1,1)/below/$A$,(-2,2)/below left/$B$}
875 \end{GraphTikz}
876 \end{tcblisting}
877
878 Note that it is also possible to modify the size of the \MontreCode{o/x/+/c} marks via the \MontreCode{[keys]}:
879
880 \begin{itemize}
881 \item \MontreCode{Sizex=...} (\MontreCode{2pt} by default) for points \textit{cross};
882 \item \MontreCode{Sizeo=...} (\MontreCode{1.75pt} by default) for the points \textit{circle};
883 \item \MontreCode{Sizec=...} (\MontreCode{2pt} by default) for the \textit{square} points.
884 \end{itemize}
885
886 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
887 \begin{GraphTikz}[x=1cm,y=1cm,Xmin=0,Ymin=0]
888 \DrawAxisGrids[Enlarge=2.5mm]{auto}{auto}
889 \MarkPts[Color=red,Style=x,Size=3.5pt]{(1.25,1.25)/below/$A$}
890 \MarkPts[Color=teal,Size=2.5pt]{(2,2)/right/$A$}
891 \MarkPts*[Color=orange,Style=c,Size=4pt]{(0.5,2.5)}
892 \end{GraphTikz}
893 \end{tcblisting}
894
895 \subsection{Retrieve node coordinates}\label{recupcoordo}
896
897 It is also possible, with a view to reusing coordinates, to recover the coordinates of a node (defined or determined).
898
899 \smallskip
900
901 The calculations are carried out by floating according to the (re)calculated units, the values are therefore approximated !
902
903 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
904 %in the GraphiqueTikz environment
905 \GetXcoord{node}[\macrox]
906 \GetYcoord{node}[\macroy]
907 \GetXYcoord{node}[\macrox][\macroy]
908 \end{tcblisting}
909
910 \subsection{Place text}\label{placetxt}
911
912 Note that a text placement command is available.
913
914 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
915 %in the GraphiqueTikz environment
916 \DrawTxt[keys]{(node or coordinates)}{text}
917 \end{tcblisting}
918
919 The available \MontreCode{[keys]} are:
920
921 \begin{itemize}
922 \item \MontreCode{Font=...} (\MontreCode{\textbackslash normalsize\textbackslash normalfont} by default) for the font;
923 \item \MontreCode{Color=...} (\MontreCode{black} by default) for the color;
924 \item \MontreCode{Position=...} (\MontreCode{empty} by default) for the position of the text relative to the coordinates.
925 \end{itemize}
926
927 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
928 \begin{GraphTikz}[x=1cm,y=1cm,Xmin=0,Xmax=5,Ymin=0,Ymax=1]
929 \DrawAxisGrids[Enlarge=2.5mm]{auto}{auto}
930 \DrawTxt[Color=red,Font=\LARGE,Position=right]{(1.5,0.5)}{curve $C_1$}
931 \end{GraphTikz}
932 \end{tcblisting}
933
934 \section{Specific commands for using curves}
935
936 \subsection{Image placement}\label{images}
937
938 It is possible to place points (images) on a curve, with possible construction lines.
939
940 The function/curve used must have been declared previously for this command to work.
941
942 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
943 %in the GraphiqueTikz environment
944 \DrawRanges[keys]{function or curve}{list of abscissa}
945 \end{tcblisting}
946
947 The optional \MontreCode{[keys]} available are:
948
949 \smallskip
950
951 \begin{itemize}
952 \item \MontreCode{Lines}: boolean to display construction traits (\MontreCode{false} by default);
953 \item \MontreCode{Colors}: color of the points/lines, in the form \MontreCode{Couleurs} or \MontreCode{ColPoint/ColLines};
954 \item \MontreCode{Spline}: boolean to specify that the curve used is defined as a \textsf{spline} (\MontreCode{false} by default).
955 \end{itemize}
956
957 \smallskip
958
959 The first mandatory argument allows you to specify:
960
961 \smallskip
962
963 \begin{itemize}
964 \item the name of the curve in the case \MontreCode{Spline=true};
965 \item the name of the function otherwise.
966 \end{itemize}
967
968 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
969 \begin{GraphTikz}%
970 [x=0.9cm,y=0.425cm,Xmin=4,Xmax=20,Origx=4,
971 Ymin=40,Ymax=56,Ygrid=2,Ygrids=1,Origy=40]
972 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{4,5,...,20}{40,42,...,56}
973 %definition of the function + drawing of the curve
974 \DefineCurve[Name=cf,Start=5,End=19,Trace,Color=red]<f>{-2*x+3+24*log(2*x)}
975 %images
976 \DrawRanges[Lines,Colors=teal/blue]{f}{6,7,8,9,10}
977 \end{GraphTikz}
978 \end{tcblisting}
979
980 \pagebreak
981
982 \subsection{Antecedent determination}\label{defanteced}
983
984 It is possible to graphically determine the antecedents of a given reality.
985
986 The function/curve used must have been declared previously for this command to work.
987
988 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
989 %in the GraphiqueTikz environment
990 \FindCounterimage[keys]{curve}{k}
991 \end{tcblisting}
992
993 The optional \MontreCode{[keys]} available are:
994
995 \smallskip
996
997 \begin{itemize}
998 \item \MontreCode{Name}: base of the name of the \textbf{nodes} intersection (\MontreCode{S} by default, which will give \textsf{S-1}, \textsf{S-2}, etc);
999 \item \MontreCode{Disp}: boolean to display the points (\MontreCode{true} by default);
1000 \item \MontreCode{Color}: color of the points (\MontreCode{black} by default);
1001 \item \MontreCode{DispLine}: boolean to display the horizontal line (\MontreCode{false} by default).
1002 \end{itemize}
1003
1004 \smallskip
1005
1006 The first mandatory argument allows you to specify the \textbf{name} of the curve.
1007
1008 \smallskip
1009
1010 The second mandatory argument allows you to specify the value to reach.
1011
1012 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1013 \begin{GraphTikz}%
1014 [x=0.9cm,y=0.425cm,Xmin=4,Xmax=20,Origx=4,
1015 Ymin=40,Ymax=56,Ygrid=2,Ygrids=1,Origy=40]
1016 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{4,5,...,20}{40,42,...,56}
1017 %definition of the function + drawing of the curve
1018 \DefineCurve[Name=cf,Start=5,End=19,Trace,Color=red]<f>{-2*x+3+24*log(2*x)}
1019 %history
1020 \FindCounterimage[Color=teal,DispLine,Disp]{cf}{53}
1021 %the two antecedents are at nodes (S-1) and (S-2)
1022 \end{GraphTikz}
1023 \end{tcblisting}
1024
1025 \pagebreak
1026
1027 \subsection{Antecedent construction}\label{tracanteced}
1028
1029 It is possible to graphically construct the antecedents.
1030
1031 The function/curve used must have been declared previously for this command to work.
1032
1033 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1034 %in the GraphiqueTikz environment
1035 \DrawCounterimage[keys]{curve}{k}
1036 \end{tcblisting}
1037
1038 The optional \MontreCode{[keys]} available are:
1039
1040 \smallskip
1041
1042 \begin{itemize}
1043 \item \MontreCode{Colors}: color of the points/lines, in the form \MontreCode{Color} or \MontreCode{ColPoint/ColLines};
1044 \item \MontreCode{Name}: name \textit{possible} for the intersection points linked to the antecedents (\MontreCode{empty} by default);
1045 \item \MontreCode{Lines}: boolean to display construction traits (\MontreCode{false} by default).
1046 \end{itemize}
1047
1048 \smallskip
1049
1050 The first mandatory argument allows you to specify the \textbf{name} of the curve.
1051
1052 \smallskip
1053
1054 The second mandatory argument allows you to specify the value to reach.
1055
1056 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1057 \begin{GraphTikz}%
1058 [x=0.9cm,y=0.425cm,Xmin=4,Xmax=20,Origx=4,
1059 Ymin=40,Ymax=56,Ygrid=2,Ygrids=1,Origy=40]
1060 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{4,5,...,20}{40,42,...,56}
1061 %definition of the function + drawing of the curve
1062 \DefineCurve[Name=cf,Start=5,End=19,Trace,Color=red]<f>{-2*x+3+24*log(2*x)}
1063 %history
1064 \DrawCounterimage[Colors=teal/cyan,Lines,Name=PO]{cf}{53}
1065 \GetXcoord{(PO-1)}[\premsol]
1066 \GetXcoord{(PO-2)}[\deuxsol]
1067 \end{GraphTikz}
1068
1069 Graphically, the antecedents of 53 are (approximately):
1070
1071 \begin{itemize}
1072 \item \num{\premsol}
1073 \item \num{\deuxsol}
1074 \end{itemize}
1075 \end{tcblisting}
1076
1077 \pagebreak
1078
1079 \subsection{Intersections of two curves}\label{intersect}
1080
1081 It is also possible to determine (in the form of nodes) the possible points of intersection of two previously defined curves.
1082
1083 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1084 %in the GraphiqueTikz environment
1085 \FindIntersections[keys]{curve1}{curve2}
1086 \end{tcblisting}
1087
1088 The optional \MontreCode{[keys]} available are:
1089
1090 \smallskip
1091
1092 \begin{itemize}
1093 \item \MontreCode{Name}: base of the name of the \textbf{nodes} intersection (\MontreCode{S} by default, which will give \textsf{S-1}, \textsf{S-2}, etc);
1094 \item \MontreCode{Disp}: boolean to display the points (\MontreCode{true} by default);
1095 \item \MontreCode{Color}: color of the points (\MontreCode{black} by default).
1096 \end{itemize}
1097
1098 \smallskip
1099
1100 The first mandatory argument allows you to specify the \textbf{name} of the first curve.
1101
1102 \smallskip
1103
1104 The first mandatory argument allows you to specify the \textbf{name} of the second curve.
1105
1106 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1107 \begin{GraphTikz}%
1108 [x=0.9cm,y=0.425cm,Xmin=4,Xmax=20,Origx=4,
1109 Ymin=40,Ymax=56,Ygrid=2,Ygrids=1,Origy=40]
1110 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{4,5,...,20}{40,42,...,56}
1111 \DefineCurve[Name=cf,Start=5,End=19,Trace,Color=red]<f>{-2*x+3+24*log(2*x)}
1112 \DefineCurve[Name=cg,Start=5,End=19,Trace,Color=blue]<g>{0.25*(x-12)^2+46}
1113 %intersections, named (TT-1) and (TT-2)
1114 \FindIntersections[Name=TT,Color=darkgray,Display,Lines]{cf}{cg}
1115 %recovery of intersection points
1116 \GetXYcoord{(TT-1)}[\alphaA][\betaA]
1117 \GetXYcoord{(TT-2)}[\alphaB][\betaB]
1118 \end{GraphTikz}\\
1119 The solutions of $f(x)=g(x)$ are $\alpha \approx \num{\alphaA}$ and
1120 $\beta \approx \num{\alphaB}$.\\
1121 The points of intersection of the curves of $f$ and $g$ are therefore
1122 $(\RoundNb[2]{\alphaA};\RoundNb[2]{\betaA})$ and
1123 $(\RoundNb[2]{\alphaB};\RoundNb[2]{\betaB})$.
1124 \end{tcblisting}
1125
1126 \pagebreak
1127
1128 \subsection{Extrema}\label{maximum}\label{minimum}
1129
1130 The idea (still \textit{experimental}) is to offer commands to extract the extrema of a curve defined by the package.
1131
1132 The command creates the corresponding node, and it is therefore possible to retrieve its coordinates for later use.
1133
1134 \smallskip
1135
1136 It is possible, by specifying it, to work on the different curves managed by the package (function, interpolation, spline).
1137
1138 For singular curves, it is possible that the results are not quite those expected\ldots
1139
1140 \smallskip
1141
1142 {\small\faBomb} For the moment, the \textit{limitations} are:
1143
1144 \begin{itemize}
1145 \item no management of multiple extrema (only the first will be processed)\ldots
1146 \item no management of extrema at the boundaries of the route\ldots
1147 \item no automatic recovery of curve definition parameters\ldots
1148 \item compilation time may be longer\ldots
1149 \end{itemize}
1150
1151 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1152 %in the GraphiqueTikz environment
1153 \FindMax[keys]{object}[node created]
1154 \FindMin[keys]{object}[node created]
1155 \end{tcblisting}
1156
1157 The optional \MontreCode{[keys]} available are:
1158
1159 \smallskip
1160
1161 \begin{itemize}
1162 \item \MontreCode{Method}: method, among \MontreCode{function/interpo/spline} for calculations (\MontreCode{function} by default);
1163 \item \MontreCode{Start}: start of the plot (\MontreCode{\textbackslash pflxmin} by default);
1164 \item \MontreCode{End}: end of the plot (\MontreCode{\textbackslash pflxmax} by default);
1165 \item \MontreCode{Step}: not in the plot if \MontreCode{function} (it is determined \textit{automatically} at the start but can be modified);
1166 \item \MontreCode{Coeffs}: modify the \textit{coefficients} of the spline if \MontreCode{spline};
1167 \item \MontreCode{Tension}: setting the \textit{tension} of the interpolation plot if \MontreCode{interpo}(\MontreCode{0.5} by default).
1168 \end{itemize}
1169
1170 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1171 \begin{GraphTikz}[x=1cm,y=1cm,Xmin=-1,Xmax=5,Ymin=-1,Ymax=3]
1172 \DrawAxisGrids[Enlarge=2.5mm]{auto}{auto}
1173 \DefineCurve[Name=cf,Start=0.35,End=4.2,Trace]%
1174 <f>{0.6*cos(4.5*(x-4)+2.1)-1.2*sin(x-4)+0.1*x+0.2}
1175 \FindMax[Start=0.35,End=4.2]{f}[cf-max]
1176 \FindMax[Start=3,End=4]{f}[cf-maxlocal]
1177 \FindMin[Start=1,End=2]{f}[cf-minlocal]
1178 \MarkPts*[Color=red,Lines]{(cf-max)}
1179 \MarkPts*[Color=blue,Lines]{(cf-maxlocal)}
1180 \MarkPts*[Color=olive,Lines]{(cf-minlocal)}
1181 \GetXYcoord{(cf-max)}[\MyMaxX][\MyMaxY]
1182 \end{GraphTikz}\\
1183 The maximum is $M\approx\RoundNb{\MyMaxY}$, reached in $x\approx\RoundNb{\MyMaxX}$
1184 \end{tcblisting}
1185
1186 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1187 \begin{GraphTikz}[x=0.8cm,y=1cm,Xmin=-7,Xmax=4,Ymin=-3,Ymax=5]
1188 \DrawAxisGrids[Enlarge=2.5mm]{-7,-6,...,4}{-3,-2,...,5}
1189 \DefineInterpoCurve[Name=interpotest,Color=red,Trace,Tension=1]%
1190 {(-6,4)(-2,-2)(3,3.5)}
1191 \FindMin[Method=interpo,Tension=1]{(-6,4)(-2,-2)(3,3.5)}[interpo-min]
1192 \MarkPts*[Color=blue]{(interpo-min)}
1193 \GetXYcoord{(interpo-min)}[\MinInterpoX][\MinInterpoY]
1194 \end{GraphTikz}\\
1195 The minimum is $M\approx\RoundNb[3]{\MinInterpoY}$, reached at $x\approx\RoundNb[3]{\MinInterpoX}$
1196 \end{tcblisting}
1197
1198 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1199 \begin{GraphTikz}%
1200 [x=1.2cm,y=1.6cm,Xmin=-7,Xmax=4,Ymin=-3,Ymax=3,Ygrid=0.5,Ygrids=0.25]
1201 \DrawAxisGrids[Enlarge=2.5mm]{auto}{auto}
1202 \def\LISTETEST{-6/2/0§-1/-2/0§2/1/0§3.5/0/-1}
1203 \DefineSplineCurve[Name=splinetest,Trace]{\LISTETEST}
1204 \FindMin[Method=spline]{\LISTETEST}[spline-min]
1205 \MarkPts*[Color=red]{(spline-min)}
1206 \end{GraphTikz}
1207 \end{tcblisting}
1208
1209 \pagebreak
1210
1211 \subsection{Integrals (improved version)}\label{integr}
1212
1213 We can also work with integrals.
1214
1215 In this case it is preferable to highlight the domain \textbf{before} the plots, to avoid overprinting in relation to the curves/points.
1216
1217 \smallskip
1218
1219 It is possible to:
1220
1221 \begin{itemize}
1222 \item represent an integral \textbf{under} a defined curve;
1223 \item represent an integral \textbf{between} two curves;
1224 \item the integration limits can be x-coordinates and/or nodes.
1225 \end{itemize}
1226
1227 \smallskip
1228
1229 {\small\faBomb} Given the differences in processing between formula curves, simple interpolation curves or cubic interpolation curves, the arguments and keys may differ depending on the configuration!
1230
1231 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1232 %in the GraphiqueTikz environment
1233 \DrawIntegral[keys]<specific options>{object1}[object2]{A}{B}
1234 \end{tcblisting}
1235
1236 The optional \MontreCode{[keys]} for definition or tracing are:
1237
1238 \begin{itemize}
1239 \item \MontreCode{Colors} =: colors of the filling, in the form \MontreCode{Col} or \MontreCode{ColBorder/ColBg} (\MontreCode{gray} by default);
1240 \item \MontreCode{Style}: type of filling, among \MontreCode{fill}/\MontreCode{hatch} (\MontreCode{fill} by default);
1241 \item \MontreCode{Opacity}: opacity (\MontreCode{0.5} by default) of the filling;
1242 \item \MontreCode{Hatch}: style (\MontreCode{north west lines} by default) of the hatch filling;
1243 \item \MontreCode{Type}: type of integral among
1244 \begin{itemize}
1245 \item \MontreCode{fct} (default) for an integral under a curve defined by a formula;
1246 \item \MontreCode{spl} for an integral under a curve defined by a cubic spline;
1247 \item \MontreCode{itp} for an integral under a curve defined by interpolation;
1248 \item \MontreCode{fct/fct} for an integral between two curves defined by a formula;
1249 \item \MontreCode{fct/spl} for an integral between a curve (above) defined by a formula and a curve (below) defined by a spline cubic;
1250 \item etc.
1251 \end{itemize}
1252 \item \MontreCode{Step}: steps (calculated by default otherwise) for the plot;
1253 \item \MontreCode{Junction}: junction of segments (\MontreCode{bevel} by default);
1254 \item \MontreCode{Bounds}: type of terminals among:
1255 \begin{itemize}
1256 \item \MontreCode{abs} for the limits given by the abscissa;
1257 \item \MontreCode{nodes} for the limits given by the nodes;
1258 \item \MontreCode{abs/node} for the limits given by abscissa and node;
1259 \item \MontreCode{node/abs} for the limits given by node and abscissa;
1260 \end{itemize}
1261 \item \MontreCode{Border}: boolean (\MontreCode{true} by default) to display the side lines,%
1262 \item \MontreCode{SplineName}: macro (important!) of the spline generated previously for a higher version spline;
1263 \item \MontreCode{SplineNameB}: macro (important!) of the spline generated previously for a lower version spline;
1264 \item \MontreCode{InterpoName}: name (important!) of the interpolation curve generated previously, in higher version;
1265 \item \MontreCode{InterpoBName}: name (important!) of the interpolation curve generated previously, in lower version;
1266 \item \MontreCode{Tension}: Tension for the interpolation curve generated previously, in higher version;
1267 \item \MontreCode{TensionB}: Tension of the interpolation curve generated previously, in lower version.
1268 \end{itemize}
1269
1270 \smallskip
1271
1272 The first required argument is the spline function or curve or list of interpolation points.
1273
1274 \smallskip
1275
1276 The next optional argument is the spline function or curve or list of interpolation points.
1277
1278 \smallskip
1279
1280 The last two mandatory arguments are the limits of the integral, given in a form consistent with the key \MontreCode{Bounds}.
1281
1282 \pagebreak
1283
1284 In the case of curves defined by \textit{points}, it is necessary to work on intervals on which the first curve is \textbf{above} the second.
1285
1286 It will undoubtedly be interesting to work with \textit{intersections} in this case.
1287
1288 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1289 \begin{GraphTikz}%
1290 [x=0.6cm,y=0.06cm,
1291 Xmin=0,Xmax=21,Xgrid=1,Xgrids=0.5,
1292 Ymin=0,Ymax=155,Ygrid=10,Ygrids=5]
1293 \DrawAxisGrids[Grads=false,Enlarge=2.5mm]{}{}
1294 \DefineCurve[Name=cf,Start=1,End=20,Color=red]<f>{80*x*exp(-0.2*x)}
1295 \DrawIntegral
1296 [Bounds=abs,Colors=blue/cyan!50]%
1297 {f(x)}{3}{12}
1298 \DrawCurve[Color=red,Start=1,End=20]{f(x)}
1299 \DrawAxisGrids%
1300 [Grid=false,Enlarge=2.5mm,Font=\small]{0,1,...,20}{0,10,...,150}
1301 \end{GraphTikz}
1302 \end{tcblisting}
1303
1304 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1305 \begin{GraphTikz}%
1306 [x=1.2cm,y=1.6cm,Xmin=-7,Xmax=4,Ymin=-3,Ymax=3,Ygrid=0.5,Ygrids=0.25]
1307 \DrawAxisGrids[Grads=false,Enlarge=2.5mm]{}{}
1308 \def\LISTETEST{-6/2/0§-1/-2/0§2/1/0§3.5/0/-1}
1309 \DefineSplineCurve[Name=splinetest]{\LISTETEST}
1310 \DrawIntegral[Type=spl,Style=hatch,Colors=purple]{splinetest}{-5.75}{-4.75}
1311 \DrawIntegral[Type=spl,Colors=blue]{splinetest}{-2}{-1}
1312 \DrawIntegral[Type=spl,Colors=orange]{splinetest}{1}{3}
1313 \DrawSplineCurve[Color=olive]{\LISTETEST}
1314 \DrawAxisGrids[Grid=false,Enlarge=2.5mm]
1315 {-7,-6,...,4}%
1316 {-3,-2.5,...,3}
1317 \end{GraphTikz}
1318 \end{tcblisting}
1319
1320 \pagebreak
1321
1322 \subsection{Tangents}\label{tgte}
1323
1324 The idea of this command is to draw the tangent to a previously defined curve, specifying:
1325
1326 \begin{itemize}
1327 \item the point (abscissa or node) at which we wish to work;
1328 \item possibly the direction (in the case of a discontinuity or a terminal);
1329 \item possibly the step ($h$) of the calculation;
1330 \item the \textit{lateral spacings} to draw the tangent.
1331 \end{itemize}
1332
1333 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1334 %in the GraphiqueTikz environment
1335 \DrawTangent[keys]{function or curve}{point}<line options>
1336 \end{tcblisting}
1337
1338 The optional \MontreCode{[keys]} for definition or tracing are:
1339
1340 \begin{itemize}
1341 \item \MontreCode{Colors} =: colors of the plots, in the form \MontreCode{Col} or \MontreCode{ColLine/ColPoint} (\MontreCode{black} by default);
1342 \item \MontreCode{OffsetL} =: left horizontal spacing to start the trace (\MontreCode{1} by default);
1343 \item \MontreCode{OffsetR} =: left horizontal spacing to start the trace (\MontreCode{1} by default);
1344 \item \MontreCode{DispPt}: boolean to display the support point (\MontreCode{false} by default);
1345 \item \MontreCode{Spline}: boolean to specify that a spline is used (\MontreCode{false} by default);
1346 \item \MontreCode{h}: delta $h$ used for calculations (\MontreCode{0.01} by default);
1347 \item \MontreCode{Direction}: allows you to specify the \textit{direction} of the tangent, among \MontreCode{lr}/\MontreCode{l}/\MontreCode{r} (\MontreCode{lr} by default);
1348 \item \MontreCode{Node}: boolean to specify that a node is used (\MontreCode{false} by default).
1349 \end{itemize}
1350
1351 \smallskip
1352
1353 The first required argument is the spline function or curve (if applicable).
1354
1355 \smallskip
1356
1357 The last mandatory argument is the work point (abscissa version or node following the key \MontreCode{Node}).
1358
1359 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1360 \begin{GraphTikz}%
1361 [x=0.9cm,y=0.425cm,Xmin=4,Xmax=20,Origx=4,
1362 Ymin=40,Ymax=56,Ygrid=2,Ygrids=1,Origy=40]
1363 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{4,5,...,20}{40,42,...,56}
1364 \DefineCurve[Name=cf,Start=5,End=19,Color=red,Trace]<f>{-2*x+3+24*log(2*x)}
1365 \FindCounterimage[Color=teal,Name=JKL,Disp=false]{cf}{53}
1366 %tangent
1367 \DrawTangent%
1368 [Colors=cyan/gray,OffsetL=2.5,OffsetR=2.5,Node,DispPt]{f}{(JKL-1)}
1369 \end{GraphTikz}
1370 \end{tcblisting}
1371
1372 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1373 \begin{GraphTikz}%
1374 [x=0.8cm,y=1cm,Xmin=-7,Xmax=4,Ymin=-3,Ymax=5]
1375 \DrawAxisGrids[Enlarge=2.5mm]{-7,-6,...,4}{-3,-2,...,5}
1376 \def\LISTETEST{-6/4/-0.5§-5/2/-2§-4/0/-2§-2/-2/0§1/2/2§3/3.5/0.5}
1377 \DefineSplineCurve[Name=splinetest,Trace,Color=olive]{\LISTETEST}
1378 \DrawTangent[Colors=red,Spline,DispPt]{splinetest}{1}
1379 \DrawTangent%
1380 [Colors=blue,Spline,OffsetL=1.5,OffsetR=1.5,DispPt]{splinetest}{-3}%
1381 <tkzgrpharrowlr>
1382 \DrawTangent[Direction=l,Colors=orange,Spline,OffsetL=1.5,DispPt]{splinetest}{3}
1383 \DrawTangent[Direction=r,Colors=purple,Spline,OffsetR=1.5,DispPt]{splinetest}{-6}
1384 \end{GraphTikz}
1385 \end{tcblisting}
1386
1387 \pagebreak
1388
1389 %\section{Specific commands for density functions}
1390 %
1391 %\subsection{Normal distribution}\label{normal distribution}
1392 %
1393 %The idea is to provide something to work with standard deviation.
1394 %
1395 %\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1396 % %in the GraphiqueTikz environment
1397 % \DefineNormalDistribution[keys]<fct name>{mu}{sigma}
1398 % \TraceNormalDistribution[keys]{fct(x)}
1399 %\end{tcblisting}
1400 %
1401 %The optional \MontreCode{[keys]} available are:
1402 %
1403 %\smallskip
1404 %
1405 %\begin{itemize}
1406 % \item \MontreCode{Name}: name of the plot (\MontreCode{Gaussian} by default);
1407 % \item \MontreCode{Trace}: boolean to trace the curve (\MontreCode{false} by default);
1408 % \item \MontreCode{Couleur}: color of the trace, if requested (\MontreCode{black} by default);
1409 % \item \MontreCode{Debut}: lower bound of the definition set (\MontreCode{\textbackslash pflxmin} by default);
1410 % \item \MontreCode{End}: lower bound of the definition set (\MontreCode{\textbackslash pflxmax} by default);
1411 % \item \MontreCode{Pas}: plot step (it is determined \textit{automatically} at the start but can be modified).
1412 %\end{itemize}
1413 %
1414 %Note that the vertical axis must be adapted according to the parameters of the normal law.
1415 %
1416 %\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1417 % \begin{GraphTikz}%
1418 % [x=1.25cm,y=15cm,Origx=5,Xmin=5,Xmax=15,Ymin=0,Ymax=0.3,
1419 % Ygrid=0.1,Ygrids=0.05]
1420 % \DrawAxisGrids[Enlarge=2.5mm]{auto}{auto}
1421 % \DefineNormalDistribution[Name=Gaussian]<phi>{10}{1.5}
1422 % \TracerIntegral
1423 % [Terminals=abs, Colors=blue/cyan!50]%
1424 % {phi(x)}{7}{13}
1425 % \TraceNormalLaw[Color=purple,Start=5,End=15]{phi(x)}
1426 % \end{GraphTikz}
1427 %\end{tcblisting}
1428 %
1429 %\pagebreak
1430 %
1431 %\subsection{Chi-square law}\label{loikhideux}
1432 %
1433 %The idea is to provide something to work with normal laws.
1434 %
1435 %\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1436 % %in the GraphiqueTikz environment
1437 % \DefineKhiTwoLaw[keys]<fct name>{k}
1438 % \TraceLawKhiTwo[keys]{fct(x)}
1439 %\end{tcblisting}
1440 %
1441 %The optional \MontreCode{[keys]} available are:
1442 %
1443 %\smallskip
1444 %
1445 %\begin{itemize}
1446 % \item \MontreCode{Name}: name of the plot (\MontreCode{Gaussian} by default);
1447 % \item \MontreCode{Trace}: boolean to trace the curve (\MontreCode{false} by default);
1448 % \item \MontreCode{Couleur}: color of the trace, if requested (\MontreCode{black} by default);
1449 % \item \MontreCode{Debut}: lower bound of the definition set (\MontreCode{\textbackslash pflxmin} by default);
1450 % \item \MontreCode{End}: lower bound of the definition set (\MontreCode{\textbackslash pflxmax} by default);
1451 % \item \MontreCode{Pas}: plot step (it is determined \textit{automatically} at the start but can be modified).
1452 %\end{itemize}
1453 %
1454 %Note that the vertical axis must be adapted according to the parameter of the chi-square law.
1455 %
1456 %\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1457 % \begin{GraphTikz}[
1458 % x=1.5cm,y=7.5cm,
1459 % Xmin=0,Xmax=8,Xgrid=1,Xgrids=0.5,
1460 % Ymin=0,Ymax=0.5,Ygrid=0.1,Ygrids=0.05
1461 % ]
1462 % \DrawAxisGrids[Enlarge=2.5mm]{auto}{auto}
1463 % \DefineKhiTwoLaw[Color=red,Start=0.25,Trace]<phiA>{1}
1464 % \DefineKhiTwoLaw[Color=blue,Trace]<phiB>{2}
1465 % \DefineLawKhiDeux[Color=orange,Trace]<phiC>{3}
1466 % \DefineKhiTwoLaw[Color=purple,Trace]<phiD>{4}
1467 % \DefineKhiTwoLaw[Color=yellow,Trace]<phiE>{5}
1468 % \DefineKhiTwoLaw[Color=teal,Trace]<phiF>{6}
1469 % \end{GraphTikz}
1470 %\end{tcblisting}
1471
1472 \subsection{Linear inequality}
1473
1474 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1475 %within graphTike environment
1476 \LinearInequality[keys]<function name>{expression}{symbol}
1477 \end{tcblisting}
1478
1479 First argument, \textit{optional} and within \MontreCode{[...]}, gives following keys:
1480
1481 \begin{itemize}
1482 \item \MontreCode{swap=TF} for shading non-solution (\MontreCode{false} by default) ;
1483 \item \MontreCode{opacity=...} (\MontreCode{0.25} by default) ;
1484 \item \MontreCode{color=...} (\MontreCode{black} by default) ;
1485 \item \MontreCode{style=...} (\MontreCode{hatch} by default) ;
1486 \item \MontreCode{hatch} (\MontreCode{north west lines} by default).
1487 \end{itemize}
1488
1489 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1490 \begin{GraphTikz}[x=0.4cm,y=0.4cm,Xmin=-4,Xmax=6,Ymin=-3,Ymax=7]
1491 \DrawAxisGrids[Font=\tiny]{auto}{auto}
1492 \LinearInequality[color=blue]{-3x+2}{>0}
1493 \end{GraphTikz}
1494 ~~
1495 \begin{GraphTikz}[x=0.4cm,y=0.4cm,Xmin=-4,Xmax=6,Ymin=-3,Ymax=7]
1496 \DrawAxisGrids[Font=\tiny]{auto}{auto}
1497 \LinearInequality[color=pink]{-x+y+2}{<=0}
1498 \end{GraphTikz}
1499 ~~
1500 \begin{GraphTikz}[x=0.4cm,y=0.4cm,Xmin=-4,Xmax=6,Ymin=-3,Ymax=7]
1501 \DrawAxisGrids[Font=\tiny]{auto}{auto}
1502 \LinearInequality[color=teal]{-x+y-4}{>0}
1503 \end{GraphTikz}
1504 \end{tcblisting}
1505
1506 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1507 \begin{GraphTikz}[x=0.4cm,y=0.4cm,Xmin=-4,Xmax=6,Ymin=-3,Ymax=7]
1508 \DrawAxisGrids[Font=\tiny]{auto}{auto}
1509 \LinearInequality[color=blue]{-4*y+5}{<=0}
1510 \end{GraphTikz}
1511 ~~
1512 \begin{GraphTikz}[x=0.4cm,y=0.4cm,Xmin=-4,Xmax=6,Ymin=-3,Ymax=7]
1513 \DrawAxisGrids[Font=\tiny]{auto}{auto}
1514 \LinearInequality[color=pink,hatch={north east lines}]{-x-2y+2}{<=0}
1515 \end{GraphTikz}
1516 ~~
1517 \begin{GraphTikz}[x=0.4cm,y=0.4cm,Xmin=-4,Xmax=6,Ymin=-3,Ymax=7]
1518 \DrawAxisGrids[Font=\tiny]{auto}{auto}
1519 \LinearInequality[style=fill,color=teal]{-x-y-4}{>0}
1520 \end{GraphTikz}
1521
1522 \begin{GraphTikz}[x=0.4cm,y=0.4cm,Xmin=-4,Xmax=6,Ymin=-3,Ymax=7]
1523 \DrawAxisGrids[Font=\tiny]{auto}{auto}
1524 \LinearInequality[swap,style=fill,color=teal]{-x-y-4}{>0}
1525 \end{GraphTikz}
1526 \end{tcblisting}
1527
1528 \pagebreak
1529
1530 \section{Commands specific to two-variable statistics}
1531
1532 \subsection{Limitations}
1533
1534 Given the specific features of \TikZ, we advise you not to use values that are too \textit{large} at axis level (this can cause problems with years, for example), or else you'll have to \textit{transform} axis and/or data values so that everything is displayed as it should be (also beware of regressions, calculations, etc.).
1535
1536 \subsection{The point scatter}\label{scatter}
1537
1538 In addition to commands linked to functions, it is also possible to represent double statistical series.
1539
1540 \smallskip
1541
1542 The following paragraph shows that adding a key allows you to add the linear adjustment line.
1543
1544 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1545 %in the GraphiqueTikz environment
1546 \DrawScatter[keys]{ListX}{ListY}
1547 \end{tcblisting}
1548
1549 The optional \MontreCode{[key]} is:
1550
1551 \smallskip
1552
1553 \begin{itemize}
1554 \item \MontreCode{ColorScatter}: color of the cloud points (\MontreCode{black} by default).
1555 \end{itemize}
1556
1557 \smallskip
1558
1559 The mandatory arguments allow you to specify:
1560
1561 \smallskip
1562
1563 \begin{itemize}
1564 \item the list of x;
1565 \item the list of y.
1566 \end{itemize}
1567
1568 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1569 \begin{GraphTikz}%
1570 [x=0.075cm,y=0.03cm,Xmin=0,Xmax=160,Xgrid=20,Xgrids=10,
1571 Origy=250,Ymin=250,Ymax=400,Ygrid=25,Ygrids=5]
1572 %window preparation
1573 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{0,10,...,160}{250,275,...,400}
1574 %A cloud of dots
1575 \DrawScatter[Style=x,ColorScatter=red]{0,50,100,140}{275,290,315,350}
1576 \end{GraphTikz}
1577 \end{tcblisting}
1578
1579 \subsection{The regression line}\label{reglin}
1580
1581 The linear regression line (obtained by the least squares method) can easily be added, using the key \MontreCode{DrawLine}.
1582
1583 \smallskip
1584
1585 In this case, new keys are available:
1586
1587 \smallskip
1588
1589 \begin{itemize}
1590 \item \MontreCode{ColorLine}: color of the line (\MontreCode{black} by default);
1591 \item \MontreCode{Rounds}: precision of coefficients (\MontreCode{empty} by default);
1592 \item \MontreCode{Start}: initial abscissa of the plot (\MontreCode{\textbackslash pflxmin} by default);
1593 \item \MontreCode{End}: terminal abscissa of the plot (\MontreCode{\textbackslash pflxmax} by default);
1594 \item \MontreCode{Name}: name of the line, for later use (\MontreCode{reglin} by default).
1595 \end{itemize}
1596
1597 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1598 \begin{GraphTikz}%
1599 [x=0.075cm,y=0.03cm,Xmin=0,Xmax=160,Xgrid=20,Xgrids=10,
1600 Origy=250,Ymin=250,Ymax=400,Ygrid=25,Ygrids=5]
1601 \DrawAxisGrids[Enlarge=2.5mm,Font=\small]{0,10,...,160}{250,275,...,400}
1602 %cloud and right
1603 \DrawScatter%
1604 [ColorScatter=red,ColorLine=brown,DrawLine]%
1605 {0,50,100,140}{275,290,315,350}
1606 %picture
1607 \DrawRanges[Colors=cyan/magenta,Lines]{d}{120}
1608 %history
1609 \DrawCounterimage[Style=x,Colors=blue/green!50!black,Lines]{reglin}{300}
1610 \end{GraphTikz}
1611 \end{tcblisting}
1612
1613 \subsection{Other regressions}\label{regressions}
1614
1615 In partnership with the \MontreCode{xint-regression} package, loaded by the package (but \textit{can be deactivated} via the \MontreCode{[noxintreg]} option), it is possible to work on other types of regression:
1616
1617 \begin{itemize}
1618 \item linear \fbox{$ax+b$};
1619 \item quadratic \fbox{$ax^2+bx+c$};
1620 \item cubic \fbox{$ax^3+bx^2+cx+d$};
1621 \item power \fbox{$ax^b$};
1622 \item exponential \fbox{$ab^x$} or \fbox{$e^{ax+b}$} or \fbox{$b e^{ax}$} or \fbox{$C + be^{ax} $};
1623 \item logarithmic \fbox{$a+b\ln(x)$};
1624 \item hyperbolic \fbox{$a+\displaystyle\frac{b}{x}$}.
1625 \end{itemize}
1626
1627 The command, similar to that of defining a curve, is:
1628
1629 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1630 \DrawRegression[keys]<name fct>{type}<rounded>{listex}{listey}
1631 \end{tcblisting}
1632
1633 The \MontreCode{[keys]} available are, classically:
1634
1635 \begin{itemize}
1636 \item \MontreCode{Start}: lower bound of the definition set (\MontreCode{\textbackslash pflxmin} by default);
1637 \item \MontreCode{End}: lower bound of the definition set (\MontreCode{\textbackslash pflxmax} by default);
1638 \item \MontreCode{Name}: name of the curve (important for the rest!);
1639 \item \MontreCode{Color}: color of the trace (\MontreCode{black} by default);
1640 \item \MontreCode{Step}: plot step (it is determined \textit{automatically} at the start but can be modified).
1641 \end{itemize}
1642
1643 \pagebreak
1644
1645 The second argument, optional and between \MontreCode{<...>}, allows you to name the regression function.
1646
1647 The third argument, mandatory and between \MontreCode{\{...\}} allows you to choose the type of regression, among:
1648
1649 \begin{itemize}
1650 \item \MontreCode{lin}: linear \fbox{$ax+b$};
1651 \item \MontreCode{quad}: quadratic \fbox{$ax^2+bx+c$};
1652 \item \MontreCode{cub}: cubic \fbox{$ax^3+bx^2+cx+d$};
1653 \item \MontreCode{pow}: power \fbox{$ax^b$};
1654 \item \MontreCode{expab}: exponential \fbox{$ab^x$}
1655 \item \MontreCode{hyp}: hyperbolic \fbox{$a+\displaystyle\frac{b}{x}$};
1656 \item \MontreCode{log}: logarithmic \fbox{$a+b\ln(x)$};
1657 \item \MontreCode{exp}: exponential \fbox{$e^{ax+b}$};
1658 \item \MontreCode{expalt}: exponential \fbox{$be^{ax}$};
1659 \item \MontreCode{expoff=C}: exponential \fbox{$C + be^{ax}$}.
1660 \end{itemize}
1661
1662 The fourth argument, optional and between \MontreCode{<...>}, allows you to specify the rounding(s) for the coefficients of the regression function.
1663
1664 The last two arguments are the lists of values of X and Y.
1665
1666 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1667 \def\LISTEXX{0,50,100,140}\def\LISTEYY{275,290,315,350}%
1668 ListX:= \LISTEXX\\
1669 ListY:= \LISTEYY
1670
1671 \begin{GraphTikz}
1672 [x=0.05cm,y=0.04cm,Xmin=0,Xmax=160,Xgrid=20,Xgrids=10,
1673 Origy=250,Ymin=250,Ymax=400,Ygrid=25,Ygrids=5]
1674 %window preparation
1675 \DrawAxisGrids[Enlarge=2.5mm,Font=\footnotesize]{auto}{auto}
1676 %A cloud of dots
1677 \DrawScatter[Style=o,ColorScatter=red]{\LISTEXX}{\LISTEYY}
1678 %adjustment expoffset
1679 \DrawRegression[Color=blue,Name=adjust]<adjust>{expoff=250}{\LISTEXX}{\LISTEYY}
1680 %holdings
1681 \DrawRanges[Colors=cyan/magenta,Lines]{adjust}{80}
1682 \DrawCounterimage[Style=x,Colors=blue/green!50!black,Lines]{adjust}{325}
1683 \end{GraphTikz}
1684
1685 \xintexpoffreg[offset=250,round=3/1]{\LISTEXX}{\LISTEYY}%
1686 We obtain $y=250+\num{\expregoffb}\text{e}^{\num{\expregoffa}x}$
1687 \end{tcblisting}
1688
1689 \newpage
1690
1691 \section{Auxiliary commands}
1692
1693 \subsection{Intro}
1694
1695 In addition to purely \textit{graphic} commands, some auxiliary commands are available:
1696
1697 \begin{itemize}
1698 \item a to format a number with a given precision;
1699 \item one for working on random numbers, with constraints.
1700 \end{itemize}
1701
1702 \subsection{Formatted rounding}\label{round number}
1703
1704 The \MontreCode{\textbackslash RoundNb} command allows you to format, using the \MontreCode{siunitx} package, a number (or a calculation), with a given precision. This can be \textit{useful} for formatting results obtained using coordinate retrieval commands, for example.
1705
1706 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1707 \RoundNb[precision]{xint calculation}
1708 \end{tcblisting}
1709
1710 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1711 \RoundNb{1/3}\\
1712 \RoundNb{16.1}\\
1713 \RoundNb[3]{log(10)}\\
1714 \end{tcblisting}
1715
1716 \subsection{Random number under constraints}\label{nbalea}
1717
1718 The idea of this second command is to be able to determine a random number:
1719
1720 \begin{itemize}
1721 \item integer or decimal;
1722 \item under constraints (between two fixed values).
1723 \end{itemize}
1724
1725 This can allow, for example, to work on curves with \textit{random} points, but respecting certain constraints.
1726
1727 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1728 \PickRandomNb(*)[precision (def 0)]{lower limit}{upper limit}[\macro]
1729 \end{tcblisting}
1730
1731 The star version takes the constraints in strict form ($\text{lower bound} < \text{macro} < \text{upper bound}$) while the normal version takes the constraints in broad form ($\text{lower bound) } \leq \text{macro} \leq \text{upper bound}$).
1732
1733 \smallskip
1734
1735 Note that the \textit{terminals} can be existing \textit{macros}!
1736
1737 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1738 %a number (2 digits after the decimal point) between 0.75 and 0.95
1739 %a number (2 digits after the decimal point) between 0.05 and 0.25
1740 %a number (2 decimal places) between 0.55 and \YrandMax
1741 %a number (2 decimal places) between \YrandMin and 0.45
1742 \PickRandomNb[2]{0.75}{0.95}[\YrandMax]%
1743 \PickRandomNb[2]{0.05}{0.25}[\YrandMin]%
1744 \PickRandomNb*[2]{0.55}{\YrandMax}[\YrandA]%
1745 \PickRandomNb*[2]{\YrandMin}{0.45}[\YrandB]%
1746 %verification
1747 \num{\YrandMax} \& \num{\YrandMin} \& \num{\YrandA} \& \num{\YrandB}
1748 \end{tcblisting}
1749
1750 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1751 %a number (2 digits after the decimal point) between 0.75 and 0.95
1752 %a number (2 digits after the decimal point) between 0.05 and 0.25
1753 %a number (2 decimal places) between 0.55 and \YrandMax
1754 %a number (2 decimal places) between \YrandMin and 0.45
1755 \PickRandomNb[2]{0.75}{0.95}[\YrandMax]%
1756 \PickRandomNb[2]{0.05}{0.25}[\YrandMin]%
1757 \PickRandomNb*[2]{0.55}{\YrandMax}[\YrandA]%
1758 \PickRandomNb*[2]{\YrandMin}{0.45}[\YrandB]%
1759 %verification
1760 \num{\YrandMax} \& \num{\YrandMin} \& \num{\YrandA} \& \num{\YrandB}
1761 \end{tcblisting}
1762
1763 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1764 %the curve is designed so that there are 3 antecedents
1765 \PickRandomNb[2]{0.75}{0.95}[\YrandMax]%
1766 \PickRandomNb[2]{0.05}{0.25}[\YrandMin]%
1767 \PickRandomNb*[2]{0.55}{\YrandMax}[\YrandA]%
1768 \PickRandomNb*[2]{\YrandMin}{0.45}[\YrandB]%
1769
1770 \begin{GraphTikz}
1771 [x=0.075cm,y=7.5cm,Xmin=0,Xmax=150,Xgrid=10,Xgrids=5,
1772 Ymin=0,Ymax=1,Ygrid=0.1,Ygrids=0.05]
1773 \DrawAxisGrids[Last,Enlarge=2.5mm]{auto}{auto}
1774 \DefineInterpoCurve[Color=red,Trace,Name=functiontest,Tension=0.75]
1775 {(0,\YrandA)(40,\YrandMin)(90,\YrandMax)(140,\YrandB)}
1776 \FindCounterimage[Disp=false,Name=ANTECED]{functiontest}{0.5}
1777 \DrawCounterimage[Colors=blue/teal,Lines]{functiontest}{0.5}
1778 \GetXcoord{(ANTECED-1)}[\Aalpha]
1779 \GetXcoord{(ANTECED-2)}[\Bbeta]
1780 \GetXcoord
1781 {(ANTECED-3)}[\Cgamma]
1782 \end{GraphTikz}
1783
1784 The solutions of $f(x)=\num{0.5}$ are, by graphic reading:
1785 $\begin{cases}
1786 \alpha \approx \RoundNb[0]{\Aalpha} \\
1787 \beta \approx \RoundNb[0]{\Bbeta} \\
1788 \gamma \approx \RoundNb[0]{\Cgamma}
1789 \end{cases}$.
1790 \end{tcblisting}
1791
1792 \subsection{Monte-Carle method}
1793
1794 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1795 %in the GraphiqueTikz environment
1796 \SimulateMonteCarlo[keys]{<function>}{number of points}[\nbptsmcok][\nbptsmcko]
1797 \end{tcblisting}
1798
1799 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
1800 \begin{GraphTikz}%
1801 [x=10cm,y=10cm,Xmin=0,Xmax=1,Xgrid=0.1,Xgrids=0.05,
1802 Ymin=0,Ymax=1,Ygrid=0.1,Ygrids=0.05]
1803 \DrawAxisGrids[Enlarge=2.5mm,Last]{auto}{auto}
1804 \DefineCurve[Trace,Color=teal,Step=0.001]<f>{sqrt(1-x^2)}
1805 \SimulateMonteCarlo<f>{5000}
1806 \end{GraphTikz}
1807
1808 There is \textcolor{blue}{\num{\nbptsmcok}} blue points,
1809 there is \textcolor{red}{\num{\nbptsmcko}} red points.
1810
1811 And $\frac{\num{\nbptsmcok}}{\num{\nbptsmc}}
1812 \approx \RoundNb[4]{\nbptsmcok/\nbptsmc}$
1813 et $\frac{\pi}{4} \approx \RoundNb[4]{pi/4}$.
1814 \end{tcblisting}
1815
1816 \pagebreak
1817
1818 \subsection{Some pgfplots macros}
1819
1820 In addition to pgfplots/axis, there's few \textit{simple} macros in order to work with \MontreCode{pgfplots/axis} environment.
1821
1822 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1823 %find intersection of two [name path] objects defined
1824 \findintersectionspgf[nodename baises]{object1}{object2}[\myt]
1825 %global extraction of coordinates
1826 \gextractxnodepgf{node}[\myxcoord]
1827 \gextractynodepgf{node}[\myycoord]
1828 \gextractxynodepgf{node}[\myxcoord][\myycoord]
1829 %area between curves
1830 \fillbetweencurvespgf[tikz options]{curve1}{curve2}<soft domain options>
1831 %cubic splines
1832 \addplotspline(*)[tikz options]<coeffs>{list of points}[\myspline]
1833 \end{tcblisting}
1834
1835 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
1836 %\usepackage{alphalph}
1837
1838 \begin{tikzpicture}
1839 \begin{axis}%
1840 [%
1841 axis y line=center,axis x line=middle, %axis
1842 axis line style={line width=0.8pt,-latex},
1843 x=0.33cm,y=0.55cm,xmin=1985,xmax=2030,ymin=56,ymax=70, %units
1844 grid=both,xtick distance=5,ytick distance=2, %gridp
1845 minor x tick num=4,minor y tick num=1, %grids
1846 extra x ticks={1985},extra x tick style={grid=none}, %origx
1847 extra y ticks={56},extra y tick style={grid=none}, %origy
1848 x tick label style={/pgf/number format/.cd,use comma,1000 sep={}}, %year
1849 major tick length={2*3pt},minor tick length={1.5*3pt}, %grads
1850 every tick/.style={line width=0.8pt},enlargelimits=false, %style
1851 enlarge x limits={abs=2.5mm,upper},enlarge y limits={abs=2.5mm,upper}, %énlarge
1852 ]
1853 %spline + y=66
1854 \addplot[name path global=eqtest,mark=none,red,line width=1.05pt,domain=1985:2030] {66} ;
1855 \def\LISTETEST{1985/60/0§1995/68/0§2015/58/0§2025/69/0§2030/62/-2}
1856 \addplotspline*[line width=1.05pt,violet,name path global=splinecubtest]{\LISTETEST}[\monsplineviolet]
1857 %equation f(x)=66
1858 \findintersectionspgf[MonItsc]{eqtest}{splinecubtest}
1859 %extraction of coordinates
1860 \gextractxnodepgf{(MonItsc-1)}[\xMonItscA]
1861 \gextractxnodepgf{(MonItsc-2)}[\xMonItscB]
1862 \gextractxnodepgf{(MonItsc-3)}[\xMonItscC]
1863 \gextractxnodepgf{(MonItsc-4)}[\xMonItscD]
1864 %vizualisation
1865 \xintFor* #1 in {\xintSeq{1}{4}}\do{%
1866 \draw[line width=0.9pt,densely dashed,olive,->,>=latex] (MonItsc-#1) -- (\csname xMonItsc\AlphAlph{#1}\endcsname,56) ;
1867 \filldraw[olive] (MonItsc-#1) circle[radius=1.75pt] ;
1868 }
1869 %area
1870 \path [name path=xaxis] (1985,56) -- (2030,56);
1871 \fillbetweencurvespgf{splinecubtest}{xaxis}<domain={\xMonItscB:\xMonItscA}>
1872 \fillbetweencurvespgf{splinecubtest}{xaxis}<domain={\xMonItscD:\xMonItscC}>
1873 \end{axis}
1874 \end{tikzpicture}
1875
1876 Solutions of $f(x)=66$ are \RoundNb[0]{\xMonItscA} \&\ \RoundNb[0]{\xMonItscB} \&\ \RoundNb[0]{\xMonItscC} \&\ \RoundNb[0]{\xMonItscD}.
1877 \end{tcblisting}
1878
1879 \begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,text only}
1880 \begin{tikzpicture}
1881 \begin{axis}%
1882 [%
1883 axis y line=center,axis x line=middle, %axis
1884 axis line style={line width=0.8pt,-latex},
1885 x=0.33cm,y=0.55cm,xmin=1985,xmax=2030,ymin=56,ymax=70, %units
1886 grid=both,xtick distance=5,ytick distance=2, %gridp
1887 minor x tick num=4,minor y tick num=1, %grids
1888 extra x ticks={1985},extra x tick style={grid=none}, %origx
1889 extra y ticks={56},extra y tick style={grid=none}, %origy
1890 x tick label style={/pgf/number format/.cd,use comma,1000 sep={}}, %year
1891 major tick length={2*3pt},minor tick length={1.5*3pt}, %grads
1892 every tick/.style={line width=0.8pt},enlargelimits=false, %style
1893 enlarge x limits={abs=2.5mm,upper},enlarge y limits={abs=2.5mm,upper}, %énlarge
1894 ]
1895 %spline + y=66
1896 \addplot[name path global=eqtest,mark=none,red,line width=1.05pt,domain=1985:2030] {66} ;
1897 \def\LISTETEST{1985/60/0§1995/68/0§2015/58/0§2025/69/0§2030/62/-2}
1898 \addplotspline*[line width=1.05pt,violet,name path global=splinecubtest]{\LISTETEST}[\monsplineviolet]
1899 %equation f(x)=66
1900 \findintersectionspgf[MonItsc]{eqtest}{splinecubtest}
1901 %extraction of coordinates
1902 \gextractxnodepgf{(MonItsc-1)}[\xMonItscA]
1903 \gextractxnodepgf{(MonItsc-2)}[\xMonItscB]
1904 \gextractxnodepgf{(MonItsc-3)}[\xMonItscC]
1905 \gextractxnodepgf{(MonItsc-4)}[\xMonItscD]
1906 %vizualisation
1907 \xintFor* #1 in {\xintSeq{1}{4}}\do{%
1908 \draw[line width=0.9pt,densely dashed,olive,->,>=latex] (MonItsc-#1) -- (\csname xMonItsc\AlphAlph{#1}\endcsname,56) ;
1909 \filldraw[olive] (MonItsc-#1) circle[radius=1.75pt] ;
1910 }
1911 %area
1912 \path [name path=xaxis] (1985,56) -- (2030,56);
1913 \fillbetweencurvespgf{splinecubtest}{xaxis}<domain={\xMonItscB:\xMonItscA}>
1914 \fillbetweencurvespgf{splinecubtest}{xaxis}<domain={\xMonItscD:\xMonItscC}>
1915 \end{axis}
1916 \end{tikzpicture}
1917
1918 Solutions of $f(x)=66$ are \RoundNb[0]{\xMonItscA} \&\ \RoundNb[0]{\xMonItscB} \&\ \RoundNb[0]{\xMonItscC} \&\ \RoundNb[0]{\xMonItscD}.
1919 \end{tcblisting}
1920
1921 \section{History}
1922
1923 \begin{quote}
1924 \begin{verbatim}
1925 0.30f: Bugfix + new commands (stats in [fr] version)
1926 0.30e: New commands (experimental in [fr] version)
1927 0.30d: New commands (experimental in [fr] version)
1928 0.30c: New version of code, with [en/fr] separate versions + macros for calculate
1929 ------ New commands (experimental in [fr] version)
1930 0.30b: New commands (experimental in [fr] version)
1931 0.30a: Nodes for windows and axis
1932 0.2.9: New keys for french version (work in progress)
1933 0.2.7: Ability to specify dimensions for environment (test)
1934 0.2.6: Linear inequality (work in progress)
1935 0.2.5: Lagrange interpolation ([french] for the moment) + enhancements
1936 0.2.4: Bugfix with [fr] version
1937 0.2.3: Bugfix with a length
1938 0.2.2: Bugfixes
1939 0.2.0: [Alt] key for Hermite spline + few pgfplots macros
1940 0.1.9: Bugfix
1941 0.1.8: New commands [in french doc] (binomial, cabweb,\ldots)
1942 0.1.6: Vertical asymptote + [in french doc] commands for integrals
1943 0.1.5: Initial version [en]
1944 \end{verbatim}
1945 \end{quote}
1946
1947 \end{document}