summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pas-cours/macro-calculs.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-09-11 22:32:47 +0000
committerKarl Berry <karl@freefriends.org>2016-09-11 22:32:47 +0000
commitf2ae127564f5c32956a455cd4ec16b3b13ff3190 (patch)
treed2ac7e1a81b835b8bd352c92f772de56fd0bd68e /Master/texmf-dist/doc/latex/pas-cours/macro-calculs.tex
parentc9ba4cdc8383cbfc52687201c455a367d1824924 (diff)
pas-cours (11sep16)
git-svn-id: svn://tug.org/texlive/trunk@42036 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/pas-cours/macro-calculs.tex')
-rw-r--r--Master/texmf-dist/doc/latex/pas-cours/macro-calculs.tex45
1 files changed, 45 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/pas-cours/macro-calculs.tex b/Master/texmf-dist/doc/latex/pas-cours/macro-calculs.tex
new file mode 100644
index 00000000000..ae6f27cc5d9
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/pas-cours/macro-calculs.tex
@@ -0,0 +1,45 @@
+% environnement "ifactors" : decomposition en produit de facteurs premiers
+
+\begin{VerbatimOut}{decomp.cxx}
+maple_mode(0);
+n:=read("n.val");
+F:=ifactors(n);
+l:=size(F);
+T:="";
+c:=0;
+for (k:=0;k<l;k:=k+2) { if c!=0 then T:=T+"\\times"; end_if T:=T+F[k]+"^{"+F[k+1]+"}"; c++; };
+Sortie:=fopen("decomp.tex");
+fprint(Sortie,Unquoted,T);
+fclose(Sortie);
+\end{VerbatimOut}
+
+\newenvironment*{ifactors}
+{\VerbatimEnvironment\begin{VerbatimOut}{n.val}}
+{\end{VerbatimOut}
+\immediate\write18{giac <decomp.cxx}
+\ensuremath{\input{decomp.tex}}
+}
+
+% environnement "ifactors_table"
+
+\begin{VerbatimOut}{decomp_table.cxx}
+maple_mode(0);
+n:=read("n.val");
+F:=ifactors(n);
+l:=size(F);
+for (k:=0;k<l;k:=k+2){ L[k/2]:=F[k]; };
+T:="\\begin{tabular}{r|l}";
+k:=0;
+while (n!=1) { T:=T+n+"&"; if (irem(n,L[k])==0) { T:=T+L[k]+"\\\\"; n:=n/L[k]; } else { k:=k+1; T:=T+L[k]+"\\\\"; n:=n/L[k]; }; };
+T:=T+"1 & \\\\\\end{tabular}";
+Sortie:=fopen("decomp_table.tex");
+fprint(Sortie,Unquoted,T);
+fclose(Sortie);
+\end{VerbatimOut}
+
+\newenvironment*{ifactorstable}
+{\VerbatimEnvironment\begin{VerbatimOut}{n.val}}
+{\end{VerbatimOut}
+\immediate\write18{giac <decomp_table.cxx}
+\input{decomp_table.tex}
+} \ No newline at end of file