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

%%%% un peu de giac/xcas

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

\begin{VerbatimOut}{XCASloichideux.cxx}
loichideux(L):={
  local v, a, b, c, dx, T, val;
  v:=L[0];
  a:=L[1];
  b:=L[2];
  dx:=L[3];
  c:=floor((b-a)/dx)+1;
  ct:=c+1;
  T:="\\begin{tabular}{*{"+ct+"}{|c}|}
       \\hline \\backslashbox{$\\nu$}{$\\alpha$}
        ";
  for(x:=1;x<=c;x:=x+1)
  {
  	 val:=a+(x-1)*dx;
     T:=T+"& \\cellcolor{Moccasin}"+val;
  }
  T:=T+" \\\\\\hline";
  for(y:=1; y<=v; y:=y+1)
  {
  	for(x:=0; x<=c; x:=x+1) 
  	{
  		if(x==0)then{T:=T+"\\cellcolor{Moccasin}"+y+" &"}else{
		I:=evalf( chisquare_icdf(y,1-a-(x-1)*dx) );
	  	if(x==c)then{T:=T+latex(I)+"\\\\\\hline"}else{T:=T+latex(I)+"&"}
	  	}
	}
  }
  T:=T+"\\end{tabular}";
}
:;
\end{VerbatimOut}

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

\newenvironment{loichideux}
{\VerbatimEnvironment\begin{VerbatimOut}{XCASloichideux.user}}
{\end{VerbatimOut}
           \executGiacmp{XCASloichideux.giac}

\input{XCASloichideux}
}


\begin{document}

\begin{center}
\begin{Large}\bfseries \textcolor{DarkRed}{Table de la loi du $\chi^2$}\end{Large}\\
\url{http://www.mathweb.fr}

\arrayrulecolor{DarkRed}

\bigskip

\shorthandoff{:}
\begin{tikzpicture}[xscale=1,yscale=10]
\draw (-.5,-.05) rectangle +(9.5,.35);
\fill[samples=100,domain=0:3,color=Moccasin] plot[id=funcA] function {x**(4/2-1)*exp(-x/2)/((2**(4/2))*gamma(4/2))} -- (3,0) -- cycle;    	
\draw[samples=100,domain=0:3,color=red] plot[id=funcA] function {x**(4/2-1)*exp(-x/2)/((2**(4/2))*gamma(4/2))};
\draw[samples=100,domain=3:9,color=red] plot[id=funcB] function {x**(4/2-1)*exp(-x/2)/((2**(4/2))*gamma(4/2))};  
\draw[->,>=stealth'] (-.5,0) -- (9,0);
\draw[->,>=stealth'] (0,-.05) -- (0,.3);
\node[below] at (3,0) {$t$};
\node[below left] at (0,0) {$O$};
\node[below left,text=DarkRed] at (9,.25) {$1-P(X \leq t) = \displaystyle\int_{0}^t \dfrac{1}{2^{\frac{\nu}{2}}\Gamma\left(\frac{\nu}{2}\right)}x^{\frac{\nu}{2}-1}e^{-\frac{x}{2}} \textrm{d}x$};
\end{tikzpicture}
\shorthandon{:}

\bigskip

$\nu$ est le degré de liberté et $\alpha$ est le seuil de risque.

\bigskip

\begin{loichideux}
20,0.01,0.1,0.01
\end{loichideux}

\medskip

Ces tables (voir page suivante) donnent en fonction de $\nu$ et $\alpha$ la valeur, notée $\chi_{obs}^2$, telle que $P\left(X \geq \chi_{obs}^2\right)=\alpha$.

\begin{loichideux}
20,0.1,0.7,0.1
\end{loichideux}

\medskip

\begin{loichideux}
20,0.7,0.95,0.05
\end{loichideux}
\end{center}
\end{document}
