> restart:

TP 04

Paramètres de dispersion

et histogrammes

Rappel de consignes

(1) titre en "Times New Roman", corps 36,

NOM Prénom - groupe

TP04 - date

(2) sauvegarder "souvent"

(3) imprimer : paginer (Format/Page_Number)

puis File/Preview.

enfin imprimer en deux colonnes

>

On charge quelques bibliothèques

> with(pldx); # il faut la version 27

`pldx v68-27  ;  author : <douillet@ensait.fr>  ;  ...

[Xtens, `convert/D2`, ever_loaded, isdiag, sinsin, ...
[Xtens, `convert/D2`, ever_loaded, isdiag, sinsin, ...
[Xtens, `convert/D2`, ever_loaded, isdiag, sinsin, ...

> with(simul); # il faut la version 19

`simul v68-19  ;  author : <douillet@ensait.fr>  ; ...

[chi2_tst, ever_loaded, histo, histo_arr, xcutn, xh...

>

Paramètres de dispersion

> rra:= rand(8):

répétitions et répétitions : comparer

> rra( ) $ 3 ;

> 'rra( )' $ 3 ;

1, 1, 1

6, 1, 3

Création d'une liste de nombres

> n:= 100;

n := 100

> li:= [ 'rra()' $ n];

li := [0, 2, 5, 0, 1, 1, 7, 3, 1, 0, 2, 5, 4, 5, 3,...
li := [0, 2, 5, 0, 1, 1, 7, 3, 1, 0, 2, 5, 4, 5, 3,...
li := [0, 2, 5, 0, 1, 1, 7, 3, 1, 0, 2, 5, 4, 5, 3,...

> nops(li);

100

> add(X, X=li)/n ; m:= evalf( %);

359/100

m := 3.590000000

Une syntaxe plus stricte, avec affichage avant calculs

> Sum( 'li[k]', k=1..n); value(%);

Sum(li[k],k = 1 .. 100)

359

> stats[describe, mean] (li) ;

359/100

> macro(moy= stats[describe, mean] );
moy(li);

moy

359/100

> v:= add( (li[k]-m) ^2, k=1..n)/n ;

v := 4.521900000

Koenig

> map( x-> x^2, li) : moy(%) - m^2;

4.52190000

> macro(var= stats[describe, variance] );
var(li); evalf(%);

moy, var

45219/10000

4.521900000

>

>

Visualisation

> macro(tal= stats[transform, tally] );

moy, var, tal

> ta:= tal(li);

ta := [Weight(0,9), Weight(1,13), Weight(2,10), Wei...

> macro(histo = xhisto );

moy, var, tal, histo

> histo(ta, area=1);

[Maple Plot]

> les_interv:= [ seq( k-1/2..k+1/2, k=0..7)] ;

les_interv := [-1/2 .. 1/2, 1/2 .. 3/2, 3/2 .. 5/2,...

> macro(talto = stats[transform, tallyinto] );

moy, var, tal, histo, talto

> ta2:= talto(li, les_interv);

ta2 := [Weight(-1/2 .. 1/2,9), Weight(1/2 .. 3/2,13...
ta2 := [Weight(-1/2 .. 1/2,9), Weight(1/2 .. 3/2,13...

> histo(ta2, area=1); pl1:= %:

[Maple Plot]

>

Visualisation générale

> xima:=proc(pl); op(1,pl) : convert(%,list): map(op,%):
map2(op,2,%): max(op(%)): end:

> [m, t, t=0..xima(pl1)]; plot(%, color=red, linestyle=24): pl2:= %:

[3.590000000, t, t = 0 .. 21/100]

> display(pl1, pl2);

[Maple Plot]

> [m+sqrt(v), t, t=0..xima(pl1)], [m-sqrt(v), t, t=0..xima(pl1)] ;
plot( {%}, color=red, linestyle=16): pl3:= %:

[5.716475958, t, t = 0 .. 21/100], [1.463524042, t,...

> display(pl1, pl2, pl3);

[Maple Plot]

>

>