קובץ:Pi 30K.gif

תוכן הדף אינו נתמך בשפות אחרות.
מתוך ויקיפדיה, האנציקלופדיה החופשית

Pi_30K.gif(500 × 500 פיקסלים, גודל הקובץ: 476 ק"ב, סוג MIME‏: image/gif, בלולאה, 10 תמונות, 2.0 שניות)

ויקישיתוף זהו קובץ שמקורו במיזם ויקישיתוף. תיאורו בדף תיאור הקובץ המקורי (בעברית) מוצג למטה.

תקציר

 
Matplotlib עם‎‎ נוצרה ה GIF תמונת מפת סיביות
תיאור
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:he:Creative Commons
ייחוס
הקובץ הזה מתפרסם לפי תנאי רישיון קריאייטיב קומונז ייחוס 3.0 לא מותאם.
הנכם רשאים:
  • לשתף – להעתיק, להפיץ ולהעביר את העבודה
  • לערבב בין עבודות – להתאים את העבודה
תחת התנאים הבאים:
  • ייחוס – יש לתת ייחוס הולם, לתת קישור לרישיון, ולציין אם נעשו שינויים. אפשר לעשות את זה בכל צורה סבירה, אבל לא בשום צורה שמשתמע ממנה שמעניק הרישיון תומך בך או בשימוש שלך.

כיתובים

נא להוסיף משפט שמסביר מה הקובץ מייצג

פריטים שמוצגים בקובץ הזה

מוצג

היסטוריית הקובץ

ניתן ללחוץ על תאריך/שעה כדי לראות את הקובץ כפי שנראה באותו זמן.

תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
נוכחית19:00, 16 בפברואר 2017תמונה ממוזערת לגרסה מ־19:00, 16 בפברואר 2017‪500 × 500‬ (476 ק"ב)NicoguaroMake the plot square and increase gif delay.
18:38, 16 בפברואר 2017תמונה ממוזערת לגרסה מ־18:38, 16 בפברואר 2017‪480 × 640‬ (476 ק"ב)NicoguaroBigger text in the axes, and colors from ColorBrewer. Code in Python.
21:29, 7 בנובמבר 2011תמונה ממוזערת לגרסה מ־21:29, 7 בנובמבר 2011‪500 × 500‬ (373 ק"ב)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[
02:12, 15 במרץ 2011תמונה ממוזערת לגרסה מ־02:12, 15 במרץ 2011‪369 × 360‬ (363 ק"ב)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

שימוש גלובלי בקובץ

אתרי הוויקי השונים הבאים משתמשים בקובץ זה: