Advertisement
Guest User

Figures convexité

a guest
Sep 14th, 2019
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. % Figures de convexité par YetAnother_MT%
  3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  4.  
  5. %Préambule plutot  minimal.
  6. \documentclass[a4paper,11pt]{article}
  7.  
  8. \usepackage[utf8]{inputenc}
  9. \usepackage[T1]{fontenc}
  10. \usepackage{lmodern}
  11. \usepackage[french]{babel}
  12.  
  13. %Le package de maths de base
  14. \usepackage{amsmath}
  15. % Un paquet de symboles mathématiques
  16. \usepackage{amssymb}
  17. %Permet d'utiliser \mathscr{} pour les lettes calligraphiées
  18. \usepackage{mathrsfs}
  19.  
  20. %Permet d'utiliser l'envirronnement \begin{comment} ...\end{comment} pour faire de longs commentaires
  21. %sans utiliser %
  22. \usepackage{verbatim}
  23.  
  24. %Définition des marges du document
  25. \usepackage[top=1cm, bottom=1cm, right=1cm, left=1cm]{geometry}
  26.  
  27.  
  28. %Package de dessin avec ses sous-packages
  29. \usepackage{tikz}
  30. \usetikzlibrary{positioning}
  31. \usetikzlibrary{calc}
  32. \usetikzlibrary{babel}%compatibilité babel & pgf
  33.  
  34. \usetikzlibrary{arrows,arrows.meta}
  35. %Pour des T non italiques en mode maths
  36. \DeclareMathSymbol{T}{\mathalpha}{operators}{`T}%
  37.  
  38. \begin{document}
  39.  
  40.  
  41. %Figure 1
  42. {
  43. \begin{center}
  44. %Warning : declare function n'est pas compatible avec certains container genre parbox
  45. % ca provoque plein d'erreurs dures à déchiffrer.
  46. % Si c'est incontournable, il faut virer declare et mettre les expressions correspondantes
  47. %dans le reste du code.
  48. \begin{tikzpicture}[x=1cm,y=1cm,declare function={ f(\x)= 0.4*(.8*\x-1.6)^2+1;
  49.                   fprime(\x)     = 2*0.4*.8*(.8*\x-1.6);}]
  50.  
  51. \tikzstyle{every node}=[font=\footnotesize]
  52.  
  53. \pgfmathsetmacro{\xmin}{-1}
  54. \pgfmathsetmacro{\ymin}{-1}
  55. \pgfmathsetmacro{\xmax}{7}
  56. \pgfmathsetmacro{\ymax}{5}
  57.  
  58.  
  59. \pgfmathsetmacro{\xA}{1}
  60. \pgfmathsetmacro{\xB}{4.5}
  61. \pgfmathsetmacro{\yA}{f(\xA)}
  62. \pgfmathsetmacro{\yB}{f(\xB)}
  63. \pgfmathsetmacro{\t}{.6}
  64. \pgfmathsetmacro{\xT}{\t*\xA+(1-\t)*\xB}
  65. \pgfmathsetmacro{\yT}{f(\xT)}
  66. \pgfmathsetmacro{\yTS}{\t*\yA+(1-\t)*\yB}
  67.  
  68. \pgfmathsetmacro{\tA}{fprime(\xA)}
  69. \pgfmathsetmacro{\tT}{fprime(\xT)}
  70. \pgfmathsetmacro{\tB}{fprime(\xB)}
  71.  
  72. %Axes
  73. \draw[>={angle 60},thick,->,color=black] (\xmin,0) -- (\xmax,0) node[above] {$x$} node[below] {$\mathbb{R}$};
  74. \draw[>={angle 60},thick,->,color=black] (0,\ymin) -- (0,\ymax) node[right] {$y$} node[left] {$\mathbb{R}$};
  75.  
  76.  
  77.  
  78. \begin{scope}
  79. %Pour pas que la courbe deborde du cadre.
  80. \clip(\xmin,\ymin) rectangle (\xmax,\ymax);
  81. \draw[thick,smooth,samples=100,domain=\xmin:\xmax] plot(\x,{f(\x)});
  82. %Malheureusement lui il faut le placer à la main :
  83. \node () at (5.4,4.7) {$\mathscr{C}_f$};
  84. \end{scope}
  85.  
  86.  
  87. %Les coches dans l'axe des abscisses et les labels.
  88. \draw[thick,shift={(\xA,0)},color=red] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}a$};
  89. \draw[thick,shift={(\xB,0)},color=red] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}b$};
  90. \draw[thick,shift={(\xT,0)},color=black] (0,0.05) -- (0,-0.05) node[below] {$ta+(1-t)b$};
  91.  
  92.  
  93.  
  94. %Les sécantes
  95. \draw[thick,color=red] (\xA,\yA) --node[pos=.5] (CS) {}  (\xB,\yB);
  96.  
  97.  
  98. %Les pointillés pour les points barycentres
  99. \draw[thick,dashed,color=black] (\xT,0) -- (\xT,\yTS);
  100. \draw[thick,dashed,color=black]  (\xT,\yT) -- (0,\yT) node[left] {$f(ta+(1-t)b)$};
  101. \draw[thick,dashed,color=black] (\xT,\yTS)  -- (0,\yTS) node[left] {$tf(a)+(1-t)f(b)$};
  102.  
  103.  
  104.  
  105. %Les 4 points
  106. \draw[fill,color=red] (\xA,\yA) circle (2pt);
  107. \draw[fill,color=red] (\xB,\yB) circle (2pt);
  108. \draw[fill,color=black] (\xT,\yT) circle (2pt);
  109. \draw[fill,color=black] (\xT,\yTS) circle (2pt);
  110.  
  111.  
  112.  
  113. \end{tikzpicture}
  114.  
  115. \end{center}
  116.  
  117. }
  118.  
  119.  
  120. %Figure 2
  121. {
  122. \begin{center}
  123.  
  124. %Warning : declare function n'est pas compatible avec certains container genre parbox
  125. % ca provoque plein d'erreurs dures à déchiffrer.
  126. % Si c'est incontournable, il faut virer declare et mettre les expressions correspondantes
  127. %dans le reste du code.
  128. \begin{tikzpicture}[x=1cm,y=1cm,declare function={ f(\x)= 0.4*(.8*\x-1.6)^2+1;
  129.                   fprime(\x)     = 2*0.4*.8*(.8*\x-1.6);}]
  130.  
  131. \tikzstyle{every node}=[font=\footnotesize]
  132.  
  133. \pgfmathsetmacro{\xmin}{-1}
  134. \pgfmathsetmacro{\ymin}{-1}
  135. \pgfmathsetmacro{\xmax}{7}
  136. \pgfmathsetmacro{\ymax}{5}
  137.  
  138.  
  139. \pgfmathsetmacro{\xA}{1}
  140. \pgfmathsetmacro{\xB}{4}
  141. \pgfmathsetmacro{\yA}{f(\xA)}
  142. \pgfmathsetmacro{\yB}{f(\xB)}
  143.  
  144. \pgfmathsetmacro{\tA}{fprime(\xA)}
  145. \pgfmathsetmacro{\tB}{fprime(\xB)}
  146.  
  147. %Axes
  148. \draw[>={angle 60},thick,->,color=black] (\xmin,0) -- (\xmax,0) node[above] {$x$} node[below] {$\mathbb{R}$};
  149. \draw[>={angle 60},thick,->,color=black] (0,\ymin) -- (0,\ymax) node[right] {$y$} node[left] {$\mathbb{R}$};
  150.  
  151.  
  152.  
  153. \begin{scope}
  154. %Pour pas que la courbe deborde du cadre.
  155. \clip(\xmin,\ymin) rectangle (\xmax,\ymax);
  156. \draw[thick,smooth,samples=100,domain=\xmin:\xmax] plot(\x,{f(\x)}) ;
  157. \node () at (5.4,4.7) {$\mathscr{C}_f$};
  158. \end{scope}
  159.  
  160.  
  161. %Les coches dans l'axe des abscisses et les labels.
  162. \draw[thick,shift={(\xA,0)},color=red] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}a$};
  163. \draw[thick,shift={(\xB,0)},color=red] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}b$};
  164.  
  165.  
  166.  
  167. %Les sécantes
  168. \draw[thick,color=red] (\xA,\yA) --node[pos=.5] (CS) {} (\xB,\yB);
  169.  
  170.  
  171. %Fleches donnant les pentes, orientation angulaire à partir du point de contact marqué, sans coller au point de contact (le .2)
  172. \draw[>=stealth,thick, <-,color=red] ($(CS) + (90:.2)$) -- +(90:1.5) node[above] {Pente $\dfrac{f(b)-f(a)}{b-a}$};
  173.  
  174.  
  175. %Les tangentes
  176.  
  177. \draw[thick] ($(\xA,\yA) - 1.5*(1,\tA)$) --node[pos=.1,below left] {$T_a$} node[pos=.8] (CA) {} ($(\xA,\yA) + (1,\tA)$);
  178. \draw[thick] ($(\xB,\yB) - (1,\tB)$) --node[pos=.1,below right] {$T_b$} node[pos=.8] (CB) {} ($(\xB,\yB) + (1,\tB)$);
  179.  
  180.  
  181. %Fleches donnant les pentes, orientation angulaire à partir du point de contact marqué, sans coller au point de contact (le .2)
  182. \draw[>=stealth,thick, <-] ($(CA) + (-90:.2)$) -- +(-90:1.5) node[below] {Pente $f'(a)$};
  183. \draw[>=stealth,thick, <-] ($(CB) + (20:.2)$) -- +(20:1.5) node[right] {Pente $f'(b)$};
  184.  
  185.  
  186. %Les points
  187. \draw[fill,color=red] (\xA,\yA) circle (2pt);
  188. \draw[fill,color=red] (\xB,\yB) circle (2pt);
  189.  
  190.  
  191.  
  192. \end{tikzpicture}
  193.  
  194. \end{center}
  195. }
  196.  
  197. %Figure 3
  198. {
  199. \begin{center}
  200.  
  201. %Warning : declare function n'est pas compatible avec certains container genre parbox
  202. % ca provoque plein d'erreurs dures à déchiffrer.
  203. % Si c'est incontournable, il faut virer declare et mettre les expressions correspondantes
  204. %dans le reste du code.
  205. \begin{tikzpicture}[x=1cm,y=1cm,declare function={ f(\x)= 0.4*(.8*\x-1.6)^2+1;
  206.                   fprime(\x)     = 2*0.4*.8*(.8*\x-1.6);}]
  207.  
  208. \tikzstyle{every node}=[font=\footnotesize]
  209.  
  210. \pgfmathsetmacro{\xmin}{-1}
  211. \pgfmathsetmacro{\ymin}{-1}
  212. \pgfmathsetmacro{\xmax}{7}
  213. \pgfmathsetmacro{\ymax}{5}
  214.  
  215.  
  216. \pgfmathsetmacro{\xA}{2.5}
  217. \pgfmathsetmacro{\yA}{f(\xA)}
  218.  
  219. \pgfmathsetmacro{\tA}{fprime(\xA)}
  220.  
  221. %Axes
  222. \draw[>={angle 60},thick,->,color=black] (\xmin,0) -- (\xmax,0) node[above] {$x$} node[below] {$\mathbb{R}$};
  223. \draw[>={angle 60},thick,->,color=black] (0,\ymin) -- (0,\ymax) node[right] {$y$} node[left] {$\mathbb{R}$};
  224.  
  225.  
  226.  
  227. \begin{scope}
  228. %Pour pas que la courbe deborde du cadre.
  229. \clip(\xmin,\ymin) rectangle (\xmax,\ymax);
  230. \draw[thick,smooth,samples=100,domain=\xmin:\xmax] plot(\x,{f(\x)});
  231. %Malheureusement lui il faut le placer à la main :
  232. \node () at (5.4,4.7) {$\mathscr{C}_f$};
  233. \end{scope}
  234.  
  235.  
  236. %Les coches dans l'axe des abscisses et les labels.
  237. \draw[thick,shift={(\xA,0)},color=black] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}a$};
  238.  
  239. %Les tangentes
  240.  
  241. \draw[thick] ($(\xA,\yA) - 3*(1,\tA)$) --node[pos=.95,below] {$T_a$} node[pos=.8] (CA) {} ($(\xA,\yA) + 3*(1,\tA)$);
  242.  
  243. %\draw[>=stealth,thick, <-] ($(CA) + (-90:.2)$) -- +(-90:1.5) node[below] {Pente $f'(a)$};
  244.  
  245. %Le point
  246. \draw[fill,color=black] (\xA,\yA) circle (2pt);
  247.  
  248. \end{tikzpicture}
  249.  
  250. \end{center}
  251. }
  252.  
  253. %Figure 4
  254. {
  255. \begin{center}
  256.  
  257. %Warning : declare function n'est pas compatible avec certains container genre parbox
  258. % ca provoque plein d'erreurs dures à déchiffrer.
  259. % Si c'est incontournable, il faut virer declare et mettre les expressions correspondantes
  260. %dans le reste du code.
  261. \begin{tikzpicture}[x=1cm,y=1cm,declare function={ f(\x)= 0.4*(.8*\x-1.6)^2+1;
  262.                   fprime(\x)     = 2*0.4*.8*(.8*\x-1.6);}]
  263.  
  264. \tikzstyle{every node}=[font=\footnotesize]
  265.  
  266. \pgfmathsetmacro{\xmin}{-1}
  267. \pgfmathsetmacro{\ymin}{-1}
  268. \pgfmathsetmacro{\xmax}{7}
  269. \pgfmathsetmacro{\ymax}{5}
  270.  
  271.  
  272. \pgfmathsetmacro{\xA}{1}
  273. \pgfmathsetmacro{\xB}{4.5}
  274. \pgfmathsetmacro{\yA}{f(\xA)}
  275. \pgfmathsetmacro{\yB}{f(\xB)}
  276. \pgfmathsetmacro{\t}{.6}
  277. \pgfmathsetmacro{\xT}{\t*\xA+(1-\t)*\xB}
  278. \pgfmathsetmacro{\yT}{f(\xT)}
  279.  
  280. \pgfmathsetmacro{\tA}{fprime(\xA)}
  281. \pgfmathsetmacro{\tT}{fprime(\xT)}
  282. \pgfmathsetmacro{\tB}{fprime(\xB)}
  283.  
  284. %Axes
  285. \draw[>={angle 60},thick,->,color=black] (\xmin,0) -- (\xmax,0) node[above] {$x$} node[below] {$\mathbb{R}$};
  286. \draw[>={angle 60},thick,->,color=black] (0,\ymin) -- (0,\ymax) node[right] {$y$} node[left] {$\mathbb{R}$};
  287.  
  288.  
  289.  
  290. \begin{scope}
  291. %Pour pas que la courbe deborde du cadre.
  292. \clip(\xmin,\ymin) rectangle (\xmax,\ymax);
  293. \draw[thick,smooth,samples=100,domain=\xmin:\xmax] plot(\x,{f(\x)});
  294. %Malheureusement lui il faut le placer à la main :
  295. \node () at (5.4,4.7) {$\mathscr{C}_f$};
  296. \end{scope}
  297.  
  298.  
  299. %Les coches dans l'axe des abscisses et les labels.
  300. \draw[thick,shift={(\xA,0)},color=red] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}a$};
  301. \draw[thick,shift={(\xB,0)},color=red] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}b$};
  302. \draw[thick,shift={(\xT,0)},color=red] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}c$};
  303.  
  304.  
  305.  
  306. %Les sécantes
  307. \draw[thick,color=red] (\xA,\yA) --node[pos=.5] (CS1) {} (\xT,\yT) --node[pos=.5] (CS2) {} (\xB,\yB);
  308.  
  309.  
  310. %Fleches donnant les pentes, orientation angulaire à partir du point de contact marqué, sans coller au point de contact (le .2 ou .1)
  311. \draw[>=stealth,thick, <-,color=red] ($(CS1) + (90:.2)$) -- +(90:1.5) node[above] {Pente $\dfrac{f(c)-f(a)}{c-a}$};
  312. \draw[>=stealth,thick, <-,color=red] ($(CS2) + (-10:.1)$) -- +(-10:1.5) node[right] {Pente $\dfrac{f(b)-f(c)}{b-c}$};
  313.  
  314.  
  315. %Les tangentes
  316. \draw[thick] ($(\xT,\yT) - 2*(1,\tT)$) -- node[pos=.9,below right] {$T_c$} node[pos=.2] (CT) {} ($(\xT,\yT) + 2*(1,\tT)$);
  317. \draw[>=stealth,thick, <-] ($(CT) + (-70:.2)$) -- +(-70:2) node[below] {Pente $f'(c)$};
  318.  
  319.  
  320. %Les points
  321. \draw[fill,color=red] (\xA,\yA) circle (2pt);
  322. \draw[fill,color=red] (\xB,\yB) circle (2pt);
  323. \draw[fill,color=red] (\xT,\yT) circle (2pt);
  324.  
  325. \end{tikzpicture}
  326.  
  327. \end{center}
  328. }
  329.  
  330. %La figure de référence qui contient un peu tout, en commentaire.
  331. \begin{comment}
  332. {
  333. \begin{center}
  334.  
  335. %Warning : declare function n'est pas compatible avec certains container genre parbox
  336. % ca provoque plein d'erreurs dures à déchiffrer.
  337. % Si c'est incontournable, il faut virer declare et mettre les expressions correspondantes
  338. %dans le reste du code.
  339. \begin{tikzpicture}[x=1cm,y=1cm,declare function={ f(\x)= 0.4*(.8*\x-1.6)^2+1;
  340.                   fprime(\x)     = 2*0.4*.8*(.8*\x-1.6);}]
  341.  
  342. \tikzstyle{every node}=[font=\footnotesize]
  343.  
  344. \pgfmathsetmacro{\xmin}{-1}
  345. \pgfmathsetmacro{\ymin}{-1}
  346. \pgfmathsetmacro{\xmax}{7}
  347. \pgfmathsetmacro{\ymax}{5}
  348.  
  349.  
  350. \pgfmathsetmacro{\xA}{1}
  351. \pgfmathsetmacro{\xB}{4.5}
  352. \pgfmathsetmacro{\yA}{f(\xA)}
  353. \pgfmathsetmacro{\yB}{f(\xB)}
  354. \pgfmathsetmacro{\t}{.6}
  355. \pgfmathsetmacro{\xT}{\t*\xA+(1-\t)*\xB}
  356. \pgfmathsetmacro{\yT}{f(\xT)}
  357. \pgfmathsetmacro{\yTS}{\t*\yA+(1-\t)*\yB}
  358.  
  359. \pgfmathsetmacro{\tA}{fprime(\xA)}
  360. \pgfmathsetmacro{\tT}{fprime(\xT)}
  361. \pgfmathsetmacro{\tB}{fprime(\xB)}
  362.  
  363. %Axes
  364. \draw[>={angle 60},thick,->,color=black] (\xmin,0) -- (\xmax,0) node[above] {$x$} node[below] {$\mathbb{R}$};
  365. \draw[>={angle 60},thick,->,color=black] (0,\ymin) -- (0,\ymax) node[right] {$y$} node[left] {$\mathbb{R}$};
  366.  
  367.  
  368.  
  369. \begin{scope}
  370. %Pour pas que la courbe deborde du cadre.
  371. \clip(\xmin,\ymin) rectangle (\xmax,\ymax);
  372. \draw[thick,smooth,samples=100,domain=\xmin:\xmax] plot(\x,{f(\x)});
  373. %Malheureusement lui il faut le placer à la main :
  374. \node () at (5.4,4.7) {$\mathscr{C}_f$};
  375. \end{scope}
  376.  
  377.  
  378. %Les coches dans l'axe des abscisses et les labels.
  379. \draw[thick,shift={(\xA,0)},color=red] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}a$};
  380. \draw[thick,shift={(\xB,0)},color=red] (0,0.05) -- (0,-0.05) node[below] {$\vphantom{(t)}b$};
  381. \draw[thick,shift={(\xT,0)},color=black] (0,0.05) -- (0,-0.05) node[below] {$ta+(1-t)b$};
  382.  
  383.  
  384.  
  385. %Les sécantes
  386. \draw[thick,color=red] (\xA,\yA) --node[pos=.5] (CS) {}  (\xB,\yB);
  387. \draw[thick,color=red] (\xA,\yA) -- (\xT,\yT) -- (\xB,\yB);
  388. \draw[>=stealth,thick, <-,color=red] ($(CS) + (90:.2)$) -- +(90:1.5) node[above] {Pente $\dfrac{f(b)-f(a)}{b-a}$};
  389.  
  390.  
  391. %Les pointillés pour les points barycentres
  392. \draw[thick,dashed,color=black] (\xT,0) -- (\xT,\yTS);
  393. \draw[thick,dashed,color=black]  (\xT,\yT) -- (0,\yT) node[left] {$f(ta+(1-t)b)$};
  394. \draw[thick,dashed,color=black] (\xT,\yTS)  -- (0,\yTS) node[left] {$tf(a)+(1-t)f(b)$};
  395.  
  396. %Les tangentes
  397.  
  398. \draw[thick] ($(\xA,\yA) - 1.5*(1,\tA)$) --node[pos=.1,below left] {$T_a$} node[pos=.8] (CA) {} ($(\xA,\yA) + (1,\tA)$);
  399. \draw[thick] ($(\xB,\yB) - (1,\tB)$) --node[pos=.1,below right] {$T_b$} node[pos=.8] (CB) {} ($(\xB,\yB) + (1,\tB)$);
  400. \draw[thick] ($(\xT,\yT) - 3*(1,\tT)$) -- node[pos=.9,below] {$T_t$} node[pos=.2] (CT) {} ($(\xT,\yT) + 3*(1,\tT)$);
  401.  
  402. %Fleches donnant les pentes, orientation angulaire à partir du point de contact marqué, sans coller au point de contact (le .2)
  403. \draw[>=stealth,thick, <-] ($(CT) + (-70:.2)$) -- +(-70:2) node[below] {\shortstack{Pente\\ $\dfrac{f(b)-f(a)}{b-a}$}};
  404. \draw[>=stealth,thick, <-] ($(CA) + (-90:.2)$) -- +(-90:1.5) node[below] {Pente $f'(a)$};
  405. \draw[>=stealth,thick, <-] ($(CB) + (20:.2)$) -- +(20:1.5) node[right] {Pente $f'(b)$};
  406.  
  407.  
  408.  
  409. %Les 4 points
  410. \draw[fill,color=red] (\xA,\yA) circle (2pt);
  411. \draw[fill,color=red] (\xB,\yB) circle (2pt);
  412. \draw[fill,color=black] (\xT,\yT) circle (2pt);
  413. \draw[fill,color=black] (\xT,\yTS) circle (2pt);
  414.  
  415. \end{tikzpicture}
  416.  
  417. \end{center}
  418. }
  419. \end{comment}
  420.  
  421. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement