//Conditions de bonne utilisation : commencer par réduire la console scilab de façon à ce que elle ne chevauche pas la fenetre du dessous (que l'on ne met amais au premier plan, pour des raisons de manque de surface sur l'écran). clear; stacksize(150000000); driver("X11"); theta0=%pi*0.1; theta1=%pi*0.4; theta0u=%pi*0.23; theta1u=%pi*0.28; Rcondu=0.95; ncolhisto=20; n_sample_histo=10000; %symbol=1; %times=2; %times_italic=3; %times_bold=4; %helvetica= 6; %helvetica_italic=7; %helvetica_bold=8; %helvetica_bold_italique=9; %8pts=0;%10pts=1;%12pts=2; %14pts=3;%18pts=4;%24pts=5; deff('y=changecouleur(t)','y=modulo(t+1,35)+1'); deff('y=densite_r_gauss(x)','y=x.*exp(-x.*x./2)'); function y=densite_r_unif(r) un=ones(r); g=min(1,un./r); y=r.*max(0,asin(g)-acos(g)); endfunction function y=densite_t_unif(theta) c=cos(theta); s=sin(theta); y=ones(theta)./(8*max(c.*c,s.*s)); endfunction securite=0.95; couleur=1; npoints_cercles=1000; npoints_densites=1000; coeff_duree=1; //pour une valeur 1, les parametres sont choisis de façon à ce que l'animation se déroule en un temps adapté à l'amphi nbre_histo_fluct=floor(10*coeff_duree); Rmax=1.5*sqrt(-2*log(1-securite));// la proba qu'un couple de gaussiennes standard definisse un pt à distance theta0)&(echantthetagauss0.5)&(echantrgauss<1.5)); ncondgt=length(echantthetagausscond); cbdtcg(); show_pixmap(); cbgtg(); histplot(nbre_col_histo,echantthetagauss,rect=[-%pi,0,%pi,0.4], frameflag=1); show_pixmap(); for j=1:nbre_histo_fluct cbdtcg(); n=max(floor(ncondgt*j/nbre_histo_fluct),2); histplot(nbre_col_histo,echantthetagausscond(1:n), rect=[-%pi,0,%pi,0.4], frameflag=1); show_pixmap(); end scf(1); a=gca(); xclick(); delete(a.children([1,2,3])); clear echantthetagausscond; show_pixmap(); else plot2d(0,0,style=1,rect=[-Rmax,-Rmax,Rmax,Rmax], axesflag=5,frameflag=1); a=gca(); a.isoview="on"; newr=[]; newtheta=[]; laux=vecteur_nombres(Choix); bigx=rand(1,laux); bigy=rand(1,laux); for i=1:laux x=bigx(i); y=bigy(i); xpoly(x,y); p=get("hdl"); p.mark_foreground=couleur; p.mark_style=1; p.thickness=1; newr=[newr,sqrt(x^2+y^2)]; newtheta=[newtheta,atan(y,x)]; couleur=changecouleur(couleur); xselect(); show_pixmap(); end nbre_pts_gauss=nbre_pts_gauss+laux; echantrgauss=[echantrgauss,newr]; echantthetagauss=[echantthetagauss,newtheta]; end end //(pour le while) case 2 then trois_figures(); rand("uniform"); cadre_haut_unif(); nbre_pts_unif=0; echantrunif=[]; echantthetaunif=[]; while %T xselect(); nbre_col_histo=min(nbre_pts_unif,ncolhisto); Choix=x_choose(["Un point";... "+20";"+50";"+100";"+1000";... "Histos";"Cond. par l''angle";"Cond. par le rayon"],... string(nbre_pts_unif)+" points uniformes","Retour" ); select Choix, case 0 then clear nbre_pts_unif; clear echantrunif; clear echantthetaunif; break; case 1 then x=2*(rand(1,1)-0.5); y=2*(rand(1,1)-0.5); plot2d(0,0,style=1,rect=[-Rmaxu,-Rmaxu,Rmaxu,Rmaxu], axesflag=5,frameflag=1); a=gca(); a.isoview="on"; xpoly(x,y); p=get("hdl"); p.mark_foreground=couleur; p.mark_style=1; p.thickness=1; echantrunif=[echantrunif,sqrt(x^2+y^2)]; echantthetaunif=[echantthetaunif,atan(y,x)]; couleur=changecouleur(couleur); nbre_pts_unif=nbre_pts_unif+1; xselect(); show_pixmap(); case 5 then if nbre_pts_uniftheta0u)&(echantthetaunifRcondu)); ncondut=length(echantthetaunifcond); cbdtcu(); show_pixmap(); cbgtu(); histplot(nbre_col_histo,echantthetaunif,rect=[-%pi,0,%pi,0.35], frameflag=1); show_pixmap(); for j=1:nbre_histo_fluct cbdtcu(); n=max(floor(ncondut*j/nbre_histo_fluct),2); histplot(nbre_col_histo,echantthetaunifcond(1:n), rect=[-%pi,0,%pi,0.35], frameflag=1); show_pixmap(); end scf(1); a=gca(); xclick(); delete(a.children([1,2])); clear echantthetaunifcond; show_pixmap(); else plot2d(0,0,style=1,rect=[-Rmaxu,-Rmaxu,Rmaxu,Rmaxu], axesflag=5,frameflag=1); a=gca(); a.isoview="on"; newr=[]; newtheta=[]; laux=vecteur_nombres(Choix); bigx=2*(rand(1,laux)-0.5); bigy=2*(rand(1,laux)-0.5); for i=1:laux x=bigx(i); y=bigy(i); xpoly(x,y); p=get("hdl"); p.mark_foreground=couleur; p.mark_style=1; p.thickness=1; newr=[newr,sqrt(x^2+y^2)]; newtheta=[newtheta,atan(y,x)]; couleur=changecouleur(couleur); xselect(); show_pixmap(); end nbre_pts_unif=nbre_pts_unif+laux; echantrunif=[echantrunif,newr]; echantthetaunif=[echantthetaunif,newtheta]; end end //(pour le while) end //pour le select end //(pour le while) scf(1); f=gcf(); clf(); f.pixmap="off"; scf(2); f=gcf(); clf(); f.pixmap="off"; scf(3); f=gcf(); clf(); f.pixmap="off"; driver("Rec");