File:1d6 choisi parmi n.svg

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

Original file(SVG file, nominally 495 × 448 pixels, file size: 54 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: Probability for the best six-sided die chosen amongst n (1 to 5).
Français : robabilité pour un dé à six faces choisi parmi n (de 1 à 5).
Date
Source Own work
Author Christophe Dang Ngoc Chan (Cdang )
Other versions subsets: 1d6 choisi parmi n fonction de densite.svg, 1d6 choisi parmi n fonction de masse.svg
SVG development
InfoField
 
The source code of this SVG is invalid due to an error.
 
This W3C-invalid vector image was created with Scilab by cdang.
 
 This file uses embedded text that can be easily translated using a text editor.
Source code
InfoField

Scilab source code

clear; clf;

nbmax = 5;
resultat = zeros(6^nbmax, nbmax); // initialisation
 
for i = 1:nbmax // colonne
    serie = 6^(nbmax - i);
    nbseries = 6^(i - 1);
    for j = 1:nbseries
        init = 6*serie*(j - 1) + 1;
        for k = 1:6
            i0 = init + (k - 1)*serie;
            resultat(i0:i0 + serie - 1, i) = k;
        end
    end
end
 
// sélection du meilleur dé
meilleur = zeros(resultat);
for i = 1:nbmax
    meilleur(:, i) = max(resultat(:, 1:i), "c");
end

// frequences

freq1d = tabul(meilleur(:, 1), "i");
freq2d = tabul(meilleur(:, 2), "i");
freq3d = tabul(meilleur(:, 3), "i");
freq4d = tabul(meilleur(:, 4), "i");
freq5d = tabul(meilleur(:, 5), "i");

// normalisation
freq1d(:, 2) = 100*freq1d(:, 2)/sum(freq1d(:, 2));
freq2d(:, 2) = 100*freq2d(:, 2)/sum(freq2d(:, 2));
freq3d(:, 2) = 100*freq3d(:, 2)/sum(freq3d(:, 2));
freq4d(:, 2) = 100*freq4d(:, 2)/sum(freq4d(:, 2));
freq5d(:, 2) = 100*freq5d(:, 2)/sum(freq5d(:, 2));

cumul1d = freq1d();
cumul1d(:, 2) = cumsum(freq1d(:, 2));

cumul2d = freq2d();
cumul2d(:, 2) = cumsum(freq2d(:, 2));

cumul3d = freq3d();
cumul3d(:, 2) = cumsum(freq3d(:, 2));

cumul4d = freq4d();
cumul4d(:, 2) = cumsum(freq4d(:, 2));

cumul5d = freq5d();
cumul5d(:, 2) = cumsum(freq5d(:, 2));


// Tracé

subplot(2, 1, 1)
plot2d(freq1d(:, 1), freq1d(:, 2), style = 1)
plot2d(freq2d(:, 1), freq2d(:, 2), style = 2)
plot2d(freq3d(:, 1), freq3d(:, 2), style = 3)
plot2d(freq4d(:, 1), freq4d(:, 2), style = 4)
plot2d(freq5d(:, 1), freq5d(:, 2), style = 5)
legend(["1d6" ; "2d6" ; "3d6" ; "4d6" ; "5d6"], "in_upper_left");
xtitle("Fréquence (probabilité d''obtenir une valeur)", "résultat",...
    "probabilité (%)")

subplot(2, 1, 2)
plot2d(cumul1d(:, 1), cumul1d(:, 2), style = 1)
plot2d(cumul2d(:, 1), cumul2d(:, 2), style = 2)
plot2d(cumul3d(:, 1), cumul3d(:, 2), style = 3)
plot2d(cumul4d(:, 1), cumul4d(:, 2), style = 4)
plot2d(cumul5d(:, 1), cumul5d(:, 2), style = 5)
 legend(["1d6" ; "2d6" ; "3d6" ; "4d6" ; "5d6"], "in_upper_left");
xtitle("Fréquence cumulées (probabilité de faire moins qu''une valeur)",...
    "résultat", "probabilité (%)")

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following licenses:
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
You may select the license of your choice.

File history

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

Date/TimeThumbnailDimensionsUserComment
current13:50, 5 November 2013Thumbnail for version as of 13:50, 5 November 2013495 × 448 (54 KB)Cdang (talk | contribs){{Information |Description={{en|1=Probability for the best six-sided die chosen amongst ''n'' (1 to 5).}} {{fr|1=robabilité pour un dé à six faces choisi parmi ''n'' (de 1 à 5).}} |Source={{own}} |Date=2013-11-05 |Author= Christophe Dang Ngoc Chan ...

There are no pages that use this file.

Metadata