summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-07-14 03:01:29 +0000
committerNorbert Preining <norbert@preining.info>2024-07-14 03:01:29 +0000
commitf88f57b5ff1f3fdc0d1e8e6b5ee1bd93f5b054a8 (patch)
treeb7e4be0089afa2e42c73cf1616c09616ce72de24 /graphics
parent6d99d1d1b202753303b6430d12763206fb734a97 (diff)
CTAN sync 202407140301
Diffstat (limited to 'graphics')
-rw-r--r--graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.pdfbin746493 -> 1222359 bytes
-rw-r--r--graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.tex84
-rw-r--r--graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.pdfbin804095 -> 1309490 bytes
-rw-r--r--graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.tex146
-rw-r--r--graphics/pgf/contrib/tkz-grapheur/tex/tkz-grapheur.sty179
5 files changed, 341 insertions, 68 deletions
diff --git a/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.pdf b/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.pdf
index 6ef7f59476..029671719e 100644
--- a/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.pdf
+++ b/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.tex b/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.tex
index 88e9abb16a..d89c17bff4 100644
--- a/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.tex
+++ b/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-en.tex
@@ -29,8 +29,8 @@
\hypersetup{pdfborder=0 0 0}
\usepackage[margin=2cm]{geometry}
\setlength{\parindent}{0pt}
-\def\TPversion{0.1.5}
-\def\TPdate{22/06/2024}
+\def\TPversion{0.1.6}
+\def\TPdate{13/07/2024}
\usepackage{soul}
\usepackage{codehigh}
\usepackage{tabularray}
@@ -532,7 +532,7 @@ The mandatory arguments correspond to the x-coordinates (in \TikZ\ language) and
\subsection{Draw a line}\label{tracstraight}
-The idea is to propose a command to draw a line, from:
+The idea is to propose a command to draw a line (or an asymptote), from:
\begin{itemize}
\item of two points (or nodes);
@@ -542,6 +542,7 @@ The idea is to propose a command to draw a line, from:
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
%in the GraphiqueTikz environment
\DrawLine[keys]{point or node}{point or node or slope}
+\DrawAsymptote[keys]{x value}
\end{tcblisting}
The optional \MontreCode{[keys]} available are:
@@ -564,6 +565,7 @@ The optional \MontreCode{[keys]} available are:
\DrawLine[Color=red]{(-2,-1)}{(2,4)}
\DrawLine[Color=blue,Start=-5,End=3]{(A)}{(B)}
\DrawLine[Color=olive,Slope]{(C)}{0.25}
+ \DrawAsymptote[Color=brown]{-6}
\end{GraphTikz}
\end{tcblisting}
@@ -1396,7 +1398,7 @@ The last mandatory argument is the work point (abscissa version or node followin
\section{Commands specific to two-variable statistics}
-\subsection{The point cloud}\label{scatter}
+\subsection{The point scatter}\label{scatter}
In addition to commands linked to functions, it is also possible to represent double statistical series.
@@ -1490,7 +1492,7 @@ In partnership with the \MontreCode{xint-regression} package, loaded by the pack
The command, similar to that of defining a curve, is:
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
-\DrawRegression[keys]<no fct>{type}<rounded>{listex}{listey}
+\DrawRegression[keys]<name fct>{type}<rounded>{listex}{listey}
\end{tcblisting}
The \MontreCode{[keys]} available are, classically:
@@ -1651,53 +1653,30 @@ $\begin{cases}
\gamma \approx \RoundNb[0]{\Cgamma}
\end{cases}$.
\end{tcblisting}
-%
-%\newpage
-%
-%\section{Liste des commandes}
-%
-%Les commandes disponibles sont :
-%
-%\NewDocumentCommand\lstcmd{ m m m }{%
-% \item[\texttt{#1}] : \mintinline{latex}|#2|\hfill{}page \pageref{#3}
-%}
-%
-%\begin{description}
-% \lstcmd{environnement~~}{\begin{GraphiqueTikz}...\end{GraphiqueTikz}}{creaenvt}
-% \lstcmd{axes et grilles}{\TracerAxesGrille}{creaaxesgr}
-% \lstcmd{aj val axes X~~}{\RajouterValeursAxeX}{ajoutvals}
-% \lstcmd{aj val axes Y~~}{\RajouterValeursAxeY}{ajoutvals}
-% \lstcmd{def fonction~~~}{\DefineCurve}{deftracfct}
-% \lstcmd{tracé courbe~~~}{\DrawCurve}{deftracfct}
-% \lstcmd{def interpo~~~~}{\DefineCurveInterpo}{deftracinterpo}
-% \lstcmd{tracé interpo~~}{\DrawCurveInterpo}{deftracinterpo}
-% \lstcmd{def spline~~~~~}{\DefineSplineCurve}{deftracfctspline}
-% \lstcmd{tracé spline~~~}{\DrawSplineCurve}{deftracfctspline}
-% \lstcmd{tracé droite~~~}{\TracerDroite}{tracdroite}
-% \lstcmd{def points~~~~~}{\DefinirPts}{defpts}
-% \lstcmd{def image~~~~~~}{\DefinirImage}{defpts}
-% \lstcmd{marq pts~~~~~~~}{\MarquerPts}{markpts}
-% \lstcmd{placer txt~~~~~}{\PlacerTexte}{placetxt}
-% \lstcmd{récup absc~~~~~}{\RecupererAbscisse}{recupcoordo}
-% \lstcmd{récup ordo~~~~~}{\RecupererOrdonnee}{recupcoordo}
-% \lstcmd{récup coordos~~}{\RecupererCoordonnees}{recupcoordo}
-% \lstcmd{images~~~~~~~~~}{\PlacerImages}{images}
-% \lstcmd{antécédents~~~~}{\TrouverAntecedents}{defanteced}
-% \lstcmd{antécédents~~~~}{\PlacerAntecedents}{tracanteced}
-% \lstcmd{intersection~~~}{\TrouverIntersections}{intersect}
-% \lstcmd{maximum~~~~~~~~}{\TrouverMaximum}{maximum}
-% \lstcmd{minimum~~~~~~~~}{\TrouverMinimum}{minimum}
-% \lstcmd{intégrale~~~~~~}{\DrawIntegral}{integr}
-% \lstcmd{tangente~~~~~~~}{\DrawTangente}{tgte}
-% \lstcmd{loi normale~~~~}{\DefinirLoiNormale}{loinormale}
-% \lstcmd{loi normale~~~~}{\TracerLoiNormale}{loinormale}
-% \lstcmd{loi khideux~~~~}{\DefinirLoiKhiDeux}{loikhideux}
-% \lstcmd{loi khideux~~~~}{\TracerLoiKhiDeux}{loikhideux}
-% \lstcmd{stats 2 var~~~~}{\TracerNuage}{nuage}
-% \lstcmd{regressions~~~~}{\TracerAjustement}{regressions}
-% \lstcmd{arrondi~~~~~~~~}{\RoundNb}{numarrond}
-% \lstcmd{nb aléat~~~~~~~}{\ChoisirNbAlea}{nbalea}
-%\end{description}
+
+\subsection{Monte-Carle method}
+
+\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
+%in the GraphiqueTikz environment
+\SimulateMonteCarlo[keys]<function>}{number of points}[\nbptsmcok][\nbptsmcko]
+\end{tcblisting}
+
+\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
+\begin{GraphTikz}%
+ [x=10cm,y=10cm,Xmin=0,Xmax=1,Xgrid=0.1,Xgrids=0.05,
+ Ymin=0,Ymax=1,Ygrid=0.1,Ygrids=0.05]
+ \DrawAxisGrids[Enlarge=2.5mm,Last]{auto}{auto}
+ \DefineCurve[Trace,Color=teal,Step=0.001]<f>{sqrt(1-x^2)}
+ \SimulateMonteCarlo<f>{5000}
+\end{GraphTikz}
+
+There is \textcolor{blue}{\num{\nbptsmcok}} blue points,
+there is \textcolor{red}{\num{\nbptsmcko}} red points.
+
+And $\frac{\num{\nbptsmcok}}{\num{\nbptsmc}}
+\approx \RoundNb[4]{\nbptsmcok/\nbptsmc}$
+et $\frac{\pi}{4} \approx \RoundNb[4]{pi/4}$.
+\end{tcblisting}
\pagebreak
@@ -1705,6 +1684,7 @@ $\begin{cases}
\begin{quote}
\begin{verbatim}
+0.1.6 : Vertical asymptote + [in french doc] commands for integrals
0.1.5 : Initial version [en]
\end{verbatim}
\end{quote}
diff --git a/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.pdf b/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.pdf
index c53d69179c..ba330fa444 100644
--- a/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.pdf
+++ b/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.tex b/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.tex
index 9ea6b13200..99d8414cd0 100644
--- a/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.tex
+++ b/graphics/pgf/contrib/tkz-grapheur/doc/tkz-grapheur-doc-fr.tex
@@ -29,8 +29,8 @@
\hypersetup{pdfborder=0 0 0}
\usepackage[margin=2cm]{geometry}
\setlength{\parindent}{0pt}
-\def\TPversion{0.1.5}
-\def\TPdate{22/06/2024}
+\def\TPversion{0.1.6}
+\def\TPdate{13/07/2024}
\usepackage{soul}
\usepackage{codehigh}
\usepackage{tabularray}
@@ -39,7 +39,7 @@
\hl{\vphantom{\texttt{pf}}\texttt{#1}}%
}
\usepackage[french]{babel}
-
+\sisetup{group-minimum-digits=4}
\renewcommand{\footnoterule}{\vfill\kern -3pt \hrule width 0.4\columnwidth \kern 2.6pt}
\begin{document}
@@ -209,7 +209,8 @@ Il sera ensuite possible :
\item de tracer des courbes ;
\item de déterminer graphiquement des images ou des antécédents ;
\item de rajouter des éléments de dérivation (tangentes) ou d'intégration (domaine) ;
- \item de tracer une droite d'ajustement linéaire ou la courbe d'un autre ajustement.
+ \item de tracer une droite d'ajustement linéaire ou la courbe d'un autre ajustement ;
+ \item \dots
\end{itemize}
\subsection{Packages utilisés, et options du package}
@@ -332,10 +333,11 @@ Concernant les styles des \textit{objets}, ils sont donnés ci-dessous.
\tikzset{pflgrilles/.style={very thin,lightgray}}
\tikzset{pflaxes/.style={line width=0.8pt,->,>=latex}}
-%style des points (courbe / nuage /labels)
+%style des points (courbe / nuage /labels /montecarlo)
\tikzset{pflpoint/.style={line width=0.95pt}}
\tikzset{pflpointc/.style={radius=1.75pt}}
\tikzset{pflpointnuage/.style={radius=1.75pt}}
+\tikzset{pflpointmc/.style={radius=0.875pt}}
\tikzset{pflnoeud/.style={}} %pour les inner sep par exemple :-)
%style des courbes
@@ -544,9 +546,12 @@ L'idée est de proposer une commande pour tracer une droite, à partir :
\item d'un point (ou nœud) et de la pente.
\end{itemize}
+Il existe également une commande pour une asymptote verticale.
+
\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
%dans l'environnement GraphiqueTikz
\TracerDroite[clés]{point ou nœud}{point ou noeud ou pente}
+\TracerAsymptote[clés]{abscisse}
\end{tcblisting}
Les \MontreCode{[clés]}, optionnelles, disponibles sont :
@@ -569,6 +574,7 @@ Les \MontreCode{[clés]}, optionnelles, disponibles sont :
\TracerDroite[Couleur=red]{(-2,-1)}{(2,4)}
\TracerDroite[Couleur=blue,Debut=-5,Fin=3]{(A)}{(B)}
\TracerDroite[Couleur=olive,Pente]{(C)}{0.25}
+ \TracerAsymptote[Couleur=brown]{-6}
\end{GraphiqueTikz}
\end{tcblisting}
@@ -1415,6 +1421,132 @@ Les \MontreCode{[clés]}, optionnelles, disponibles sont :
\pagebreak
+\section{Commandes spécifiques des méthodes intégrales}
+
+\subsection{Méthodes géométriques}\label{methodesintergrales}
+
+L'idée est de proposer plusieurs méthodes graphiques pour illustrer graphiquement une intégrale, via :
+
+\begin{itemize}
+ \item une méthode des rectangles (Gauche, Droite ou Milieu) ;
+ \item la méthode des trapèzes.
+\end{itemize}
+
+\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
+%dans l'environnement GraphiqueTikz
+\RepresenterMethodeIntegrale[clés]<fonction>{a}{b}
+\end{tcblisting}
+
+Les \MontreCode{Clés} disponibles sont :
+
+\begin{itemize}
+ \item \MontreCode{Couleur} : couleur des tracés, \MontreCode{red} par défaut ;
+ \item \MontreCode{NbSubDiv} : nombre de subdivisions, \MontreCode{10} par défaut ;
+ \item \MontreCode{Methode} : méthode géométrique utilisée, parmi parmi \MontreCode{RectanglesGauche / RectanglesDroite / RectanglesMilieu / Trapezes} pour spécifier la méthode utilisée, \MontreCode{RectanglesGauche} par défaut ;
+ \item \MontreCode{Remplir} : booléen, \MontreCode{true} par défaut, pour remplir les éléments graphiques ;
+ \item \MontreCode{CouleurRemplissage} : couleur de remplissage, définie par rapport à la couleur principale par défaut ;
+ \item \MontreCode{Opacite} : opacité, \MontreCode{0.25} par défaut, du remplissage.
+\end{itemize}
+
+\smallskip
+
+Le deuxième argument, optionnel et entre \MontreCode{<...>}, correspond à la fonction \textbf{précédemment définie} !
+
+\smallskip
+
+Les deux derniers arguments, obligatoires, correspondent aux bornes de l'intégrale.
+
+\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
+\begin{GraphiqueTikz}
+ [x=0.66cm,y=0.033cm,Xmin=0,Xmax=21,Xgrille=2,Xgrilles=1,
+ Ymin=0,Ymax=160,Ygrille=20,Ygrilles=10]
+ \TracerAxesGrilles[Elargir=2.5mm]{auto}{auto}
+ \DefinirCourbe[Couleur=red,Nom=cf,Debut=1,Fin=20,Trace]<f>{80*x*exp(-0.2*x)}
+ \RepresenterMethodeIntegrale[Couleur=teal]<f>{5}{15}
+\end{GraphiqueTikz}
+\end{tcblisting}
+
+\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
+\begin{GraphiqueTikz}
+ [x=0.66cm,y=0.033cm,Xmin=0,Xmax=21,Xgrille=2,Xgrilles=1,
+ Ymin=0,Ymax=160,Ygrille=20,Ygrilles=10]
+ \TracerAxesGrilles[Elargir=2.5mm]{auto}{auto}
+ \DefinirCourbe[Couleur=red,Nom=cf,Debut=1,Fin=20,Trace]<f>{80*x*exp(-0.2*x)}
+ \RepresenterMethodeIntegrale
+ [Methode=RectanglesDroite,Couleur=orange,NbSubDiv=7]<f>{1}{10}
+\end{GraphiqueTikz}
+\end{tcblisting}
+
+\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
+\begin{GraphiqueTikz}
+ [x=0.66cm,y=0.033cm,Xmin=0,Xmax=21,Xgrille=2,Xgrilles=1,
+ Ymin=0,Ymax=160,Ygrille=20,Ygrilles=10]
+ \TracerAxesGrilles[Elargir=2.5mm]{auto}{auto}
+ \DefinirCourbe[Couleur=red,Nom=cf,Debut=1,Fin=20,Trace]<f>{80*x*exp(-0.2*x)}
+ \RepresenterMethodeIntegrale
+ [Methode=RectanglesMilieu,Couleur=yellow,NbSubDiv=25]<f>{1}{20}
+\end{GraphiqueTikz}
+\end{tcblisting}
+
+\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
+\begin{GraphiqueTikz}
+ [x=0.66cm,y=0.033cm,Xmin=0,Xmax=21,Xgrille=2,Xgrilles=1,
+ Ymin=0,Ymax=160,Ygrille=20,Ygrilles=10]
+ \TracerAxesGrilles[Elargir=2.5mm]{auto}{auto}
+ \DefinirCourbe[Couleur=red,Nom=cf,Debut=1,Fin=20,Trace]<f>{80*x*exp(-0.2*x)}
+ \RepresenterMethodeIntegrale
+ [Methode=Trapezes,Couleur=pink,Remplir=false]<f>{1}{20}
+\end{GraphiqueTikz}
+\end{tcblisting}
+
+\subsection{Méthode de Monte-Carlo}\label{montecarlo}
+
+L'idée est de proposer une commande pour simuler un calcul intégral via la méthode de Monte-Carlo.
+
+Le code se charge de simuler les \textit{tirages}, et les résultats peuvent être stockés dans des macros.
+
+\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only}
+%dans l'environnement GraphiqueTikz
+\SimulerMonteCarlo[clés]<fonction>{nb essais}[\nbptsmcok][\nbptsmcko]
+\end{tcblisting}
+
+Les \MontreCode{Clés} disponibles sont :
+
+\begin{itemize}
+ \item \MontreCode{Couleurs} : couleurs des points, \MontreCode{blue/red} par défaut ;
+ \item \MontreCode{BornesX} : bornes \textit{horizontales} pour la simulation, valant \MontreCode{\textbackslash pflxmin,\textbackslash pflxmax} par défaut ;
+ \item \MontreCode{BornesY} : bornes \textit{verticales} pour la simulation, valant \MontreCode{\textbackslash pflymin,\textbackslash pflymax} par défaut.
+\end{itemize}
+
+Le deuxième argument, optionnel et entre \MontreCode{<...>}, est la fonction \textbf{précédemment définie} à utiliser.
+
+\smallskip
+
+Les deux derniers arguments, optionnels et entre \MontreCode{[...]}, sont les macros dans lesquelles sont stockées les résultats de la simulation. Ces macros sont \MontreCode{\textbackslash nbptsmcok} et \MontreCode{\textbackslash nbptsmcko} par défaut.
+
+À noter que la macro \MontreCode{\textbackslash nbptsmc} permet de récupérer le nombre de points utilisés.
+
+\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5}
+%avec \sisetup{group-minimum-digits=4} pour le formatage des "milliers"
+
+\begin{GraphiqueTikz}%
+ [x=10cm,y=10cm,Xmin=0,Xmax=1,Xgrille=0.1,Xgrilles=0.05,
+ Ymin=0,Ymax=1,Ygrille=0.1,Ygrilles=0.05]
+ \TracerAxesGrilles[Elargir=2.5mm,Dernier]{auto}{auto}
+ \DefinirCourbe[Trace,Couleur=teal,Pas=0.001]<f>{sqrt(1-x^2)}
+ \SimulerMonteCarlo<f>{5000}
+\end{GraphiqueTikz}
+
+Le nombre de points bleus est de \textcolor{blue}{\num{\nbptsmcok}},
+le nombre de points rouges est de \textcolor{red}{\num{\nbptsmcko}}.
+
+La proportion de points bleus est de $\frac{\num{\nbptsmcok}}{\num{\nbptsmc}}
+\approx \ArrondirNum[4]{\nbptsmcok/\nbptsmc}$
+et $\frac{\pi}{4} \approx \ArrondirNum[4]{pi/4}$.
+\end{tcblisting}
+
+\pagebreak
+
\section{Commandes spécifiques des statistiques à deux variables}
\subsection{Le nuage de points}\label{nuage}
@@ -1767,6 +1899,7 @@ Les commandes disponibles sont :
\lstcmd{def spline~~~~~}{\DefinirCourbeSpline}{deftracfctspline}
\lstcmd{tracé spline~~~}{\TracerCourbeSpline}{deftracfctspline}
\lstcmd{tracé droite~~~}{\TracerDroite}{tracdroite}
+ \lstcmd{asymptote vert~}{\TracerAsymptote}{tracdroite}
\lstcmd{def points~~~~~}{\DefinirPts}{defpts}
\lstcmd{def image~~~~~~}{\DefinirImage}{defpts}
\lstcmd{marq pts~~~~~~~}{\MarquerPts}{markpts}
@@ -1781,6 +1914,8 @@ Les commandes disponibles sont :
\lstcmd{maximum~~~~~~~~}{\TrouverMaximum}{maximum}
\lstcmd{minimum~~~~~~~~}{\TrouverMinimum}{minimum}
\lstcmd{intégrale~~~~~~}{\TracerIntegrale}{integr}
+ \lstcmd{méthodes int~~~}{\RepresenterMethodeIntegrale}{methodesintergrales}
+ \lstcmd{Monte-Carlo~~~~}{\SimulerMonteCarlo}{montecarlo}
\lstcmd{tangente~~~~~~~}{\TracerTangente}{tgte}
\lstcmd{loi normale~~~~}{\DefinirLoiNormale}{loinormale}
\lstcmd{loi normale~~~~}{\TracerLoiNormale}{loinormale}
@@ -1798,6 +1933,7 @@ Les commandes disponibles sont :
\begin{quote}
\begin{verbatim}
+0.1.6 : Asymptote verticale + Méthodes intégrales (géom + Monte Carlo)
0.1.5 : Correction d'un bug sur les rajouts de valeurs + Nœud pour une image + [en] version !
0.1.4 : Placement de texte
0.1.3 : Ajout de régressions avec le package xint-regression
diff --git a/graphics/pgf/contrib/tkz-grapheur/tex/tkz-grapheur.sty b/graphics/pgf/contrib/tkz-grapheur/tex/tkz-grapheur.sty
index 3de4286c8e..ce321f6d4b 100644
--- a/graphics/pgf/contrib/tkz-grapheur/tex/tkz-grapheur.sty
+++ b/graphics/pgf/contrib/tkz-grapheur/tex/tkz-grapheur.sty
@@ -2,9 +2,10 @@
% licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tkz-grapheur}[2024/06/22 0.1.5.Des outils en TikZ pour travailler comme avec un grapheur]
+\ProvidesPackage{tkz-grapheur}[2024/07/13 0.1.6.Des outils en TikZ pour travailler comme avec un grapheur]
%====HISTORIQUE
+% v 0.1.6 Asymptote verticale + Monte Carlo + Méthode intégrales (rectangles, etc)
% v 0.1.5 Correction d'un bug avec les valeurs manuelles + Nœud pour une image + [en] version !
% v 0.1.4 Ajout des placements de textes
% v 0.1.3 Régressions, avec xintreg (désactivable)
@@ -49,7 +50,7 @@
\if@lngenglish
\sisetup{mode=match,propagate-math-font=true,reset-math-version=false,reset-text-family=false,reset-text-series=false,reset-text-shape=false,text-family-to-math=true,text-series-to-math=true}
\else
- \sisetup{locale=FR,output-decimal-marker={,},mode=match,propagate-math-font=true,reset-math-version=false,reset-text-family=false,reset-text-series=false,reset-text-shape=false,text-family-to-math=true,text-series-to-math=true}
+ \sisetup{locale=FR,output-decimal-marker={,},mode=match,propagate-math-font=true,reset-math-version=false,reset-text-family=false,reset-text-series=false,reset-text-shape=false,text-family-to-math=true,text-series-to-math=true,group-minimum-digits=4}
\fi
\fi
@@ -106,6 +107,7 @@
%====STYLES DE BASE
\tikzset{pflnoeud/.style={}}
\tikzset{pflpoint/.style={line width=0.95pt}}
+\tikzset{pflpointmc/.style={radius=0.875pt}}
\tikzset{pflpointc/.style={radius=1.75pt}}
\tikzset{pflpointnuage/.style={radius=1.75pt}}
\tikzset{pflcadre/.style={line width=0.8pt,gray}}
@@ -1012,6 +1014,103 @@
\end{scope}
}
+%====MONTE CARLO
+\defKV[graphiquetikzmontecarlo]{%
+ Couleurs=\def\graphtikzmccols{#1},%
+ BornesX=\def\graphtikzmcxbornes{#1},%
+ BornesY=\def\graphtikzmcybornes{#1}
+}
+
+\setKVdefault[graphiquetikzmontecarlo]{%
+ Couleurs={blue/red},%
+ BornesX={\pflxmin,\pflxmax},%
+ BornesY={\pflymin,\pflymax}
+}
+
+\NewDocumentCommand\SimulerMonteCarlo{ O{} D<>{f} m O{\nbptsmcok} O{\nbptsmcko} }{%
+ \restoreKV[graphiquetikzmontecarlo]%
+ \setKV[graphiquetikzmontecarlo]{#1}%
+ \StrCut{\graphtikzmccols}{/}{\tmpMCcolOK}{\tmpMCcolKO}%
+ \StrCut{\graphtikzmcxbornes}{,}{\tmpMCxmin}{\tmpMCxmax}%
+ \StrCut{\graphtikzmcybornes}{,}{\tmpMCymin}{\tmpMCymax}%
+ \xdef#4{0}%
+ \xdef#5{0}%
+ \xdef\nbptsmc{#3}%
+ \foreach \i in {1,...,#3}{%
+ \xdef\tmpMCrandX{\xintfloateval{random()*((\tmpMCxmax)-(\tmpMCxmin))+(\tmpMCxmin)}}%
+ \xdef\tmpMCrandY{\xintfloateval{random()*((\tmpMCymax)-(\tmpMCymin))+(\tmpMCymin)}}%
+ \xdef\tmpMCrandfX{\xintfloateval{#2(\tmpMCrandX)}}%
+ \xintifboolexpr{ \tmpMCrandfX > \tmpMCrandY }%
+ {%
+ \xdef#4{\xinteval{#4+1}}%
+ \filldraw[\tmpMCcolOK] (\tmpMCrandX,\tmpMCrandY) circle[pflpointmc] ;
+ }%
+ {%
+ \xdef#5{\xinteval{#5+1}}%
+ \filldraw[\tmpMCcolKO] (\tmpMCrandX,\tmpMCrandY) circle[pflpointmc] ;
+ }%
+ }%
+}
+
+%====MÉTHODES INTÉGRALES
+
+\defKV[graphiquetikzintegr]{%
+ Couleur=\def\graphtikzintgrcol{#1},%
+ CouleurRemplissage=\def\graphtikzintgrcolrempl{#1},%
+ NbSubDiv=\def\graphtikzintgrnb{#1},%
+ Methode=\def\graphtikzintgrtype{#1},%
+ Opacite=\def\graphtikzintgropac{#1}
+}
+
+\setKVdefault[graphiquetikzintegr]{%
+ Couleur=red,%
+ NbSubDiv=10,%
+ Methode=RectanglesGauche,%
+ Remplir=true,%
+ CouleurRemplissage={\graphtikzintgrcol!25},%
+ Opacite=0.25
+}
+
+\NewDocumentCommand\RepresenterMethodeIntegrale{ O{} D<>{f} m m }{%opts+nom_fct+a+b
+ \useKVdefault[graphiquetikzintegr]%
+ \setKV[graphiquetikzintegr]{#1}%
+ \ifboolKV[graphiquetikzintegr]{Remplir}%
+ {%
+ \tikzset{pflfigureintegr/.style={pfltrait,\graphtikzintgrcol,fill=\graphtikzintgrcolrempl,fill opacity=\graphtikzintgropac}}%
+ }%
+ {%
+ \tikzset{pflfigureintegr/.style={pfltrait,\graphtikzintgrcol}}%
+ }%
+ \tikzset{figureintegr/.style={pfltrait,\graphtikzintgrcol,fill=\graphtikzintgrcolrempl,fill opacity=\graphtikzintgropac}}%
+ \def\TmpH{(#4-#3)/\graphtikzintgrnb}
+ %rectangles gauches
+ \IfEq{\graphtikzintgrtype}{RectanglesGauche}%
+ {%
+ \foreach \i in {0,...,\inteval{\graphtikzintgrnb-1}}%
+ \draw[pflfigureintegr] ({#3+\i*\TmpH},{0}) rectangle++ ({\TmpH},{\xintfloateval{#2(#3+\i*\TmpH)}}) ;
+ }%
+ {}%
+ \IfEq{\graphtikzintgrtype}{RectanglesDroite}%
+ {%
+ \foreach \i in {0,...,\inteval{\graphtikzintgrnb-1}}%
+ \draw[pflfigureintegr] ({#3+\i*\TmpH},{0}) rectangle++ ({\TmpH},{\xintfloateval{#2(#3+(\i+1)*\TmpH)}}) ;
+ }%
+ {}%
+ \IfEq{\graphtikzintgrtype}{RectanglesMilieu}%
+ {%
+ \foreach \i in {0,...,\inteval{\graphtikzintgrnb-1}}%
+ \draw[pflfigureintegr] ({#3+\i*\TmpH},{0}) rectangle++ ({\TmpH},{\xintfloateval{#2(#3+(\i+0.5)*\TmpH)}}) ;
+ }%
+ {}%
+ \IfEq{\graphtikzintgrtype}{Trapezes}%
+ {%
+ \foreach \i in {0,...,\inteval{\graphtikzintgrnb-1}}%
+ \draw[pflfigureintegr] ({#3+\i*\TmpH},{0}) -- ({#3+\i*\TmpH},{\xintfloateval{#2(#3+\i*\TmpH)}}) -- ({#3+(\i+1)*\TmpH},{\xintfloateval{#2(#3+(\i+1)*\TmpH)}}) -- ({#3+(\i+1)*\TmpH},{0}) -- cycle ;
+ }%
+ {}%
+}
+
+
%====INTÉGRALES
%v2 avec modification de la clé [Type=...] ?
\defKV[GraphiqueTikzIntegr]{%
@@ -1961,6 +2060,16 @@
\end{scope}
}
+%====asymptote
+\NewDocumentCommand\TracerAsymptote{ O{} m D<>{} }{%
+ \restoreKV[GraphiquetikzDroite]%
+ \setKV[GraphiquetikzDroite]{#1}%
+ %tracé
+ \draw[pfltrait,{\useKV[GraphiquetikzDroite]{Couleur}},#3] ({#2},{\pflymin})--({#2},{\pflymax}) ;
+}
+
+
+%====MinMax
\defKV[GraphiqueTikzMinMax]{%
Pas=\def\pflminmaxstep{#1},%
Methode=\def\pflminmaxmethode{#1},%
@@ -2117,6 +2226,7 @@
\tikzset{tkzgrphnode/.style={}}
\tikzset{tkzgrphpoint/.style={line width=0.95pt}}
\tikzset{tkzgrphpointc/.style={radius=1.75pt}}
+\tikzset{tkzgrphpointmc/.style={radius=0.875pt}}
\tikzset{tkzgrphscatter/.style={radius=1.75pt}}
\tikzset{tkzgrphframe/.style={line width=0.8pt,gray}}
\tikzset{tkzgrphcurve/.style={line width=1.05pt}}
@@ -3898,11 +4008,11 @@
}
%====droite
-\defKV[GraphiquetikzDroite]{%
+\defKV[GraphicTikzLine]{%
Name=\def\pfldroitename{#1}
}
-\setKVdefault[GraphiquetikzDroite]{%
+\setKVdefault[GraphicTikzLine]{%
Slope=false,%
Color=black,%
Start={\pflxmin},%
@@ -3911,15 +4021,15 @@
}
\NewDocumentCommand\DrawLine{ O{} m m D<>{} }{%
- \restoreKV[GraphiquetikzDroite]%
- \setKV[GraphiquetikzDroite]{#1}%
+ \restoreKV[GraphicTikzLine]%
+ \setKV[GraphicTikzLine]{#1}%
%1er point
\path #2;%
\pgfgetlastxy{\macrox}{\macroy}%
\xdef\pfldtetikzxA{\xintfloateval{(\ConvertPtToCm{\macrox})/(\pflxunit)}}%
\xdef\pfldtetikzyA{\xintfloateval{(\ConvertPtToCm{\macroy})/(\pflyunit)}}%
%2ème point si besoin
- \ifboolKV[GraphiquetikzDroite]{Slope}%
+ \ifboolKV[GraphicTikzLine]{Slope}%
{%
\xdef\pfldtepente{\xintfloateval{#3}}%
}%
@@ -3936,24 +4046,33 @@
{%
\IfEq{\pfldroitename}{}%
{%
- \draw[tkzgrphline,{\useKV[GraphiquetikzDroite]{Color}},#4] (\pfldtetikzxA,\pflymin) -- (\pfldtetikzxA,\pflymax) ;
+ \draw[tkzgrphline,{\useKV[GraphicTikzLine]{Color}},#4] (\pfldtetikzxA,\pflymin) -- (\pfldtetikzxA,\pflymax) ;
}%
{%
- \draw[tkzgrphline,{\useKV[GraphiquetikzDroite]{Color}},#4,name path global=\pfldroitename] (\pfldtetikzxA,\pflymin) -- (\pfldtetikzxA,\pflymax) ;
+ \draw[tkzgrphline,{\useKV[GraphicTikzLine]{Color}},#4,name path global=\pfldroitename] (\pfldtetikzxA,\pflymin) -- (\pfldtetikzxA,\pflymax) ;
}%
}%
{%
\IfEq{\pfldroitename}{}%
{%
- \draw[tkzgrphline,{\useKV[GraphiquetikzDroite]{Color}},domain={\useKV[GraphiquetikzDroite]{Start}}:{\useKV[GraphiquetikzDroite]{End}},samples=2,#4] plot (\x,{\pfldtepente*(\x-\pfldtetikzxA)+\pfldtetikzyA}) ;
+ \draw[tkzgrphline,{\useKV[GraphicTikzLine]{Color}},domain={\useKV[GraphicTikzLine]{Start}}:{\useKV[GraphicTikzLine]{End}},samples=2,#4] plot (\x,{\pfldtepente*(\x-\pfldtetikzxA)+\pfldtetikzyA}) ;
}%
{%
- \draw[tkzgrphline,{\useKV[GraphiquetikzDroite]{Color}},domain={\useKV[GraphiquetikzDroite]{Start}}:{\useKV[GraphiquetikzDroite]{End}},samples=2,name path global=\pfldroitename,#4] plot (\x,{\pfldtepente*(\x-\pfldtetikzxA)+\pfldtetikzyA}) ;
+ \draw[tkzgrphline,{\useKV[GraphicTikzLine]{Color}},domain={\useKV[GraphicTikzLine]{Start}}:{\useKV[GraphicTikzLine]{End}},samples=2,name path global=\pfldroitename,#4] plot (\x,{\pfldtepente*(\x-\pfldtetikzxA)+\pfldtetikzyA}) ;
}%
}%
\end{scope}
}
+%====asymptote
+\NewDocumentCommand\DrawAsymptote{ O{} m D<>{} }{%
+ \restoreKV[GraphicTikzLine]%
+ \setKV[GraphicTikzLine]{#1}%
+ %tracé
+ \draw[tkzgrphline,{\useKV[GraphicTikzLine]{Color}},#3] ({#2},{\pflymin})--({#2},{\pflymax}) ;
+}
+
+%====minmax
\defKV[GraphicTikzMinMax]{%
Pas=\def\pflminmaxstep{#1},%
Method=\def\pflminmaxmethode{#1},%
@@ -4061,4 +4180,42 @@
\draw #2 node[tkzgrphnode,font=\pflnodefonte,text=\pflnodecol,\pfnodepos] {#3} ;
}
+%====MONTE CARLO
+\defKV[GraphicTikzmontecarlo]{%
+ Colors=\def\graphtikzmccols{#1},%
+ BoundsX=\def\graphtikzmcxbornes{#1},%
+ BoundsY=\def\graphtikzmcybornes{#1}
+}
+
+\setKVdefault[GraphicTikzmontecarlo]{%
+ Colors={blue/red},%
+ BoundsX={\pflxmin,\pflxmax},%
+ BoundsY={\pflymin,\pflymax}
+}
+
+\NewDocumentCommand\SimulateMonteCarlo{ O{} D<>{f} m O{\nbptsmcok} O{\nbptsmcko} }{%
+ \restoreKV[GraphicTikzmontecarlo]%
+ \setKV[GraphicTikzmontecarlo]{#1}%
+ \StrCut{\graphtikzmccols}{/}{\tmpMCcolOK}{\tmpMCcolKO}%
+ \StrCut{\graphtikzmcxbornes}{,}{\tmpMCxmin}{\tmpMCxmax}%
+ \StrCut{\graphtikzmcybornes}{,}{\tmpMCymin}{\tmpMCymax}%
+ \xdef#4{0}%
+ \xdef#5{0}%
+ \xdef\nbptsmc{#3}%
+ \foreach \i in {1,...,#3}{%
+ \xdef\tmpMCrandX{\xintfloateval{random()*((\tmpMCxmax)-(\tmpMCxmin))+(\tmpMCxmin)}}%
+ \xdef\tmpMCrandY{\xintfloateval{random()*((\tmpMCymax)-(\tmpMCymin))+(\tmpMCymin)}}%
+ \xdef\tmpMCrandfX{\xintfloateval{#2(\tmpMCrandX)}}%
+ \xintifboolexpr{ \tmpMCrandfX > \tmpMCrandY }%
+ {%
+ \xdef#4{\xinteval{#4+1}}%
+ \filldraw[\tmpMCcolOK] (\tmpMCrandX,\tmpMCrandY) circle[tkzgrphpointmc] ;
+ }%
+ {%
+ \xdef#5{\xinteval{#5+1}}%
+ \filldraw[\tmpMCcolKO] (\tmpMCrandX,\tmpMCrandY) circle[tkzgrphpointmc] ;
+ }%
+ }%
+}
+
\endinput \ No newline at end of file