diff options
author | Karl Berry <karl@freefriends.org> | 2024-06-05 19:55:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-06-05 19:55:28 +0000 |
commit | a96e8fcb49a5614f11cd06886d2adf8718611bdf (patch) | |
tree | 3cf8725581875c1c1fbe2492e1969ed14c433822 /Master/texmf-dist | |
parent | 845c4ad6af8875dae97bfc136b819fe6f44b8d01 (diff) |
xint-regression (5jun24)
git-svn-id: svn://tug.org/texlive/trunk@71443 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/xint-regression/README.md | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xint-regression/xint-regression-doc.pdf | bin | 0 -> 360019 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/xint-regression/xint-regression-doc.tex | 447 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xint-regression/xint-regression.sty | 662 |
4 files changed, 1116 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/xint-regression/README.md b/Master/texmf-dist/doc/latex/xint-regression/README.md new file mode 100644 index 00000000000..4b2977a59bb --- /dev/null +++ b/Master/texmf-dist/doc/latex/xint-regression/README.md @@ -0,0 +1,7 @@ +xint-regression is a package to work with classic regressions, with xint. +----------------------------------------------------------------------------------------- +xint-regression est un package pour travailler avec des régressions classiques, avec xint. +------------------------------------------------------------------------------------------ +Author.......: Cédric Pierquet +email........: cpierquet@outlook.fr +Licence......: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/xint-regression/xint-regression-doc.pdf b/Master/texmf-dist/doc/latex/xint-regression/xint-regression-doc.pdf Binary files differnew file mode 100644 index 00000000000..744ccda47fd --- /dev/null +++ b/Master/texmf-dist/doc/latex/xint-regression/xint-regression-doc.pdf diff --git a/Master/texmf-dist/doc/latex/xint-regression/xint-regression-doc.tex b/Master/texmf-dist/doc/latex/xint-regression/xint-regression-doc.tex new file mode 100644 index 00000000000..b42f725cdfa --- /dev/null +++ b/Master/texmf-dist/doc/latex/xint-regression/xint-regression-doc.tex @@ -0,0 +1,447 @@ +% !TeX TXS-program:compile = txs:///arara +% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} +% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') + +\documentclass[11pt,a4paper]{ltxdoc} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage{xint-regression} +\usepackage{fancyvrb} +\usepackage{fancyhdr} +\usepackage{hyperref} +\usepackage{tkz-grapheur} +\usepackage{tcolorbox} +\tcbuselibrary{skins,minted} +\fancyhf{} +\renewcommand{\headrulewidth}{0pt} +\lfoot{\sffamily\small [xint-regression]} +\rfoot{\sffamily\small - \thepage{} -} +\usepackage{hologo} +\providecommand\tikzlogo{Ti\textit{k}Z} +\providecommand\TeXLive{\TeX{}Live\xspace} +\providecommand\PSTricks{\textsf{PSTricks}\xspace} +\let\pstricks\PSTricks +\let\TikZ\tikzlogo + +\urlstyle{same} +\hypersetup{pdfborder=0 0 0} +\usepackage[margin=2cm]{geometry} +\setlength{\parindent}{0pt} +\def\TPversion{0.1.0} +\def\TPdate{05/06/2024} +\usepackage{soul} +\usepackage{tabularray} +\sethlcolor{lightgray!25} +\NewDocumentCommand\MontreCode{ m }{% + \hl{\vphantom{\texttt{pf}}\texttt{#1}}% +} +\usepackage{babel} + +\renewcommand{\footnoterule}{\vfill\kern -3pt \hrule width 0.4\columnwidth \kern 2.6pt} + +\begin{document} + +\pagestyle{fancy} + +\thispagestyle{empty} + +\begin{center} + \begin{minipage}{0.88\linewidth} + \begin{tcolorbox}[colframe=yellow,colback=yellow!15] + \begin{center} + \begin{tabular}{c} + {\Huge \texttt{xint-regression}}\\ + \\ + {\LARGE Classic regressions, with \textsf{xint}.}\\ + \\ + {\small \texttt{Version \TPversion{} -- \TPdate}} + \end{tabular} + \end{center} + \end{tcolorbox} +\end{minipage} +\end{center} + +\begin{center} + \begin{tabular}{c} + \texttt{Cédric Pierquet}\\ + {\ttfamily c pierquet -- at -- outlook . fr}\\ + \texttt{\url{https://forge.apps.education.fr/pierquetcedric/package-latex-xintreg}} \\ +\end{tabular} +\end{center} + +\hrule + +\vfill + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +\def\LISTEX{1,2,3,4,5,6} +\def\LISTEY{8.74,8.80,9.52,10.42,11.83,14.62} + +\xintexpreg[Alt]{\LISTEX}{\LISTEY} %raw results +$a \approx \exprega$ and $b \approx \expregb$ + +\xintexpreg[Alt,round=2]{\LISTEX}{\LISTEY} %rounded results +$a \approx \exprega$ and $b \approx \expregb$\\ + +So $y \approx \exprega x+\expregb$. +\end{tcblisting} + +\vspace*{5mm} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +\def\LISTEXX{0,50,100,140} +\def\LISTEYY{275,290,315,350} + +\xintexpoffreg[offset=250]{\LISTEXX}{\LISTEYY} %raw results +$a \approx \expregoffa$ and $b \approx \expregoffb$ + +\xintexpoffreg[offset=250,round=2/1]{\LISTEXX}{\LISTEYY} %rounded results +$a \approx \expregoffa$ and $b \approx \expregoffb$\\ + +So $y \approx 250+\expregoffb e^{\expregoffa x}$ +\end{tcblisting} + +\vfill + +\vspace*{5mm} + +\pagebreak + +\phantomsection + +\hypertarget{matoc}{} + +\tableofcontents + +\vspace*{5mm} + +\hrule + +\vspace*{5mm} + +\pagebreak + +\section{Introduction} + +\subsection{Global usage} + +This package offers \textsf{xint}-based commands for working with classical regressions : + +\begin{itemize} + \item linear regression $ax+b$ ; + \item quadratic regression $ax^2+bx+c$ ; + \item cubic regression $ax^3+bx^2+cx+d$ ; + \item power regression $ax^b$ ; + \item exponential regression $ab^x$ or $e^{ax+b}$ or $be^{ax}$ or $C + be^{ax}$ ; + \item logarithmic regression $a+b\log(x)$ ; + \item hyperbolic regression $a+\displaystyle\frac{b}{x}$. +\end{itemize} + +For each type of regression, results can be stored in macros, either raw or with rounding (with individuals \MontreCode{[optional keys]}). + +\subsection{Packages used} + +This package uses \MontreCode{simplekv}, \MontreCode{xintexpr}, \MontreCode{listofitems} and \MontreCode{xstring}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +%loading +\usepackage{xint-regression} +\end{tcblisting} + +\subsection{Warnings} + +The precision of the (determination) results seems to be good, which should normally guarantee satisfactory calculations and plots. + +Nevertheless, it is advisable to be cautious about the results obtained and those expected. + +\pagebreak + +\section{The commands} + +\subsection{Linear regression} + +The equation is \fbox{$ax+b$}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\xintlinreg[coeffa=...,coeffa=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=linrega} ; \MontreCode{coeffb=linregb} and \MontreCode{round} is empty. + +\MontreCode{round=...} can be given within \MontreCode{round=global} or \MontreCode{round=a/b/...}. + +\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% +\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% +\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%default output +\xintlinreg{\LLX}{\LLY}% +$a \approx \linrega$ and $b \approx \linregb$ +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%personal macros + global rounding +\xintlinreg[coeffa=LINa,coeffb=LINb,round=2]{\LLX}{\LLY}% +$a \approx \LINa$ and $b \approx \LINb$ +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%personal macros + individual rounding +\xintlinreg[coeffa=LINEARa,coeffb=LINEARb,round=2/0]{\LLX}{\LLY}% +$a \approx \LINEARa$ and $b \approx \LINEARb$ +\end{tcblisting} + +\subsection{Quadratic regression} + +The equation is \fbox{$ax^2+bx+c$}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\xintquadreg[coeffa=...,coeffb=...,coeffc=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=quadrega} ; \MontreCode{coeffb=quadregb}, \MontreCode{coeffc=quadrega} and \MontreCode{round} is empty. + +\MontreCode{round=...} can be given within \MontreCode{round=global} or \MontreCode{round=a/b/...}. + +\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% +\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% +\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%default output +\xintquadreg{\LLX}{\LLY}% +$a \approx \quadrega$ ; $b \approx \quadregb$ and $c \approx \quadregc$ +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%personal macros + global rounding +\xintquadreg[coeffa=QUADa,coeffb=QUADb,coeffc=QUADc,round=2]{\LLX}{\LLY}% +$a \approx \QUADa$ ; $b \approx \QUADb$ and $c \approx \QUADc$ +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%personal macros + individual rounding +\xintquadreg[coeffa=QUADRAa,coeffb=QUADRAb,coeffc=QUADRAc,round=4/3/2]{\LLX}{\LLY}% +$a \approx \QUADRAa$ ; $b \approx \QUADRAb$ and $c \approx \QUADRAc$ +\end{tcblisting} + +\subsection{Cubic regression}%, hyperbolic and logarithmic regression} + +The equation for cubic is \fbox{$ax^3+bx^2+cx+d$}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\xintcubreg[coeffa=...,coeffb=...,coeffc=...,coeffd=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=cubrega} ; \MontreCode{coeffb=cubregb} ; \MontreCode{coeffc=cubregc} and \MontreCode{coeffd=cubregd}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% +\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%individual roudings +\xintcubreg[round=5/3/2/1]{\LLX}{\LLY}% +$a \approx \cubrega$ ; $b \approx \cubregb$ ; $c \approx \cubregc$ and $d \approx \cubregd$ +\end{tcblisting} + +\subsection{Hyperbolic regression} + +The equation for hyperbolic is \fbox{$a+\displaystyle\frac{b}{x}$}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\xinthypreg[coeffa=...,coeffb=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=hyprega} and \MontreCode{coeffb=hypregb}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% +\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%global roudings +\xinthypreg[round=2]{\LLX}{\LLY}% +$a \approx \hyprega$ and $b \approx \hypregb$ +\end{tcblisting} + +\subsection{Logarithmic regression} + +The equation for logarithmic is \fbox{$a+b\,\log(x)$}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\xintlogreg[coeffa=...,coeffb=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=logrega} and \MontreCode{coeffb=logregb}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% +\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%individual roudings +\xintlogreg[round=1/4]{\LLX}{\LLY}% +$a \approx \logrega$ and $b \approx \logregb$ +\end{tcblisting} + +\subsection{Power regression} + +The equation for power is \fbox{$a \times x^{b}$}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\xintpowreg[coeffa=...,coeffb=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=powrega} and \MontreCode{coeffb=powregb}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% +\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%default output +\xintpowreg{\LLX}{\LLY}% +$a \approx \powrega$ and $b \approx \powregb$ +\end{tcblisting} + +\subsection{Exponential regression} + +Available regressions are : + +\begin{itemize} + \item \fbox{$a \times b^{x}$} ; + \item \fbox{$e^{ax+b}$} ; + \item \fbox{$b\,e^{ax}$} ; + \item \fbox{$C+b\,e^{ax}$}. +\end{itemize} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +%a*b^x +\xintexpabreg[coeffa=...,coeffb=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=expabrega} and \MontreCode{coeffb=expabregb}. + +\smallskip + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +%e^(ax+b) +\xintexpreg[coeffa=...,coeffb=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=exprega} and \MontreCode{coeffb=expregb}. + +\smallskip + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +%b*e^(ax) +\xintexpreg[Alt,coeffa=...,coeffb=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=exprega} and \MontreCode{coeffb=expregb}. + +\smallskip + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +%C+b*e^(ax) +\xintexpoffreg[offset=C,coeffa=...,coeffb=...,round=...]{xlist}{ylist} +\end{tcblisting} + +By default, \MontreCode{coeffa=expregoffa} and \MontreCode{coeffb=expregoffb}. + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5,listing only} +\def\LLX{83,71,64,69,69,64,68,59,81,91,57,65,58,62}% +\def\LLY{183,168,171,178,176,172,165,158,183,182,163,175,164,175}% +\end{tcblisting} + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%a*b^x +\xintexpabreg{\LLX}{\LLY} +$a \approx \expabrega$ and $b \approx \expabregb$ + +%e^(ax+b) +\xintexpreg{\LLX}{\LLY} +$a \approx \exprega$ and $b \approx \expregb$ + +%b*e^(ax) +\xintexpreg[Alt]{\LLX}{\LLY} +$a \approx \exprega$ and $b \approx \expregb$ + +%C+b*e^(ax) +\xintexpoffreg[offset=50]{\LLX}{\LLY} +$a \approx \expregoffa$ and $b \approx \expregoffb$ +\end{tcblisting} + +\pagebreak + +\section{Integration with other packages} + +\subsection{Number formatting} + +It is possible to format the results, according to locale rules, for example with \textsf{sinuitx}. + +\smallskip + +With \MontreCode{[locale=FR]} : + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +%a*b^x +\xintexpabreg[round=1/3]{\LLX}{\LLY}% +So we obtain $y \approx \num{\expabrega} \times e^{\num{\expabregb}\times x}$ +\end{tcblisting} + +\subsection{Plotting} + +It is also possible to integrate the package's commands into a plotting environment, such as \textsf{tikz} or \textsf{pgfplots}. + +\smallskip + +For example, with \textsf{tkz-grapheur} package : + +\begin{tcblisting}{listing engine=minted,minted language=latex,colframe=lightgray,colback=lightgray!5} +\def\LISTEXX{0,50,100,140}% +\def\LISTEYY{275,290,315,350}% + +\begin{GraphiqueTikz} + [x=0.05cm,y=0.04cm,Xmin=0,Xmax=160,Xgrille=20,Xgrilles=10, + Origy=250,Ymin=250,Ymax=400,Ygrille=25,Ygrilles=5] + %window + \TracerAxesGrilles[Elargir=2.5mm,Police=\footnotesize]{auto}{auto} + %points + \TracerNuage[Style=o,CouleurNuage=red]{\LISTEXX}{\LISTEYY} + %regression expoffset C+b*epx(ax) + \xintexpoffreg[offset=250]{\LISTEXX}{\LISTEYY} + \DefinirCourbe[Nom=ajust,Couleur=blue,Trace] + <ajust> + {250+\expregoffb*exp(\expregoffa*x)} + %constructions + \PlacerImages[Couleurs=cyan/magenta,Traits]{ajust}{80} + \PlacerAntecedents[Style=x,Couleurs=blue/green!50!black,Traits]{ajust}{325} +\end{GraphiqueTikz} +\end{tcblisting} + +\pagebreak + +\section{History} + +\begin{quote} +\begin{verbatim} +0.1.0 : Initial version +\end{verbatim} +\end{quote} + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/xint-regression/xint-regression.sty b/Master/texmf-dist/tex/latex/xint-regression/xint-regression.sty new file mode 100644 index 00000000000..71413005aa3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/xint-regression/xint-regression.sty @@ -0,0 +1,662 @@ +% Author : C. Pierquet +% licence : Released under the LaTeX Project Public License v1.3c +% or later, see http://www.latex-project.org/lppl.txtf + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{xint-regression}[2024/06/05 0.1.0 Some classic regressions, with xint] +%0.1.0 Initial version + +%------Packages utiles +\RequirePackage{simplekv} +\RequirePackage{xintexpr} +\RequirePackage{listofitems} +\RequirePackage{xstring} + +%régression linéaire +\defKV[CoefRegLin]{% + coeffa=\def\RegLinCoefa{#1},% + coeffb=\def\RegLinCoefb{#1},% + round=\def\RegLinRound{#1} +} + +\setKVdefault[CoefRegLin]{% + coeffa=linrega,% + coeffb=linregb,% + round={} +} + +\newcommand\xintlinreg[3][]{% + \useKVdefault[CoefRegLin]% + \setKV[CoefRegLin]{#1}% on paramètres les nouvelles clés et on les simplifie + %listes des données + \def\xliste{#2}% + \def\yliste{#3}% + \readlist*\LX{\xliste}% + \readlist*\LY{\yliste}% + %taille des listes + \def\LNB{\inteval{\LXlen}}% + %somme des LX et des LY OK + \xdef\LXSomme{0}% + \xdef\LYSomme{0}% + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LXSomme{\xintfloateval{\LXSomme+(\LX[##1])}}% + \xdef\LYSomme{\xintfloateval{\LYSomme+(\LY[##1])}}% + }% + %moyenne des LX et des LY OK + \xdef\LXmoy{\xintfloateval{\LXSomme/\LNB}}% + \xdef\LYmoy{\xintfloateval{\LYSomme/\LNB}}% + %variance des LX et des LY OK + \xdef\LXvar{0}% + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LXvar{\xintfloateval{\LXvar+(\LX[##1]-(\LXmoy))*(\LX[##1]-(\LXmoy))}}% + } + \xdef\LXvar{\xintfloateval{\LXvar/\LNB}}% + \xdef\LYvar{0}% + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LYvar{\xintfloateval{\LYvar+(\LY[##1]-(\LYmoy))*(\LY[##1]-(\LYmoy))}}% + }% + \xdef\LYvar{\xintfloateval{\LYvar/\LNB}}% + %covariance des XY OK + \xdef\LXYvar{0}% + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LXYvar{\xintfloateval{\LXYvar+(\LX[##1]-(\LXmoy))*(\LY[##1]-(\LYmoy))}}% + }% + \xdef\LXYvar{\xintfloateval{\LXYvar/\LNB}}% + %COEFFS TEMPORAIRES OK + \xdef\tmp@reg@lin@a{\xintfloateval{\LXYvar/\LXvar}}% + \xdef\tmp@reg@lin@b{\xintfloateval{\LYmoy-(\tmp@reg@lin@a)*(\LXmoy)}}% + %STOCKAGE + \IfStrEq{\RegLinRound}{}% + {% + \expandafter\def\csname\RegLinCoefa\endcsname{\tmp@reg@lin@a}% + \expandafter\def\csname\RegLinCoefb\endcsname{\tmp@reg@lin@b}% + }% + {% + \IfSubStr{\RegLinRound}{/}% + {% + \StrCut{\RegLinRound}{/}{\xintarrondisreglina}{\xintarrondisreglinb}% + }% + {% + \xdef\xintarrondisreglina{\RegLinRound}\xdef\xintarrondisreglinb{\RegLinRound}% + }% + \expandafter\def\csname\RegLinCoefa\endcsname{\xintfloateval{round(\tmp@reg@lin@a,\xintarrondisreglina)}}% + \expandafter\def\csname\RegLinCoefb\endcsname{\xintfloateval{round(\tmp@reg@lin@b,\xintarrondisreglinb)}}% + }% +} + + + +%régression quadratique +\defKV[CoeffRegQuad]{% + coeffa=\def\RegQuadCoefa{#1},% + coeffb=\def\RegQuadCoefb{#1},% + coeffc=\def\RegQuadCoefc{#1},% + round=\def\RegQuadRound{#1} +} + +\setKVdefault[CoeffRegQuad]{% + coeffa=quadrega,% + coeffb=quadregb,% + coeffc=quadregc,% + round={} +} + +\newcommand\xintquadreg[3][]{% + \useKVdefault[CoeffRegQuad]% + \setKV[CoeffRegQuad]{#1}% on paramètres les nouvelles clés et on les simplifie + %listes des données + \def\xliste{#2}% + \def\yliste{#3}% + \readlist*\LX{\xliste}% + \readlist*\LY{\yliste}% + %taille des listes + \def\LNB{\inteval{\LXlen}}% + %somme importantes + \xdef\LXSomme{0}% + \xdef\LXCSomme{0}% + \xdef\LYSomme{0}% + \xdef\LXXSomme{0}% + \xdef\LXYSomme{0}% + \xdef\LXXCSomme{0}% + \xdef\LXCXCSomme{0}% + \xdef\LXCYSomme{0}% + %calculs + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LXSomme{\xintfloateval{\LXSomme+(\LX[##1])}}% + \xdef\LXCSomme{\xintfloateval{\LXCSomme+(\LX[##1])^2}}% + }% + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LYSomme{\xintfloateval{\LYSomme+(\LY[##1])}}% + }% + \xdef\LXmoy{\xintfloateval{\LXSomme/\LNB}}% + \xdef\LYmoy{\xintfloateval{\LYSomme/\LNB}}% + \xdef\LXCmoy{\xintfloateval{\LXCSomme/\LNB}}% + %calculs suites + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LXXSomme{\xintfloateval{\LXXSomme+(\LX[##1]-\LXmoy)^2}}% + \xdef\LXYSomme{\xintfloateval{\LXYSomme+(\LX[##1]-\LXmoy)*(\LY[##1]-\LYmoy)}}% + \xdef\LXXCSomme{\xintfloateval{\LXXCSomme+(\LX[##1]-\LXmoy)*((\LX[##1])*(\LX[##1])-\LXCmoy)}}% + \xdef\LXCXCSomme{\xintfloateval{\LXCXCSomme+((\LX[##1])^2-\LXCmoy)^2}}% + \xdef\LXCYSomme{\xintfloateval{\LXCYSomme+((\LX[##1])^2-\LXCmoy)*(\LY[##1]-\LYmoy)}}% + }% + %COEFFS TEMPORAIRES OK + \xdef\tmp@reg@quad@b{\xintfloateval{(\LXYSomme*\LXCXCSomme-\LXCYSomme*\LXXCSomme)/(\LXXSomme*\LXCXCSomme-(\LXXCSomme)^2)}}% + \xdef\tmp@reg@quad@a{\xintfloateval{(\LXCYSomme*\LXXSomme-\LXYSomme*\LXXCSomme)/(\LXXSomme*\LXCXCSomme-(\LXXCSomme)^2)}}% + \xdef\tmp@reg@quad@c{\xintfloateval{\LYmoy-(\tmp@reg@quad@b)*\LXmoy-(\tmp@reg@quad@a)*\LXCmoy}}% + %STOCKAGE + \IfStrEq{\RegQuadRound}{}% + {% + \expandafter\def\csname\RegQuadCoefb\endcsname{\tmp@reg@quad@b}% + \expandafter\def\csname\RegQuadCoefa\endcsname{\tmp@reg@quad@a}% + \expandafter\def\csname\RegQuadCoefc\endcsname{\tmp@reg@quad@c}% + }% + {% + \IfSubStr{\RegQuadRound}{/}% + {% + \StrBefore[1]{\RegQuadRound}{/}[\xintarrondisregquada]% + \StrBetween[1,2]{\RegQuadRound}{/}{/}[\xintarrondisregquadb]% + \StrBehind[2]{\RegQuadRound}{/}[\xintarrondisregquadc]% + }% + {% + \xdef\xintarrondisregquada{\RegQuadRound}% + \xdef\xintarrondisregquadb{\RegQuadRound}% + \xdef\xintarrondisregquadc{\RegQuadRound}% + + }% + \expandafter\def\csname\RegQuadCoefb\endcsname{\xintfloateval{round(\tmp@reg@quad@b,\xintarrondisregquadb)}}% + \expandafter\def\csname\RegQuadCoefa\endcsname{\xintfloateval{round(\tmp@reg@quad@a,\xintarrondisregquada)}}% + \expandafter\def\csname\RegQuadCoefc\endcsname{\xintfloateval{round(\tmp@reg@quad@c,\xintarrondisregquadc)}}% + }% +} + +%régression puissance a*x^b +\defKV[CoeffRegPuiss]{% + coeffa=\def\RegPuissCoefa{#1},% + coeffb=\def\RegPuissCoefb{#1},% + round=\def\RegPuissRound{#1} +} + +\setKVdefault[CoeffRegPuiss]{% + coeffa=powrega,% + coeffb=powregb,% + round={} +} + +\newcommand\xintpowreg[3][]{% + \useKVdefault[CoeffRegPuiss]% + \setKV[CoeffRegPuiss]{#1}% on paramètres les nouvelles clés et on les simplifie + %listes des données + \def\xliste{#2}% + \def\yliste{#3}% + \readlist*\LX{\xliste}% + \readlist*\LY{\yliste}% + %taille des listes + \def\LNB{\inteval{\LXlen}}% + %somme importantes + \xdef\LlnXSomme{0}% + \xdef\LlnYSomme{0}% + \xdef\LlnXlnYSomme{0}% + \xdef\LlncXSomme{0}% + %calculs + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LlnXSomme{\xintfloateval{\LlnXSomme+log(\LX[##1])}}% + \xdef\LlnYSomme{\xintfloateval{\LlnYSomme+log(\LY[##1])}}% + \xdef\LlnXlnYSomme{\xintfloateval{\LlnXlnYSomme+log(\LX[##1])*log(\LY[##1])}}% + \xdef\LlncXSomme{\xintfloateval{\LlncXSomme+(log(\LX[##1]))^2}}% + }% + %COEFFS TEMPORAIRES OK + \xdef\tmp@reg@pow@b{\xintfloateval{(\LNB*\LlnXlnYSomme-\LlnXSomme*\LlnYSomme)/(\LNB*\LlncXSomme-(\LlnXSomme)^2)}}% + \xdef\tmp@reg@pow@a{\xintfloateval{exp(1/\LNB*\LlnYSomme-(\tmp@reg@pow@b)/\LNB*\LlnXSomme)}}% + %STOCKAGE + \IfStrEq{\RegPuissRound}{}% + {% + \expandafter\def\csname\RegPuissCoefb\endcsname{\xintfloateval{\tmp@reg@pow@b}}% + \expandafter\def\csname\RegPuissCoefa\endcsname{\xintfloateval{\tmp@reg@pow@a}}% + }% + {% + \IfSubStr{\RegPuissRound}{/}% + {% + \StrCut{\RegPuissRound}{/}{\xintarrondisregpowa}{\xintarrondisregpowb}% + }% + {% + \xdef\xintarrondisregpowa{\RegPuissRound}\xdef\xintrrondisregpowb{\RegPuissRound}% + }% + \expandafter\def\csname\RegPuissCoefb\endcsname{\xintfloateval{round(\tmp@reg@pow@b,\xintarrondisregpowb)}}% + \expandafter\def\csname\RegPuissCoefa\endcsname{\xintfloateval{round(\tmp@reg@pow@a,\xintarrondisregpowa)}}% + }% +} + +%régression a*b^x +\defKV[CoeffRegExpoAB]{% + coeffa=\def\RegExpoCoefa{#1},% + coeffb=\def\RegExpoCoefb{#1},% + round=\def\RegExpoRound{#1} +} + +\setKVdefault[CoeffRegExpoAB]{% + coeffa=expabrega,% + coeffb=expabregb,% + round={} +} + +\newcommand\xintexpabreg[3][]{% + \useKVdefault[CoeffRegExpoAB]% + \setKV[CoeffRegExpoAB]{#1}% on paramètres les nouvelles clés et on les simplifie + %listes des données + \def\xliste{#2}% + \def\yliste{#3}% + \readlist*\LX{\xliste}% + \readlist*\LY{\yliste}% + %taille des listes + \def\LNB{\inteval{\LXlen}}% + %somme importantes + \xdef\LXlnYSomme{0}% + \xdef\LXSomme{0}% + \xdef\LlnYSomme{0}% + \xdef\LXcSomme{0}% + %calculs + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LXlnYSomme{\xintfloateval{\LXlnYSomme+\LX[##1]*log(\LY[##1])}}% + \xdef\LXSomme{\xintfloateval{\LXSomme+\LX[##1]}}% + \xdef\LlnYSomme{\xintfloateval{\LlnYSomme+log(\LY[##1])}}% + \xdef\LXcSomme{\xintfloateval{\LXcSomme+(\LX[##1])^2}}% + }% + %COEFFS TEMPORAIRES OK + \xdef\tmp@reg@expab@b{\xintfloateval{exp((\LNB*\LXlnYSomme-\LXSomme*\LlnYSomme)/(\LNB*\LXcSomme-(\LXSomme)^2))}}% + \xdef\tmp@reg@expab@a{\xintfloateval{exp(1/\LNB*\LlnYSomme-log(\tmp@reg@expab@b)/\LNB*\LXSomme)}}% + %STOCKAGE + \IfStrEq{\RegExpoRound}{}% + {% + \expandafter\def\csname\RegExpoCoefb\endcsname{\tmp@reg@expab@b}% + \expandafter\def\csname\RegExpoCoefa\endcsname{\tmp@reg@expab@a}% + }% + {% + \IfSubStr{\RegExpoRound}{/}% + {% + \StrCut{\RegExpoRound}{/}{\xintarrondisregexpoaba}{\xintarrondisregexpoabb}% + }% + {% + \xdef\xintarrondisregexpoaba{\RegExpoRound}\xdef\xintarrondisregexpoabb{\RegExpoRound}% + }% + \expandafter\def\csname\RegExpoCoefb\endcsname{\xintfloateval{round(\tmp@reg@expab@b,\xintarrondisregexpoabb)}}% + \expandafter\def\csname\RegExpoCoefa\endcsname{\xintfloateval{round(\tmp@reg@expab@a,\xintarrondisregexpoaba)}}% + }% +} + +%régression a+b/x +\defKV[CoeffRegHyperb]{% + coeffa=\def\RegHyperbCoefa{#1},% + coeffb=\def\RegHyperbCoefb{#1},% + round=\def\RegHyperbRound{#1} +} + +\setKVdefault[CoeffRegHyperb]{% + coeffa=hyprega,% + coeffb=hypregb,% + round={} +} + +\newcommand\xinthypreg[3][]{% + \useKVdefault[CoeffRegHyperb]% + \setKV[CoeffRegHyperb]{#1}% on paramètres les nouvelles clés et on les simplifie + %listes des données + \def\xliste{#2}% + \def\yliste{#3}% + \readlist*\LX{\xliste}% + \readlist*\LY{\yliste}% + %taille des listes + \def\LNB{\inteval{\LXlen}}% + %somme importantes + \xdef\LinvXSomme{0}% + \xdef\LYdivXSomme{0}% + \xdef\LYSomme{0}% + \xdef\LinvXcSomme{0}% + %calculs + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LinvXSomme{\xintfloateval{\LinvXSomme+1/\LX[##1]}}% + \xdef\LYdivXSomme{\xintfloateval{\LYdivXSomme+\LY[##1]/\LX[##1]}}% + \xdef\LYSomme{\xintfloateval{\LYSomme+\LY[##1]}}% + \xdef\LinvXcSomme{\xintfloateval{\LinvXcSomme+1/(\LX[##1])^2}}% + }% + %COEFFS TEMPORAIRES OK + \xdef\tmp@reg@hyp@b{\xintfloateval{(\LNB*\LYdivXSomme-\LinvXSomme*\LYSomme)/(\LNB*\LinvXcSomme-(\LinvXSomme)^2)}}% + \xdef\tmp@reg@hyp@a{\xintfloateval{1/\LNB*\LYSomme-(\tmp@reg@hyp@b)/\LNB*\LinvXSomme}}% + %STOCKAGE + \IfStrEq{\RegHyperbRound}{}% + {% + \expandafter\def\csname\RegHyperbCoefb\endcsname{\tmp@reg@hyp@b}% + \expandafter\def\csname\RegHyperbCoefa\endcsname{\tmp@reg@hyp@a}% + }% + {% + \IfSubStr{\RegHyperbRound}{/}% + {% + \StrCut{\RegHyperbRound}{/}{\xintarrondisreghypa}{\xintarrondisreghypb}% + }% + {% + \xdef\xintarrondisreghypa{\RegHyperbRound}\xdef\xintarrondisreghypb{\RegHyperbRound}% + }% + \expandafter\def\csname\RegHyperbCoefb\endcsname{\xintfloateval{round(\tmp@reg@hyp@b,\xintarrondisreghypb)}}% + \expandafter\def\csname\RegHyperbCoefa\endcsname{\xintfloateval{round(\tmp@reg@hyp@a,\xintarrondisreghypa)}}% + }% +} + +%régression a+b*ln(x) +\defKV[CoeffRegLog]{% + coeffa=\def\RegLogCoefa{#1},% + coeffb=\def\RegLogCoefb{#1},% + round=\def\RegLogRound{#1} +} + +\setKVdefault[CoeffRegLog]{% + coeffa=logrega,% + coeffb=logregb,% + round={} +} + +\newcommand\xintlogreg[3][]{% + \useKVdefault[CoeffRegLog]% + \setKV[CoeffRegLog]{#1}% on paramètres les nouvelles clés et on les simplifie + %listes des données + \def\xliste{#2}% + \def\yliste{#3}% + \readlist*\LX{\xliste}% + \readlist*\LY{\yliste}% + %taille des listes + \def\LNB{\inteval{\LXlen}}% + %somme importantes + \xdef\LYlnXSomme{0}% + \xdef\LlnXSomme{0}% + \xdef\LYSomme{0}% + \xdef\LYlncXSomme{0}% + %calculs + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LYlnXSomme{\xintfloateval{\LYlnXSomme+\LY[##1]*log(\LX[##1])}}% + \xdef\LlnXSomme{\xintfloateval{\LlnXSomme+log(\LX[##1])}}% + \xdef\LYSomme{\xintfloateval{\LYSomme+\LY[##1]}}% + \xdef\LYlncXSomme{\xintfloateval{\LYlncXSomme+log(\LX[##1])^2}}% + }% + %COEFFS TEMPORAIRES OK + \xdef\tmp@reg@log@b{\xintfloateval{(\LNB*\LYlnXSomme-\LlnXSomme*\LYSomme)/(\LNB*\LYlncXSomme-(\LlnXSomme)^2)}}% + \xdef\tmp@reg@log@a{\xintfloateval{1/\LNB*\LYSomme-(\tmp@reg@log@b)/\LNB*\LlnXSomme}}% + %STOCKAGE + \IfStrEq{\RegLogRound}{}% + {% + \expandafter\def\csname\RegLogCoefb\endcsname{\tmp@reg@log@b}% + \expandafter\def\csname\RegLogCoefa\endcsname{\tmp@reg@log@a}% + }% + {% + \IfSubStr{\RegLogRound}{/}% + {% + \StrCut{\RegLogRound}{/}{\xintarrondisregloga}{\xintarrondisreglogb}% + }% + {% + \xdef\xintarrondisregloga{\RegLogRound}\xdef\xintarrondisreglogb{\RegLogRound}% + }% + \expandafter\def\csname\RegLogCoefb\endcsname{\xintfloateval{round(\tmp@reg@log@b,\xintarrondisreglogb)}}% + \expandafter\def\csname\RegLogCoefa\endcsname{\xintfloateval{round(\tmp@reg@log@a,\xintarrondisregloga)}}% + }% +} + +%régression e^(ax+b) +\defKV[CoeffRegExpo]{% + coeffa=\def\RegExpoNCoefa{#1},% + coeffb=\def\RegExpoNCoefb{#1},% + round=\def\RegExpoNRound{#1} +} + +\setKVdefault[CoeffRegExpo]{% + coeffa=exprega,% + coeffb=expregb,% + Alt=false,% + round={} +} + +\newcommand\xintexpreg[3][]{% + \useKVdefault[CoeffRegExpo]% + \setKV[CoeffRegExpo]{#1}% on paramètres les nouvelles clés et on les simplifie + %listes des données + \def\xliste{#2}% + \def\yliste{#3}% + \readlist*\LX{\xliste}% + \readlist*\LY{\yliste}% + %taille des listes + \def\LNB{\inteval{\LXlen}}% + %somme importantes + \xdef\LXlnYSomme{0}% + \xdef\LXSomme{0}% + \xdef\LlnYSomme{0}% + \xdef\LXcSomme{0}% + %calculs + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LXlnYSomme{\xintfloateval{\LXlnYSomme+\LX[##1]*log(\LY[##1])}}% + \xdef\LXSomme{\xintfloateval{\LXSomme+\LX[##1]}}% + \xdef\LlnYSomme{\xintfloateval{\LlnYSomme+log(\LY[##1])}}% + \xdef\LXcSomme{\xintfloateval{\LXcSomme+(\LX[##1])^2}}% + }% + %COEFFS TEMPORAIRES + \xdef\TmpCoeffExpoA{\xintfloateval{(\LNB*\LXlnYSomme-\LXSomme*\LlnYSomme)/(\LNB*\LXcSomme-(\LXSomme)^2)}}% + \xdef\TmpCoeffExpoB{\xintfloateval{1/\LNB*\LlnYSomme-(\TmpCoeffExpoA)/\LNB*\LXSomme}}% + \ifboolKV[CoeffRegExpo]{Alt}% + {% + %STOCKAGE + \IfStrEq{\RegExpoNRound}{}% + {% + \expandafter\def\csname\RegExpoNCoefb\endcsname{\xintfloateval{exp(\TmpCoeffExpoB)}}% + \expandafter\def\csname\RegExpoNCoefa\endcsname{\TmpCoeffExpoA}% + }% + {% + \IfSubStr{\RegExpoNRound}{/}% + {% + \StrCut{\RegExpoNRound}{/}{\xintarrondisregexpoa}{\xintarrondisregexpob}% + }% + {% + \xdef\xintarrondisregexpoa{\RegExpoNRound}\xdef\xintarrondisregexpob{\RegExpoNRound}% + }% + \expandafter\def\csname\RegExpoNCoefb\endcsname{\xintfloateval{round(exp(\TmpCoeffExpoB),\xintarrondisregexpob)}}% + \expandafter\def\csname\RegExpoNCoefa\endcsname{\xintfloateval{round(\TmpCoeffExpoA,\xintarrondisregexpoa)}}% + }% + }% + {% + %STOCKAGE + \IfStrEq{\RegExpoNRound}{}% + {% + \expandafter\def\csname\RegExpoNCoefb\endcsname{\TmpCoeffExpoB}% + \expandafter\def\csname\RegExpoNCoefa\endcsname{\TmpCoeffExpoA}% + }% + {% + \IfSubStr{\RegExpoNRound}{/}% + {% + \StrCut{\RegExpoNRound}{/}{\xintarrondisregexpoa}{\xintarrondisregexpob}% + }% + {% + \xdef\xintarrondisregexpoa{\RegExpoNRound}\xdef\xintarrondisregexpob{\RegExpoNRound}% + }% + \expandafter\def\csname\RegExpoNCoefb\endcsname{\xintfloateval{round(\TmpCoeffExpoB,\xintarrondisregexpob)}}% + \expandafter\def\csname\RegExpoNCoefa\endcsname{\xintfloateval{round(\TmpCoeffExpoA,\xintarrondisregexpoa)}}% + }% + }% +} + +%régression C + b*e^(ax) +\defKV[CoeffRegExpoOff]{% + coeffa=\def\RegExpoOffCoefa{#1},% + coeffb=\def\RegExpoOffCoefb{#1},% + offset=\def\RegExpoOffset{#1},% + round=\def\RegExpoOffRound{#1} +} + +\setKVdefault[CoeffRegExpoOff]{% + coeffa=expregoffa,% + coeffb=expregoffb,% + offset=0,% + round={} +} + +\newcommand\xintexpoffreg[3][]{% + \useKVdefault[CoeffRegExpoOff]% + \setKV[CoeffRegExpoOff]{#1}% on paramètres les nouvelles clés et on les simplifie + %listes des données + \def\xliste{#2}% + \def\yliste{#3}% + \readlist*\LX{\xliste}% + \readlist*\LY{\yliste}% + %taille des listes + \def\LNB{\inteval{\LXlen}}% + %somme importantes + \xdef\LXlnYSomme{0}% + \xdef\LXSomme{0}% + \xdef\LlnYSomme{0}% + \xdef\LXcSomme{0}% + %calculs + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LXlnYSomme{\xintfloateval{\LXlnYSomme+\LX[##1]*log(\LY[##1]-\RegExpoOffset)}}% + \xdef\LXSomme{\xintfloateval{\LXSomme+\LX[##1]}}% + \xdef\LlnYSomme{\xintfloateval{\LlnYSomme+log(\LY[##1]-\RegExpoOffset)}}% + \xdef\LXcSomme{\xintfloateval{\LXcSomme+(\LX[##1])^2}}% + }% + %COEFFS TEMPORAIRES + \xdef\TmpCoeffExpoA{\xintfloateval{(\LNB*\LXlnYSomme-\LXSomme*\LlnYSomme)/(\LNB*\LXcSomme-(\LXSomme)^2)}}% + \xdef\TmpCoeffExpoB{\xintfloateval{1/\LNB*\LlnYSomme-(\TmpCoeffExpoA)/\LNB*\LXSomme}}% + %STOCKAGE + \IfStrEq{\RegExpoOffRound}{}% + {% + \expandafter\def\csname\RegExpoOffCoefb\endcsname{\xintfloateval{exp(\TmpCoeffExpoB)}}% + \expandafter\def\csname\RegExpoOffCoefa\endcsname{\xintfloateval{\TmpCoeffExpoA}}% + }% + {% + \IfSubStr{\RegExpoOffRound}{/}% + {% + \StrCut{\RegExpoOffRound}{/}{\xintarrondisregexpoffa}{\xintarrondisregexpoffb}% + }% + {% + \xdef\xintarrondisregexpoffa{\RegExpoOffRound}\xdef\xintarrondisregexpoffb{\RegExpoOffRound}% + }% + \expandafter\def\csname\RegExpoOffCoefb\endcsname{\xintfloateval{round(exp(\TmpCoeffExpoB),\xintarrondisregexpoffb)}}% + \expandafter\def\csname\RegExpoOffCoefa\endcsname{\xintfloateval{round(\TmpCoeffExpoA,\xintarrondisregexpoffa)}}% + }% +} + +%régression cubique +\defKV[CoeffRegCubic]{% + coeffa=\def\RegCubicCoefa{#1},% + coeffb=\def\RegCubicCoefb{#1},% + coeffc=\def\RegCubicCoefc{#1},% + coeffd=\def\RegCubicCoefd{#1},% + round=\def\RegCubicRound{#1} +} + +\setKVdefault[CoeffRegCubic]{% + coeffa=cubrega,% + coeffb=cubregb,% + coeffc=cubregc,% + coeffd=cubregd,% + round={} +} + +\newcommand\xintcubreg[3][]{% + \useKVdefault[CoeffRegCubic]% + \setKV[CoeffRegCubic]{#1}% on paramètres les nouvelles clés et on les simplifie + %listes des données + \def\xliste{#2}% + \def\yliste{#3}% + \readlist*\LX{\xliste}% + \readlist*\LY{\yliste}% + %taille des listes + \def\LNB{\inteval{\LXlen}}% + %somme importantes + \xdef\LXSomme{0}% + \xdef\LXdSomme{0}% + \xdef\LXtSomme{0}% + \xdef\LXqSomme{0}% + \xdef\LXcSomme{0}% + \xdef\LXsSomme{0}% + \xdef\LYSomme{0}% + \xdef\LXYSomme{0}% + \xdef\LXdYSomme{0}% + \xdef\LXtYSomme{0}% + %calculs + \xintFor* ##1 in {\xintSeq{1}{\LNB}}\do{% + \xdef\LXSomme{\xintfloateval{\LXSomme+\LX[##1]}}% + \xdef\LXdSomme{\xintfloateval{\LXdSomme+(\LX[##1])^2}}% + \xdef\LXtSomme{\xintfloateval{\LXtSomme+(\LX[##1])^3}}% + \xdef\LXqSomme{\xintfloateval{\LXqSomme+(\LX[##1])^4}}% + \xdef\LXcSomme{\xintfloateval{\LXcSomme+(\LX[##1])^5}}% + \xdef\LXsSomme{\xintfloateval{\LXsSomme+(\LX[##1])^6}}% + \xdef\LYSomme{\xintfloateval{\LYSomme+\LY[##1]}}% + \xdef\LXYSomme{\xintfloateval{\LXYSomme+\LX[##1]*\LY[##1]}}% + \xdef\LXdYSomme{\xintfloateval{\LXdYSomme+(\LX[##1])^2*\LY[##1]}}% + \xdef\LXtYSomme{\xintfloateval{\LXtYSomme+(\LX[##1])^3*\LY[##1]}}% + }% + %calculs suites, avec des matrices !! + \def\MatA{\LXtSomme}% + \def\MatB{\LXdSomme}% + \def\MatC{\LXSomme}% + \def\MatD{\LNB}% + \def\MatE{\LXqSomme}% + \def\MatF{\LXtSomme}% + \def\MatG{\LXdSomme}% + \def\MatH{\LXSomme}% + \def\MatI{\LXcSomme}% + \def\MatJ{\LXqSomme}% + \def\MatK{\LXtSomme}% + \def\MatL{\LXdSomme}% + \def\MatM{\LXsSomme}% + \def\MatN{\LXcSomme}% + \def\MatO{\LXqSomme}% + \def\MatP{\LXtSomme}% + \def\MatBA{\LYSomme}% + \def\MatBB{\LXYSomme}% + \def\MatBC{\LXdYSomme}% + \def\MatBD{\LXtYSomme}% + \def\DETMATRICE{\xintfloateval{\MatA*\MatF*\MatK*\MatP-\MatA*\MatF*\MatL*\MatO-\MatA*\MatG*\MatJ*\MatP+\MatA*\MatG*\MatL*\MatN+\MatA*\MatH*\MatJ*\MatO-\MatA*\MatH*\MatK*\MatN-\MatB*\MatE*\MatK*\MatP+\MatB*\MatE*\MatL*\MatO+\MatB*\MatG*\MatI*\MatP-\MatB*\MatG*\MatL*\MatM-\MatB*\MatH*\MatI*\MatO+\MatB*\MatH*\MatK*\MatM+\MatC*\MatE*\MatJ*\MatP-\MatC*\MatE*\MatL*\MatN-\MatC*\MatF*\MatI*\MatP+\MatC*\MatF*\MatL*\MatM+\MatC*\MatH*\MatI*\MatN-\MatC*\MatH*\MatJ*\MatM-\MatD*\MatE*\MatJ*\MatO+\MatD*\MatE*\MatK*\MatN+\MatD*\MatF*\MatI*\MatO-\MatD*\MatF*\MatK*\MatM-\MatD*\MatG*\MatI*\MatN+\MatD*\MatG*\MatJ*\MatM}}% + \def\MatInvA{(\MatF*\MatK*\MatP-\MatF*\MatL*\MatO-\MatG*\MatJ*\MatP+\MatG*\MatL*\MatN+\MatH*\MatJ*\MatO-\MatH*\MatK*\MatN)/\DETMATRICE}% + \def\MatInvB{(-\MatB*\MatK*\MatP+\MatB*\MatL*\MatO+\MatC*\MatJ*\MatP-\MatC*\MatL*\MatN-\MatD*\MatJ*\MatO+\MatD*\MatK*\MatN)/\DETMATRICE}% + \def\MatInvC{(\MatB*\MatG*\MatP-\MatB*\MatH*\MatO-\MatC*\MatF*\MatP+\MatC*\MatH*\MatN+\MatD*\MatF*\MatO-\MatD*\MatG*\MatN)/\DETMATRICE}% + \def\MatInvD{(-\MatB*\MatG*\MatL+\MatB*\MatH*\MatK+\MatC*\MatF*\MatL-\MatC*\MatH*\MatJ-\MatD*\MatF*\MatK+\MatD*\MatG*\MatJ)/\DETMATRICE}% + \def\MatInvE{(-\MatE*\MatK*\MatP+\MatE*\MatL*\MatO+\MatG*\MatI*\MatP-\MatG*\MatL*\MatM-\MatH*\MatI*\MatO+\MatH*\MatK*\MatM)/\DETMATRICE}% + \def\MatInvF{(\MatA*\MatK*\MatP-\MatA*\MatL*\MatO-\MatC*\MatI*\MatP+\MatC*\MatL*\MatM+\MatD*\MatI*\MatO-\MatD*\MatK*\MatM)/\DETMATRICE}% + \def\MatInvG{(-\MatA*\MatG*\MatP+\MatA*\MatH*\MatO+\MatC*\MatE*\MatP-\MatC*\MatH*\MatM-\MatD*\MatE*\MatO+\MatD*\MatG*\MatM)/\DETMATRICE}% + \def\MatInvH{(\MatA*\MatG*\MatL-\MatA*\MatH*\MatK-\MatC*\MatE*\MatL+\MatC*\MatH*\MatI+\MatD*\MatE*\MatK-\MatD*\MatG*\MatI)/\DETMATRICE}% + \def\MatInvI{(\MatE*\MatJ*\MatP-\MatE*\MatL*\MatN-\MatF*\MatI*\MatP+\MatF*\MatL*\MatM+\MatH*\MatI*\MatN-\MatH*\MatJ*\MatM)/\DETMATRICE}% + \def\MatInvJ{(-\MatA*\MatJ*\MatP+\MatA*\MatL*\MatN+\MatB*\MatI*\MatP-\MatB*\MatL*\MatM-\MatD*\MatI*\MatN+\MatD*\MatJ*\MatM)/\DETMATRICE}% + \def\MatInvK{(\MatA*\MatF*\MatP-\MatA*\MatH*\MatN-\MatB*\MatE*\MatP+\MatB*\MatH*\MatM+\MatD*\MatE*\MatN-\MatD*\MatF*\MatM)/\DETMATRICE}% + \def\MatInvL{(-\MatA*\MatF*\MatL+\MatA*\MatH*\MatJ+\MatB*\MatE*\MatL-\MatB*\MatH*\MatI-\MatD*\MatE*\MatJ+\MatD*\MatF*\MatI)/\DETMATRICE}% + \def\MatInvM{(-\MatE*\MatJ*\MatO+\MatE*\MatK*\MatN+\MatF*\MatI*\MatO-\MatF*\MatK*\MatM-\MatG*\MatI*\MatN+\MatG*\MatJ*\MatM)/\DETMATRICE}% + \def\MatInvN{(\MatA*\MatJ*\MatO-\MatA*\MatK*\MatN-\MatB*\MatI*\MatO+\MatB*\MatK*\MatM+\MatC*\MatI*\MatN-\MatC*\MatJ*\MatM)/\DETMATRICE}% + \def\MatInvO{(-\MatA*\MatF*\MatO+\MatA*\MatG*\MatN+\MatB*\MatE*\MatO-\MatB*\MatG*\MatM-\MatC*\MatE*\MatN+\MatC*\MatF*\MatM)/\DETMATRICE}% + \def\MatInvP{(\MatA*\MatF*\MatK-\MatA*\MatG*\MatJ-\MatB*\MatE*\MatK+\MatB*\MatG*\MatI+\MatC*\MatE*\MatJ-\MatC*\MatF*\MatI)/\DETMATRICE}% + %COEFFS TEMPORAIRES OK + \xdef\tmp@reg@cub@a{\xintfloateval{\MatInvA*\MatBA+\MatInvB*\MatBB+\MatInvC*\MatBC+\MatInvD*\MatBD}}% + \xdef\tmp@reg@cub@b{\xintfloateval{\MatInvE*\MatBA+\MatInvF*\MatBB+\MatInvG*\MatBC+\MatInvH*\MatBD}}% + \xdef\tmp@reg@cub@c{\xintfloateval{\MatInvI*\MatBA+\MatInvJ*\MatBB+\MatInvK*\MatBC+\MatInvL*\MatBD}}% + \xdef\tmp@reg@cub@d{\xintfloateval{\MatInvM*\MatBA+\MatInvN*\MatBB+\MatInvO*\MatBC+\MatInvP*\MatBD}}% + %STOCKAGE + \IfStrEq{\RegCubicRound}{}% + {% + \expandafter\def\csname\RegCubicCoefa\endcsname{\tmp@reg@cub@a}% + \expandafter\def\csname\RegCubicCoefb\endcsname{\tmp@reg@cub@b}% + \expandafter\def\csname\RegCubicCoefc\endcsname{\tmp@reg@cub@c}% + \expandafter\def\csname\RegCubicCoefd\endcsname{\tmp@reg@cub@d}% + }% + {% + \IfSubStr{\RegCubicRound}{/}% + {% + \StrBefore[1]{\RegCubicRound}{/}[\xintarrondisregcuba]% + \StrBetween[1,2]{\RegCubicRound}{/}{/}[\xintarrondisregcubb]% + \StrBetween[2,3]{\RegCubicRound}{/}{/}[\xintarrondisregcubc]% + \StrBehind[3]{\RegCubicRound}{/}[\xintarrondisregcubd]% + }% + {% + \xdef\xintarrondisregcuba{\RegCubicRound}% + \xdef\xintarrondisregcubb{\RegCubicRound}% + \xdef\xintarrondisregcubc{\RegCubicRound}% + \xdef\xintarrondisregcubd{\RegCubicRound}% + }% + \expandafter\def\csname\RegCubicCoefa\endcsname{\xintfloateval{round(\tmp@reg@cub@a,\xintarrondisregcuba)}}% + \expandafter\def\csname\RegCubicCoefb\endcsname{\xintfloateval{round(\tmp@reg@cub@b,\xintarrondisregcubb)}}% + \expandafter\def\csname\RegCubicCoefc\endcsname{\xintfloateval{round(\tmp@reg@cub@c,\xintarrondisregcubc)}}% + \expandafter\def\csname\RegCubicCoefd\endcsname{\xintfloateval{round(\tmp@reg@cub@d,\xintarrondisregcubd)}}% + }% +} + +\endinput
\ No newline at end of file |