Berkas:Sine quads 01 Pengo.svg

Dari testwiki
Loncat ke navigasi Loncat ke pencarian
Ukuran asli (Berkas SVG, secara nominal 1.065 × 459 piksel, besar berkas: 59 KB)

Berkas ini berasal dari Wikimedia Commons dan mungkin digunakan oleh proyek-proyek lain. Deskripsi dari halaman deskripsinya ditunjukkan di bawah ini.

Deskripsi Quadrants for sin(x)
Tanggal
Sumber Karya sendiri
Pembuat Pengo
SVG genesis
InfoField
 The SVG code is valid.
  Gambar vektor ini dibuat menggunakan Matplotlib
Kode sumber
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()

Lisensi

Image credit: Peter Halasz. (User:Pengo)

Saya, pemilik hak cipta dari karya ini, dengan ini menerbitkan berkas ini di bawah ketentuan berikut:
w:id:Creative Commons
atribusi berbagi serupa
Berkas ini dilisensikan dengan lisensi Creative Commons Atribusi-BerbagiSerupa 3.0 Tanpa Adaptasi
Anda diizinkan:
  • untuk berbagi – untuk menyalin, mendistribusikan dan memindahkan karya ini
  • untuk menggubah – untuk mengadaptasi karya ini
Berdasarkan ketentuan berikut:
  • atribusi – Anda harus mencantumkan atribusi yang sesuai, memberikan pranala ke lisensi, dan memberi tahu bila ada perubahan. Anda dapat melakukannya melalui cara yang Anda inginkan, namun tidak menyatakan bahwa pemberi lisensi mendukung Anda atau penggunaan Anda.
  • berbagi serupa – Apabila Anda menggubah, mengubah, atau membuat turunan dari materi ini, Anda harus menyebarluaskan kontribusi Anda di bawah lisensi yang sama atau kompatibel dengan lisensi pada materi asli.

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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

menggambarkan

20 September 2010

60.692 Bita

459 piksel

1.065 piksel

image/svg+xml

checksum Inggris

a0c36764fd723a21716b69115be2cafacd783b8b

Riwayat berkas

Klik pada tanggal/waktu untuk melihat berkas ini pada saat tersebut.

Tanggal/WaktuMiniaturDimensiPenggunaKomentar
terkini21 September 2010 02.55Miniatur versi sejak 21 September 2010 02.551.065 × 459 (59 KB)wikimediacommons>Pengoadd quadrant labels

Halaman berikut menggunakan berkas ini: