پرونده:Pi 30K.gif

Page contents not supported in other languages.
از ویکی‌پدیا، دانشنامهٔ آزاد

Pi_30K.gif(۵۰۰ × ۵۰۰ پیکسل، اندازهٔ پرونده: ۴۷۶ کیلوبایت، نوع MIME پرونده: image/gif، چرخش‌دار، ۱۰ قاب، ۲٫۰ ثانیه)

خلاصه

 
این GIF تصویر برداری با Matplotlib ساخته شده است
توضیح
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.
منبع اثر شخصی
پدیدآور nicoguaro
کد منبع
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})

اجازه‌نامه

من، صاحب حقوق قانونی این اثر، به این وسیله این اثر را تحث اجازه‌نامهٔ ذیل منتشر می‌کنم:
w:fa:کرییتیو کامنز
انتساب
این پرونده با اجازه‌نامهٔ کریتیو کامانز Attribution 3.0 بومی نشده منتشر شده است.
شما اجازه دارید:
  • برای به اشتراک گذاشتن – برای کپی، توزیع و انتقال اثر
  • تلفیق کردن – برای انطباق اثر
تحت شرایط زیر:
  • انتساب – شما باید اعتبار مربوطه را به دست آورید، پیوندی به مجوز ارائه دهید و نشان دهید که آیا تغییرات ایجاد شده‌اند یا خیر. شما ممکن است این کار را به هر روش منطقی انجام دهید، اما نه به هر شیوه‌ای که پیشنهاد می‌کند که مجوزدهنده از شما یا استفاده‌تان حمایت کند.

عنوان

شرحی یک‌خطی از محتوای این فایل اضافه کنید

آیتم‌هایی که در این پرونده نمایش داده شده‌اند

توصیف‌ها

این خصوصیت مقداری دارد اما نامشخص است.

source of file انگلیسی

تاریخچهٔ پرونده

روی تاریخ/زمان‌ها کلیک کنید تا نسخهٔ مربوط به آن هنگام را ببینید.

تاریخ/زمانبندانگشتیابعادکاربرتوضیح
کنونی‏۱۶ فوریهٔ ۲۰۱۷، ساعت ۱۶:۰۰تصویر بندانگشتی از نسخهٔ مورخ ‏۱۶ فوریهٔ ۲۰۱۷، ساعت ۱۶:۰۰۵۰۰ در ۵۰۰ (۴۷۶ کیلوبایت)NicoguaroMake the plot square and increase gif delay.
‏۱۶ فوریهٔ ۲۰۱۷، ساعت ۱۵:۳۸تصویر بندانگشتی از نسخهٔ مورخ ‏۱۶ فوریهٔ ۲۰۱۷، ساعت ۱۵:۳۸۶۴۰ در ۴۸۰ (۴۷۶ کیلوبایت)NicoguaroBigger text in the axes, and colors from ColorBrewer. Code in Python.
‏۷ نوامبر ۲۰۱۱، ساعت ۱۸:۲۹تصویر بندانگشتی از نسخهٔ مورخ ‏۷ نوامبر ۲۰۱۱، ساعت ۱۸:۲۹۵۰۰ در ۵۰۰ (۳۷۳ کیلوبایت)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[
‏۱۴ مارس ۲۰۱۱، ساعت ۲۳:۱۲تصویر بندانگشتی از نسخهٔ مورخ ‏۱۴ مارس ۲۰۱۱، ساعت ۲۳:۱۲۳۶۰ در ۳۶۹ (۳۶۳ کیلوبایت)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

صفحهٔ زیر از این تصویر استفاده می‌کند:

کاربرد سراسری پرونده

ویکی‌های دیگر زیر از این پرونده استفاده می‌کنند: