原始文件(SVG文件,尺寸为600 × 480像素,文件大小:25 KB)

生成本图像。

摘要

 
W3C-validity not checked.
 
本W3C状态不明的矢量图使用Gnuplot创作.
描述
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.
日期 (UTC)
来源 自己的作品
作者 NYKevin
其他版本
Other related versions:File:LLN_Die_Rolls.gif
翻譯此檔案 此SVG檔案包含可翻譯至您的語言的内嵌文字,可以使用任何可用SVG編輯器、文本編輯器或SVG翻譯工具來翻譯。詳情請見:關於翻譯SVG檔案
此檔案使用SVG <switch>元素翻譯。所有的譯文都儲存在同一檔案中!了解更多

請在lang參數中填寫正確的語言代碼,將此檔案内嵌到您的語言中(若可用),例如:對於英語版本請使用[[File:Largenumbers.svg|lang=en]]

要將此檔案中的文字翻譯成您的語言,您可以使用SVG 翻譯工具。或者,您可以將該檔案下載至您的電腦中,使用您熟悉的任何軟體進行翻譯,然後使用「相同」名稱重新上傳。如果不確定如何進行此操作,您能在圖像實驗室中找到幫助。

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


许可协议

Creative Commons CC-Zero 本作品采用知识共享CC0 1.0 通用公有领域贡献许可协议授权。
采用本宣告发表本作品的人,已在法律允许的范围内,通过在全世界放弃其对本作品拥有的著作权法规定的所有权利(包括所有相关权利),将本作品贡献至公有领域。您可以复制、修改、传播和表演本作品,将其用于商业目的,无需要求授权。

註解
InfoField
該圖片含有註解:在維基媒體共享資源上查看註解

说明

添加一行文字以描述该文件所表现的内容

此文件中描述的项目

描繪內容

文件历史

点击某个日期/时间查看对应时刻的文件。

日期/时间缩⁠略⁠图大小用户备注
当前2024年1月31日 (三) 21:282024年1月31日 (三) 21:28版本的缩略图600 × 480(25 KB)ManlleusFile uploaded using svgtranslate tool (https://svgtranslate.toolforge.org/). Added translation for ca.
2010年2月3日 (三) 02:532010年2月3日 (三) 02:53版本的缩略图600 × 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!
2010年1月31日 (日) 23:532010年1月31日 (日) 23:53版本的缩略图600 × 480(21 KB)NYKevinBetter version, with better Java code (more precise). Will update source soon.
2010年1月31日 (日) 23:352010年1月31日 (日) 23:35版本的缩略图600 × 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).
2010年1月31日 (日) 23:082010年1月31日 (日) 23:08版本的缩略图600 × 480(21 KB)NYKevinApparently gnuplot forgot the <svg> closing tag?
2010年1月31日 (日) 23:06没有缩略图(21 KB)NYKevinTrying again... looks like the last one had a problem?
2010年1月31日 (日) 23:04没有缩略图(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

以下页面使用本文件:

全域文件用途

以下其他wiki使用此文件:

元数据