\documentclass[10pt]{article}
 \usepackage{fancyvrb,amsmath}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[table,svgnames]{xcolor}
\usepackage[margin=1cm]{geometry}
\usepackage[colorlinks=true]{hyperref}
\usepackage{fourier,nopageno,slashbox}

%%%% un peu de giac/xcas

\makeatletter
\newcommand{\executGiacmp}[1]{
\immediate\write18{giac  <#1 } }
\makeatother


\begin{VerbatimOut}{XCASloipoisson.cxx}
loipoisson(L):={
  local x, y, dx, I, T, k, l, c;
  x:=L[0];
  y:=L[1];
  dx:=L[2];
  c:=L[0]+1;
  T:="\\begin{tabular}{*{"+c+"}{|c}|}
       \\hline \\backslashbox{$k$}{$\\lambda$} ";
  for(l:=dx; l<=dx*x; l:=l+dx) 
  {
  	T:=T+" & \\cellcolor{Moccasin}"+l;
  }
  T:=T+"\\\\\\hline";
  for(k:=0; k<=y; k:=k+1)
  {
  	for(l:=0; l<=dx*x; l:=l+dx) 
  	{
	  	if(l==0)
	  	then{T:=T+"\\cellcolor{Moccasin}"+k+"&"}
	  	else
	  	{
	  		I:=evalf(exp(-l)*(l^k)/factorial(k));
	  		if(l==dx*x)
	  		then{T:=T+latex(I)+"\\\\\\hline"}
	  		else{T:=T+latex(I)+"&"}
	  	}
	 	}
  }
  T:=T+"\\end{tabular}";
}
:;
\end{VerbatimOut}

\begin{VerbatimOut}{XCASloipoisson.giac}
maple_mode(0);
read("XCASloipoisson.cxx");
Sortie:=fopen("XCASloipoisson.tex");
donnees:=read("XCASloipoisson.user");
Resultat:=cat("loipoisson(",donnees);
Resultat:=cat(Resultat,");");
Resultat:=expr(Resultat);
fprint(Sortie,Unquoted,Resultat);
fclose(Sortie);
\end{VerbatimOut}

\newenvironment{loipoisson}
{\VerbatimEnvironment\begin{VerbatimOut}{XCASloipoisson.user}}
{\end{VerbatimOut}
           \executGiacmp{XCASloipoisson.giac}

\input{XCASloipoisson}
}


\begin{document}

\begin{center}
\begin{Large}\bfseries \textcolor{DarkRed}{Table de la loi de Poisson $\mathcal{P}(\lambda)$}\end{Large}\\
\url{http://www.mathweb.fr}

\arrayrulecolor{DarkRed}

\[ P(X=k)=\frac{e^{-\lambda}\lambda^k}{k!} \qquad ; \qquad E(X)=V(X)=\sigma^2=\lambda\]

\bigskip


\begin{loipoisson}
9,8,0.1
\end{loipoisson}


\medskip

\begin{loipoisson}
10,22,1
\end{loipoisson}
\end{center}

\bigskip

\paragraph*{Exemple d'application :} $X$ suit une loi  de Poisson de paramètre $\lambda=5$ ; alors $P(X=7)=0,104445$.
\end{document}
