File:Somme n tirages pile ou face 1 a 4.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 506 × 396 pixels, file size: 34 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
Français : Fréquence d'apparition d'une valeur pour la somme de n tirages à pile ou face. Illustration du théorème central limite. Créé avec Scilab, modifié avec Inkscape.
English: Frequency of occurrence of values for the sum of n coin flippings. Illustration of the central limit theorem. Created with Scilab, modified with Inkscape.
Date
Source Own work
Author Cdang

Scilab source

// Trace la fonction de densité de la moyenne de n tirages à pile ou face

clear;
clf;

nbmax = 4; // nombre max de tirages

function [frequences]=tirages(n)
    // calcule les fréquences de n tirage à pile ou face par dénombrement
    // entrées : n : nombre de tirages (entier)
    // sorties : frequences : matrice de fréquences (réels)
    
    N = 2^n; // nombre de valeurs possibles
    resultats = zeros(N, n); // initialisation : résultats des tirages
    for i = 1:n // n° de colonne
        k = 2^(n - i); //à la colonne i, on alterne k valeurs 0 et k valeurs 1
        for j=0:2^(i - 1) - 1
            resultats(2*j*k + 1:(2*j + 1)*k, i) = 0;
            resultats((2*j + 1)*k + 1:(2*j + 2)*k, i) = 1;
        end
    end
    //disp(resultats);
    somme = sum(resultats, "c");
    frequences_non_triees = tabul(somme);
    frequences = gsort(frequences_non_triees, "lr", "i");
    frequences(:,2) = frequences(:,2)/N; // normalisation des fréquences
endfunction

// Programme principal

for i=1:nbmax
    XY = tirages(i);
    plot2d(XY(:,1), XY(:,2), style = i)
end
axe = gca();

xtitle("Tirages à pile ou face", "Valeurs de la somme", "Fréquence")
legend("n = 1", "n = 2", "n = 3", "n = 4")

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current09:11, 18 June 2013Thumbnail for version as of 09:11, 18 June 2013506 × 396 (34 KB)Cdang (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

Metadata