File:Largenumbers.svg
Questo file proviene da Wikimedia Commons e può essere utilizzato da altri progetti. Di seguito viene mostrata la descrizione presente nella pagina di descrizione del file.
Dettagli
| DescrizioneLargenumbers.svg |
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) |
| Fonte | Opera propria |
| Autore | NYKevin |
| Altre versioni |
File:Largenumbers.svg contains 2 translations.
Other related versions:File:LLN_Die_Rolls.gif |
| Questo file SVG contiene del testo che può essere facilmente tradotto nella tua lingua, utilizzando qualunque editor che supporti SVG, un editor di testo o SVG Translate tool. Per maggiori informazioni vedi: Tradurre un file SVG. |
Questo file è tradotto usando elementi <switch> di SVG. Tutte le traduzioni sono contenute nello stesso file! Apprendi di più.
Per la maggior parte dei progetti Wikipedia, è possibile incorporare il file normalmente (senza un parametro Per tradurre il testo nella tua lingua, è possibile utilizzare lo strumento SVG Translate tool. In alternativa, puoi scaricare il file sul tuo computer, aggiungere le tue traduzioni usando qualsiasi software con cui hai familiarità e ricaricarlo con lo stesso nome. Troverai aiuto al Graphics Lab se non sei sicuro di come farlo. |
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]);
Licenza
| Questo file è reso disponibile nei termini della licenza Creative Commons CC0 1.0 Universal. | |
| La persona che ha associato un'opera con questo atto legale ha donato tale opera nel pubblico dominio rinunciando a tutti i diritti sull'opera in tutto il mondo, inclusi tutti i diritti connessi o altri diritti simili, per quanto permesso dalla legge. Puoi copiare, modificare, distribuire ed utilizzare l'opera, anche a fini commerciali, senza chiedere alcun permesso.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
| Annotazioni InfoField | Questa immagine è annotata: Vedi le annotazioni su Commons |
On the left, random fluctuations are evident.
Here, the average begins to level out around 3.5
Didascalie
Elementi ritratti in questo file
raffigura
Valore sconosciuto senza un elemento Wikidata
31 gen 2010
image/svg+xml
Cronologia del file
Fare clic su un gruppo data/ora per vedere il file come si presentava nel momento indicato.
| Data/Ora | Miniatura | Dimensioni | Utente | Commento | |
|---|---|---|---|---|---|
| attuale | 07:54, 15 nov 2024 | 600 × 480 (25 KB) | wikimediacommons>Dr. Greywolf | File uploaded using svgtranslate tool (https://svgtranslate.toolforge.org/). Added translation for yue. |
Utilizzo del file
La seguente pagina usa questo file: