File: macro-calculs.tex

package info (click to toggle)
texlive-extra 2016.20170123-5
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 2,578,600 kB
  • ctags: 25,000
  • sloc: perl: 139,711; python: 20,370; makefile: 14,165; sh: 10,734; ansic: 7,723; xml: 4,202; java: 3,567; csh: 1,129; ruby: 938; lisp: 630; awk: 163; tcl: 142; sed: 36; pascal: 25; cpp: 18; haskell: 5
file content (45 lines) | stat: -rw-r--r-- 1,176 bytes parent folder | download | duplicates (2)
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
% 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}
}