Ficheiro:Largenumbers.svg

O conteúdo da página não é suportado noutras línguas.
Origem: Wikipédia, a enciclopédia livre.

Imagem numa resolução maior(ficheiro SVG, de 600 × 480 píxeis, tamanho: 25 kB)

Compor esta imagem em .

Descrição do ficheiro

 
W3C-validity not checked.
 
Este(a) desenho vetorial não especificado foi criado com o Gnuplot.
Descrição
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)
Origem Obra do próprio
Autor NYKevin
Outras versões
Other related versions:File:LLN_Die_Rolls.gif
Translate this file

Este ficheiro SVG contém texto integrado que pode ser traduzido para a sua língua, usando um editor que possa suportar SVG (como XML ou texto). Para mais informações, consulte: Sobre a tradução de ficheiros SVG.

Este ficheiro é traduzido utilizando elementos SVG <switch>. Todas as traduções são armazenadas no mesmo ficheiro! Saiba mais.

Para incorporar este ficheiro na sua língua (se disponível), use o parâmetro lang com o código de língua apropriado, por exemplo, [[File:Largenumbers.svg|lang=pt]] para a versão em português.

Para traduzir este ficheiro para a sua língua, você pode baixar o arquivo para o seu computador, adicionar a sua tradução usando o software com o qual você está familiarizado, e carregá-lo novamente com o mesmo nome. Se tiver dúvidas sobre isto, encontrará ajuda no Graphics Lab.

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]);


Licenciamento

Creative Commons CC-Zero A utilização deste ficheiro é regulada nos termos Creative Commons - CC0 1.0 Dedicação Universal ao Domínio Público.
A pessoa que associou uma obra a este documento dedicou-a ao domínio público, renunciando a todos os seus direitos sobre a obra em todo o mundo ao abrigo da legislação de direitos de autor, incluindo a todos os direitos legais conexos, na medida permitida por lei. Pode copiar, modificar, distribuir e executar a obra, até com fins comerciais, sem pedir autorização.

Anotações
InfoField
Esta imagem está anotada: Ver as anotações na wiki Commons

Legendas

Adicione uma explicação de uma linha do que este ficheiro representa

Elementos retratados neste ficheiro

retrata

Histórico do ficheiro

Clique uma data e hora para ver o ficheiro tal como ele se encontrava nessa altura.

Data e horaMiniaturaDimensõesUtilizadorComentário
atual21h28min de 31 de janeiro de 2024Miniatura da versão das 21h28min de 31 de janeiro de 2024600 × 480 (25 kB)ManlleusFile uploaded using svgtranslate tool (https://svgtranslate.toolforge.org/). Added translation for ca.
02h53min de 3 de fevereiro de 2010Miniatura da versão das 02h53min de 3 de fevereiro de 2010600 × 480 (22 kB)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!
23h53min de 31 de janeiro de 2010Miniatura da versão das 23h53min de 31 de janeiro de 2010600 × 480 (21 kB)NYKevinBetter version, with better Java code (more precise). Will update source soon.
23h35min de 31 de janeiro de 2010Miniatura da versão das 23h35min de 31 de janeiro de 2010600 × 480 (21 kB)NYKevinI mixed up x and y in the legend, will update gnuplot source code in a moment (already checked for svg closing tag).
23h08min de 31 de janeiro de 2010Miniatura da versão das 23h08min de 31 de janeiro de 2010600 × 480 (21 kB)NYKevinApparently gnuplot forgot the <svg> closing tag?
23h06min de 31 de janeiro de 2010Miniatura indisponível (21 kB)NYKevinTrying again... looks like the last one had a problem?
23h04min de 31 de janeiro de 2010Miniatura indisponível (21 kB)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

Utilização global do ficheiro

As seguintes wikis usam este ficheiro:

Metadados