קובץ:Sine quads 01 Pengo.svg

מתוך testwiki
קפיצה לניווט קפיצה לחיפוש
    לקובץ המקורי (קובץ SVG, הגודל המקורי: 1,065 × 459 פיקסלים, גודל הקובץ: 59 ק"ב)

    זהו קובץ מתוך ויקישיתוף וניתן להשתמש בו גם במיזמים אחרים. תיאורו בדף תיאור הקובץ שלו מוצג למטה.

    תיאור Quadrants for sin(x)
    תאריך יצירה
    מקור נוצר על־ידי מעלה היצירה
    יוצר Pengo
    SVGהתפתחות 
    InfoField
     .קוד המקור של קובץ SVG זה הוא תקין
     Matplotlib עם‎‎ נוצרה ה גרפיקה וקטורית
    קוד מקור
    InfoField

    Python code

    import numpy as np
    import matplotlib.pyplot as plt
    from math import pi
    import math
    
    # HACKISH WARNING: this version internally uses 0 to 2 for the sine wave x axis, but labels it 0 to 2pi
    # This is so the two graphs can be the same size. I couldn't work out how to otherwise within pyplot.
    # (Actually only wanted the height of the two graphs to be the same, and was originally aiming to have the second x axis with the same scale as the first, which would have made it 3.14x longer.)
    
    def addLines(quad, color):
    	incr = 1.0/1000.0
    	start = quad/2.0
    	end = start + 0.5 + incr
    	x = np.arange(start, end, incr)
    	lines = plt.plot(x, np.sin(pi*x), '')
    	plt.setp(lines, color=color, linewidth=2.5, solid_capstyle='butt', solid_joinstyle='miter')
    
    
    def addPolar(quad, color):
    	incr = pi/1000.0
    	start = quad*pi/2.0
    	end = start + pi/2.0 + incr
    	x = np.arange(start, end, incr)
    	lines = plt.plot(np.cos(x), np.sin(x), '')
    	plt.setp(lines, color=color, linewidth=2.0, solid_capstyle='butt', solid_joinstyle='miter')
    		
    def addTicks():
    	start = 0 # in pi
    	end = 3 # in pi
    	tickPoints = []
    	tickNames = []
    	done = [] # in units of pi
    	#denoms = [1, 2, 4, 8] # show more
    	denoms = [1, 2]
    	for denom in denoms:
    		for numer in range(denom * start, denom * end):
    			val = (numer+0.0)/(denom+0.0)
    			if val not in done:
    				#tickPoints.append(val * pi) # this is preferred
    				tickPoints.append(val) # dodgy hack to help make the graph square. 
    				done.append(val)
    				
    				pich = u'\u03C0'
    				strTop = str(numer) + pich
    				if numer == 0:
    					strTop = "0"
    				elif numer == 1:
    					strTop = pich
    				
    
    				if denom == 1:
    					tickNames.append(strTop)
    				else:
    					tickNames.append(strTop + "/" + str(denom))
    	
    	plt.xticks(tickPoints, tickNames)	
    
    	
    def drawSine():
    	addLines(-1, 'yellow')
    	addLines(0, 'brown')
    	addLines(1, 'r')
    	addLines(2, 'orange')
    	addLines(3, 'yellow')
    	addLines(4, 'brown')
    
    	addTicks()
    	slack = .1
    	plt.axis('scaled')
    	plt.xlim(-slack, 2.0 + slack)
    	plt.ylim(-1.1, 1.1)
    	plt.grid(True)
    	
    	plt.xlabel('$x$')
    	plt.ylabel('$y$')
    	plt.title(r'$y = \sin x$')
    
    	plt.text( .25,  0, 'I', family='serif', fontsize=26, ha='center', va='center')
    	plt.text(.75,  0, 'II', family='serif', fontsize=26, ha='center', va='center')
    	plt.text(1.25, 0, 'III', family='serif', fontsize=26, ha='center', va='center')
    	plt.text( 1.75, 0, 'IV', family='serif', fontsize=26, ha='center', va='center')
    
    def drawUnitCircle():
    	addPolar(0, 'brown')
    	addPolar(1, 'r')
    	addPolar(2, 'orange')
    	addPolar(3, 'yellow')
    
    	edge = 1.1
    	plt.axis('scaled')
    	plt.axis([-edge, edge, -edge, edge])
    	plt.grid(True)
    
    	plt.xlabel('$x$')
    	plt.ylabel('$y$')
    	plt.title(r'$x^2 + y^2 = 1$')
    	
    	lo = .85 #label offset
    	plt.text( lo,  lo, 'I', family='serif', fontsize=26, ha='center', va='center')
    	plt.text(-lo,  lo, 'II', family='serif', fontsize=26, ha='center', va='center')
    	plt.text(-lo, -lo, 'III', family='serif', fontsize=26, ha='center', va='center')
    	plt.text( lo, -lo, 'IV', family='serif', fontsize=26, ha='center', va='center')
    
    def twoInOne():	
    	plt.subplot(121)
    	drawUnitCircle()
    	plt.subplot(122)
    	drawSine()
    
    twoInOne()
    plt.savefig("Sine_quads_01_Pengo.svg")
    
    plt.show()
    

    רישיון

    Image credit: Peter Halasz. (User:Pengo)

    אני, בעל זכויות היוצרים על עבודה זו, מפרסם בזאת את העבודה תחת הרישיון הבא:
    w:he:Creative Commons
    ייחוס שיתוף זהה
    הקובץ הזה מתפרסם לפי תנאי רישיון קריאייטיב קומונז ייחוס-שיתוף זהה 3.0 לא מותאם.
    יש לך חופש:
    • לשתף – להעתיק, להפיץ ולהעביר את העבודה
    • לערבב בין עבודות – להתאים את העבודה
    תחת התנאים הבאים:
    • ייחוס – יש לתת ייחוס הולם, לתת קישור לרישיון, ולציין אם נעשו שינויים. אפשר לעשות את זה בכל צורה סבירה, אבל לא בשום צורה שמשתמע ממנה שמעניק הרישיון תומך בך או בשימוש שלך.
    • שיתוף זהה – יצירת רמיקס, שינוי או בנייה על סמך החומר הזה, תטיל עליך חובה להפיץ את התרומות שלך לפי תנאי רישיון זהה או תואם למקור.

    When employing the Creative Commons license, give attribution to:

    Although not a requirement of the license, if you use this image in print or media other than the web, I would appreciate it if you let me know. Please contact me if you require alternate licensing.

    כיתובים

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

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

    מוצג

    60,692 בית

    459 פיקסל

    1,065 פיקסל

    image/svg+xml

    checksum אנגלית

    a0c36764fd723a21716b69115be2cafacd783b8b

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

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

    תאריך/שעהתמונה ממוזערתממדיםמשתמשהערה
    נוכחית02:55, 21 בספטמבר 2010תמונה ממוזערת לגרסה מ־02:55, 21 בספטמבר 2010‪459 × 1,065‬ (59 ק"ב)wikimediacommons>Pengoadd quadrant labels

    אין דפים שמשתמשים בקובץ הזה.