summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-fct/doc/latex/TKZdoc-fct-point.tex
blob: cd9ca26441f05743706a554337ecc1fddbeccbc0 (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
%!TEX root = /Users/ego/Boulot/TKZ/tkz-fct/doc-fr/TKZdoc-fct-main.tex   

\section{Placer un point sur une courbe} \hypertarget{tptfct}{} 

\begin{NewMacroBox}{tkzDefPointByFct}{\parg{$decimal number$}} 
\emph{Cette macro permet de calculer l'image par la fonction définie précédemment, d'un nombre décimal.}

\medskip
\begin{tabular}{lll}
 \toprule
 argument             & exemple & explication                         \\ 
 \midrule
 \TAline{decimal number}{\tkzcname{tkzDefPointByFct(0)}}{définit un point d'abscisse $0$} 
 \bottomrule
\end{tabular}

\begin{tabular}{lll}
 option             & defaut & explication                         \\ 
 \midrule
 \TOline{draw}{false}{permet de tracer le point avec le style courant} 
 \TOline{with}{a}{permet de choisir la fonction}
 \TOline{ref}{empty}{permet de donner une référence au point}
 \bottomrule
\end{tabular}

\emph{C'est donc la dernière fonction définie qui est utilisée. Si une autre fonction, est utilisée alors il faut utiliser l'ancienne macro \tkzcname{tkzFctPt}. Le point est défini sous un nom générique \tkzname{tkzPointResult} mais non tracé. Afin de le tracer il faut utiliser la macro \tkzcname{tkzDrawPoint}.}
\end{NewMacroBox}

\subsection{Exemple avec \tkzcname{tkzGetPoint}}
Cela permet de référencer le point créé par \tkzcname{tkzDefPointByFct}.

\begin{center}
\begin{tkzexample}[vbox]
\begin{tikzpicture}[scale=1.25]
  \tkzInit[xmin=-2,xmax=2,xstep=1,
           ymin=-8,ymax=24,ystep=8]
  \tkzGrid  \tkzAxeXY
  \tkzFct[domain =-1.5:1]{3.0-1.3125*x**5-2.5*x**3} 
  \tkzDefPointByFct(.5)  \tkzGetPoint{A}\tkzDrawPoint(A)
  \tkzLabelPoint[above right](A){$A_0$}
\end{tikzpicture} 
\end{tkzexample}
\end{center}


\newpage
\subsection{Exemple avec \tkzcname{tkzGetPoint} et \tkzname{tkzPointResult}}
Il est possible de ne pas référencer le point et d'utiliser la référence générique.

\begin{tkzexample}[latex=7cm,small] 
\begin{tikzpicture}[scale=1.25]
  \tkzInit[xmin=-2,xmax=2,xstep=1,
           ymin=-8,ymax=24,ystep=8]
  \tkzGrid
  \tkzAxeXY
  \tkzFct[domain =-1.5:1]{3.0-1.3125*x**5-2.5*x**3} 
  \tkzDefPointByFct(.5)
  \tkzDrawPoint(tkzPointResult)
  % ou bien \tkzDefPointByFct[draw](.5) 
\end{tikzpicture}
\end{tkzexample}

\subsection{Options \tkzname{draw} et \tkzname{ref}} 
Cela permet de tracer un point directement avec les options usuelles donc sans possibilités de personnaliser et d'attribuer une référence à ce point.

\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=1.25]
  \tkzInit[xmin=-2,xmax=2,xstep=1,
           ymin=-8,ymax=24,ystep=8]
  \tkzGrid
  \tkzAxeXY
  \tkzFct[domain =-1.5:1]{3.0-1.3125*x**5-2.5*x**3}
  \tkzDefPointByFct[draw,ref=A](.5)
  \tkzLabelPoint[above right](A){$a$}
\end{tikzpicture} 
\end{tkzexample} 

\newpage
\subsection{Placer des points sans courbe} 
Attention, ceci est délicat. Il suffit de définir la macro \tkzcname{tkzFctLast} qui est la dernière expression traduite avec la syntaxe de \tkzname{fp.sty}. Les points sont donc déterminer avec \tkzname{fp.sty}.
  
\begin{tkzexample}[]
\begin{tikzpicture}[xscale=3,yscale=2]
  \tkzInit[xmin=-2,xmax=2,xstep=1,
           ymin=-8,ymax=24,ystep=8]
  \tkzGrid
  \tkzAxeXY 
  \global\edef\tkzFctLast{3.0-1.3125*x^5-2.5*x^3}
  \foreach \va in {-1.5,-1.4,...,1}{%
      \tkzDefPointByFct[draw](\va)}
\end{tikzpicture} 
\end{tkzexample}
  
\newpage\null
\subsection{Placer des points sans se soucier des coordonnées}

Cette fois le domaine s'étend de 0 à 800, les valeurs prises par la fonction de $0$ à $\numprint{2000}$. \tkzname{xstep=100} donc il faut utliser |\x| à la place de $x$. Une petite astuce au niveau de gnuplot, 1. et 113. permettent d'obtenir une division dans les décimaux sinon la division se fait dans les entiers.

Ensuite, j'utilise les macros pour placer des points

\begin{tkzexample}[]
\begin{tikzpicture}[scale=1.6]
  \tkzInit[xmin  = 0,  xmax  = 800,
           ymin  = 0,  ymax  = 2000,
           xstep = 100,ystep = 400]
  \tkzGrid
  \tkzAxeXY
  \tkzFct[color  = blue, 
          domain = 0:800]%
        {(1./90000)*\x*\x*\x-(1./100)*\x*\x+(113./36)*\x}
  \foreach \va in {0,450,800}{%
     \tkzDefPointByFct[draw](\va)}
\end{tikzpicture}
\end{tkzexample}

\newpage
\subsection{Placer des points avec deux fonctions}

\medskip
Revoir \tkzcname{tkzSetUpPoint}  et \tkzcname{tkzText} du module \tkzname{tkz-base.sty}


\begin{tkzexample}[code only]
\begin{tikzpicture}[scale=4]
  \tkzInit[xmax=3,ymax=2]
  \tkzAxeX
  \tkzAxeY
  \tkzGrid(0,0)(3,2)
  \tkzFct[color = red,domain = 1./3:3]{0.125*(3*x-1)+0.375*(3*x-1)/(x*x)}
  \tkzFct[color = green,domain = 1./3:3]{0.125*(3*x-1)}
  \tkzSetUpPoint[shape=circle,  size = 10, color=black, fill=lightgray]
  \tkzDefPointByFct[draw,with = a](1) 
  \tkzDefPointByFct[draw,with = a](2)
  \tkzDefPointByFct[draw,with = a](3)
  \tkzDefPointByFct[draw,with = b](3)
  \tkzDefPointByFct[draw,with = b](1/3)
  \tkzText[draw,color= red,fill=red!20](1,1.5) %
          {$f(x)=\frac{1}{8}(3x-1)+\frac{3}{8}%
           \left(\frac{3x-1}{x^2}\right)$}
  \tkzText[draw,color= green!50!black,fill=green!20]%
               (2,0.3){$g(x)=\frac{1}{8}(3x-1)$}
\end{tikzpicture}
\end{tkzexample}

\begin{tikzpicture}[scale=4]
  \tkzInit[xmax=3,ymax=2]
  \tkzAxeX
  \tkzAxeY
  \tkzGrid(0,0)(3,2)
  \tkzFct[color = red,domain = 1./3:3]{0.125*(3*x-1)+0.375*(3*x-1)/(x*x)}
  \tkzFct[color = green,domain = 1./3:3]{0.125*(3*x-1)}
  \tkzSetUpPoint[shape=circle,  size = 10, color=black, fill=lightgray]
  \tkzDefPointByFct[draw,with = a](1) 
  \tkzDefPointByFct[draw,with = a](2)
  \tkzDefPointByFct[draw,with = a](3)
  \tkzDefPointByFct[draw,with = b](3)
  \tkzDefPointByFct[draw,with = b](1/3)
  \tkzText[draw,color= red,fill=red!20](1,1.5) %
          {$f(x)=\frac{1}{8}(3x-1)+\frac{3}{8}%
           \left(\frac{3x-1}{x^2}\right)$}
  \tkzText[draw,color= green!50!black,fill=green!20]%
               (2,0.3){$g(x)=\frac{1}{8}(3x-1)$}
\end{tikzpicture}  

\endinput