Upload
olivier-menard
View
106
Download
3
Embed Size (px)
Citation preview
IA IPR Académie de Rennes 2009-2010
Le dernier est-il désavantagé
IA IPR Académie de Rennes 2009-2010
Une simulation
Un expérience aléatoire
Choisir un nombre au hasard dans l’ensemble {1,2,3}
Affecter à A sa valeur
Choisir un nombre au hasard parmi l’ensemble {1,2,3} privé de A
Affecter à B sa valeur
Affecter à C la valeur d’ensemble {1,2,3} différente de A et de B
IA IPR Académie de Rennes 2009-2010
Une simulation {1,2,3} L1
{1,1,1} L2
Int(rand*3)+1 A
0 L2(A)
If A=1 then Int(rand*2)+2 B
If A=2 then Int(rand*2)*2+1 B
If A=3 then Int(rand*2)+1 B
0 L2(B)
Sum(L1 x L2) C
Disp A,B,C
IA IPR Académie de Rennes 2009-2010
Un échantillon de taille nPrompt N
ClrList L3
For (I,1,N)
{1,2,3} L1
{1,1,1} L2
Int(rand*3)+1 A
0 L2(A)
If A=1 then Int(rand*2)+2 B
If A=2 then Int(rand*2)*2+1 B
If A=3 then Int(rand*2)+1 B
0 L2(B)
Sum(L1 x L2) L3(I)
End
Disp L3
IA IPR Académie de Rennes 2009-2010
p échantillons de taille nPrompt P
Clrlist L4,L5,L6
Prompt N
ClrList L3
For (J,1,P)
For (I,1,N)
{1,2,3} L1
{1,1,1} L2
Int(rand*3)+1 A
0 L2(A)
If A=1 then Int(rand*2)+2 B
If A=2 then Int(rand*2)*2+1 B
If A=3 then Int(rand*2)+1 B
0 L2(B)
Sum(L1 x L2) L3(I)
End
Sum (L3=1)/NL4(J)
Sum(L3=2)/NL5(J)
Sum(L3=3)/NL5(J)
End
Disp L4,L5,L6