Vés al contingut

Fitxer:Largenumbers.svg

El contingut de la pàgina no s'admet en altres llengües.
De la Viquipèdia, l'enciclopèdia lliure

Fitxer original(fitxer SVG, nominalment 600 × 480 píxels, mida del fitxer: 25 Ko)

Dibuixa aquesta imatge en .
Descripció a Commons

Resum

 
W3C-validity not checked.
 
Aquesta imatge vectorial ha estat creada amb Gnuplot.
Descripció
Català: Una il·lustració de la llei dels grans nombres, semblant a File:LLN_Die_Rolls.gif però utilitzant el format svg en comptes de gif. Això utilitza dades diferents i, per tant, sembla diferent. El codi font es troba a la secció següent. El codi està sota la mateixa "llicència" que l'obra en si.
English: An illustration of the w:law of large numbers, similar to File:LLN_Die_Rolls.gif but using the svg format instead of gif. This uses different data from that and hence it looks different. Source code is in the section below. The code is under the same "license" as the work itself.
Data (UTC)
Font Treball propi
Autor NYKevin
Altres versions
Other related versions:File:LLN_Die_Rolls.gif
Translate this file Aquest fitxer SVG inclou text encapsulat que es pot traduir al vostre idioma utilitzant un editor que admeti SVG, un editor de text o l'eina de traducció de SVG. Per a més informació vegeu l'ajuda de traducció de fitxers SVG.
Aquest fitxer està traduït utilitzant <switch> elements SVG. Totes les traduccions es desen en el mateix fitxer! Vegeu més informació.

Per a la majoria de projectes de Wikipedia, podeu incrustar el fitxer normalment (sense un paràmetre lang). Wikipedia utilitzarà l'idioma si el fitxer SVG admet aquest idioma. Per exemple, la Wikipedia en alemany utilitzarà l'alemany si el fitxer SVG té alemany. Per incrustar aquest fitxer en un idioma concret, utilitzeu el paràmetre lang amb el codi d'idioma adequat, p.ex. [[File:Largenumbers.svg|lang=ca]] per a la versió en català. No inclogueu un paràmetre lang si no és necessari, ja que podria impedir l'ús d'una traducció posterior.

Per a traduir el text al vostre idioma, podeu utilitzar l'eina de traducció SVG. Alternativament, podeu descarregar el fitxer al vostre ordinador, afegir les traduccions amb el vostre programari habitual i tornar-lo a carregar amb el mateix nom. Trobareu ajuda al Graphics Lab si no esteu segur de com fer-ho.

Source code

Note that you will need to insert some paths. I've tried to make it obvious where to do so.

This code is all in the public domain (the cc0 waiver applies to it)

The code (in Java) which generated the data:

import java.io.*;
public class Main {
    public static void main(String[] args) {
        PrintStream output=null;
        try{
            output=new PrintStream("");//FIXME Insert a suitable path in the quote marks
        }catch(FileNotFoundException e){
            throw new RuntimeException(e);
        }
        //int diceValues[] = {0,0,0,0,0,0};//this variable may be uncommented and used for debugging
        double average=0;
        double total=0;
        output.println("#count average");//makes a header for the data; may be safely removed
        Random rnd=new Random(4124484382302655524l);
        //seed selected by trial and error
        for(int i=1;i<=1000;i++){
            int rand=rnd.nextInt(6);//now holds a random int from 0 to 5
            //diceValues[rand]++;//uncomment for debugging
            rand++;//convert to 1-indexed
            total+=rand;
            average=total/i;
            output.println(i+" "+(average));
        }
        //System.out.println(average);
    }

}

The gnuplot code:

set terminal svg
set output "OUTPUT PATH HERE"
set title "average dice value against number of rolls"
set xlabel "trials"
set ylabel "mean value"
plot [] [1:6] "PATH FROM JAVA CODE HERE" title "average" with lines, 3.5 title "y=3.5" with lines
#it is recommended that you copy and paste this code into a .plt file and run it in batch mode:
#If you must run this interactively, be sure to type "exit" or ^D (control-D) at the end,
#or gnuplot will leave off the </svg> closing tag.

MATLAB/Octave Source code

% Specify how many trials you want to run:
num_trials = 1000;

% Now grab all the dice rolls:
trials = randi(6, [1 num_trials]);

% Plot the results:
figure(1);

% Cumulative sum of the trial results divided by the index gives the
% average:
plot(cumsum(trials)./(1:num_trials), 'r-');

% Let's put a reference line at 3.5 just for fun (make the color a darker
% green as well):
hold on;
plot([1 num_trials], [3.5 3.5], 'color', [0 0.5 0]);

% Make it look pretty:
title('average dice value against number of rolls');
xlabel('trials');
ylabel('mean value');
legend('average', 'y=3.5');
axis([0 num_trials 1 6]);


Llicència

Creative Commons CC-Zero L'ús d'aquest fitxer és regulat sota les condicions de Creative Commons de CC0 1.0 lliurament al domini públic universal.
La persona que ha associat un treball amb aquest document ha dedicat l'obra domini públic, renunciant en tot el món a tots els seus drets de d'autor i a tots els drets legals relacionats que tenia en l'obra, en la mesura permesa per la llei. Podeu copiar, modificar, distribuir i modificar l'obra, fins i tot amb fins comercials, tot sense demanar permís.

Anotacions
InfoField
Aquesta imatge té anotacions: Vegeu-les a Commons

Llegendes

Afegeix una explicació d'una línia del que representa aquest fitxer

Elements representats en aquest fitxer

representa l'entitat

Historial del fitxer

Cliqueu una data/hora per veure el fitxer tal com era aleshores.

Data/horaMiniaturaDimensionsUsuari/aComentari
actual23:28, 31 gen 2024Miniatura per a la versió del 23:28, 31 gen 2024600 × 480 (25 Ko)ManlleusFile uploaded using svgtranslate tool (https://svgtranslate.toolforge.org/). Added translation for ca.
04:53, 3 feb 2010Miniatura per a la versió del 04:53, 3 feb 2010600 × 480 (22 Ko)NYKevinIn the interest of replicability, this one was generated using a known PRNG seed value. Will update Java source. Also, this one has axis labels!
01:53, 1 feb 2010Miniatura per a la versió del 01:53, 1 feb 2010600 × 480 (21 Ko)NYKevinBetter version, with better Java code (more precise). Will update source soon.
01:35, 1 feb 2010Miniatura per a la versió del 01:35, 1 feb 2010600 × 480 (21 Ko)NYKevinI mixed up x and y in the legend, will update gnuplot source code in a moment (already checked for svg closing tag).
01:08, 1 feb 2010Miniatura per a la versió del 01:08, 1 feb 2010600 × 480 (21 Ko)NYKevinApparently gnuplot forgot the <svg> closing tag?
01:06, 1 feb 2010Sense miniatura (21 Ko)NYKevinTrying again... looks like the last one had a problem?
01:04, 1 feb 2010Sense miniatura (21 Ko)NYKevin{{Information |Description={{en|1=An illustration of the w:law of large numbers, similar to File:LLN_Die_Rolls.gif but using the svg format instead of gif. This uses different data from that and hence it looks different. I will include source c

La pàgina següent utilitza aquest fitxer:

Ús global del fitxer

Utilització d'aquest fitxer en altres wikis:

Metadades