Tập tin:Pi 30K.gif

Nội dung trang không được hỗ trợ ở ngôn ngữ khác.
Tập tin này từ Wikimedia Commons
Bách khoa toàn thư mở Wikipedia

Pi_30K.gif(500×500 điểm ảnh, kích thước tập tin: 476 kB, kiểu MIME: image/gif, có lặp, 10 khung ảnh, 2,0 s)

Miêu tả

 
This plot was created with Matplotlib.
Miêu tả
English: As points are randomly scattered inside the unit square, some fall within the unit circle. The fraction of points inside the circle over all points approaches pi/4 as the number of points goes toward infinity. This animation represents this method of computing pi out to 30,000 iterations.
Nguồn gốc Tác phẩm được tạo bởi người tải lên
Tác giả nicoguaro
Mã nguồn
InfoField

Python code

from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.animation as animation
from matplotlib import rcParams

# In Windows the next line should provide the full path to convert.exe
# since convert is a Windows command
#rcParams['animation.convert_path'] = "C:\Program Files\ImageMagick-6.9.3\convert.exe"
rcParams['mathtext.fontset'] = 'cm'
rcParams['font.size'] = 14


red = "#e41a1c"
blue = "#377eb8"
gray = "#eeeeee"


def update(n):
    ax.cla()
    pts = np.random.uniform(low=0, high=1, size=(2, n))
    circ = pts[:, pts[0, :]**2 + pts[1, :]**2 <= 1]
    out_circ = pts[:, pts[0, :]**2 + pts[1, :]**2 > 1]
    pi_approx = 4*circ.shape[1]/n
    circle = mpatches.Wedge((0, 0), 1, 0, 90,  color=gray)
    ax.add_artist(circle)
    plt.plot(circ[0, :], circ[1, :], marker='.', markersize=1,
             linewidth=0, color=red)
    plt.plot(out_circ[0, :], out_circ[1, :], marker='.',markersize=1,
             linewidth=0, color=blue)
    plt.title(r"$n = {}, \pi \approx {:.4f}$".format(n, pi_approx))
    plt.axis("square")
    plt.xlim(0, 1)
    plt.ylim(0, 1)


nvec = np.round(np.logspace(2, 5, 10))
nvec = [3000, 4000, 5000, 6500, 8500, 10000, 15000, 18000, 24000, 30000]
fig = plt.figure(figsize=(5, 5))
ax = fig.add_subplot(111)
ani = animation.FuncAnimation(fig, update, frames=nvec, blit=False)
ani.save("monte_carlo_pi.gif", writer='imagemagick',
         savefig_kwargs={'delay': 6})

Giấy phép

Tôi, người giữ bản quyền tác phẩm này, từ đây phát hành nó theo giấy phép sau:
w:vi:Creative Commons
ghi công
Tập tin này được phát hành theo Giấy phép Creative Commons Ghi công 3.0 Chưa chuyển đổi
Bạn được phép:
  • chia sẻ – sao chép, phân phối và chuyển giao tác phẩm
  • pha trộn – để chuyển thể tác phẩm
Theo các điều kiện sau:
  • ghi công – Bạn phải ghi lại tác giả và nguồn, liên kết đến giấy phép, và các thay đổi đã được thực hiện, nếu có. Bạn có thể làm các điều trên bằng bất kỳ cách hợp lý nào, miễn sao không ám chỉ rằng người cho giấy phép ủng hộ bạn hay việc sử dụng của bạn.

Chú thích

Ghi một dòng giải thích những gì có trong tập tin này

Khoản mục được tả trong tập tin này

mô tả

Lịch sử tập tin

Nhấn vào ngày/giờ để xem nội dung tập tin tại thời điểm đó.

Ngày/giờHình xem trướcKích cỡThành viênMiêu tả
hiện tại16:00, ngày 16 tháng 2 năm 2017Hình xem trước của phiên bản lúc 16:00, ngày 16 tháng 2 năm 2017500×500 (476 kB)NicoguaroMake the plot square and increase gif delay.
15:38, ngày 16 tháng 2 năm 2017Hình xem trước của phiên bản lúc 15:38, ngày 16 tháng 2 năm 2017640×480 (476 kB)NicoguaroBigger text in the axes, and colors from ColorBrewer. Code in Python.
18:29, ngày 7 tháng 11 năm 2011Hình xem trước của phiên bản lúc 18:29, ngày 7 tháng 11 năm 2011500×500 (373 kB)RayhemSlowed animation to avoid looking like a blinky page element, improved resolution, added counter for number of points, shaded points inside/outside the circle. ==Mathematica 7.0 Source== <pre> tinyColor[color_, point_] := {PointSize[Small], color, Point[
23:12, ngày 14 tháng 3 năm 2011Hình xem trước của phiên bản lúc 23:12, ngày 14 tháng 3 năm 2011360×369 (363 kB)CaitlinJo{{Information |Description ={{en|1=As points are randomly scattered inside the unit square, some fall within the unit circle. The fraction of points inside the circle over all points approaches pi as the number of points goes toward infinity. This ani
Có 2 trang tại Wikipedia tiếng Việt có liên kết đến tập tin (không hiển thị trang ở các dự án khác):

Sử dụng tập tin toàn cục

Những wiki sau đang sử dụng tập tin này: