Python (Anaconda ) 2017. 05. 30. 1 1 2 Anaconda 2 3 Python 3 3.1 Python.......................... 3 3.2 IDLE Python....................... 5 4 NumPy 6 5 matplotlib 7 5.1.................................. 7 5.2.................................. 7 5.3...................... 9 6 Scipy 11 7 scikit-learn 12 8 URL 13 1 Python 1 ( ) (numpy, matplotlib, scipy, scikit-learn ) Anaconda python2.7 64bit PC 64bit 32bit 1 Python( ): http://www.python.jp/ 1
2 Anaconda Anaconda 2 1. Anadonda https://www.continuum.io/downloads Windows Python 2.7 64bit NO THANKS 2. (400MB ) 3. ( ) Anaconda2-x.x.x-Windows_x86_64.exe ( x 4. Setup Next, I Agree( ), Next(Just Me ) 5. ( ) Destination Folder( ) C:\Anaconda2 ( or 2 ) C 6. Advanced Options 2 Install 7. Completed Next, Finish 8. Anaconda2 (64-bit) Anaconda IPython Jupyter Spyder 2 Anaconda python windows 2
3 Python Python OS 3.1 Python PC Windows python python Python C:\Anaconda2 python python python 1: Python Enter >>> print "Hello" Hello Python 2: Enter 3
>>> exit() Enter 4
3.2 IDLE Python IDLE PC Windows idle idle Python C:\Anaconda2\Script python idle IDLE python 3: IDLE File New File Python sample 1.py print "Hello" File Save Save as 4: Run Run Module IDLE Hello 5: 5
4 NumPy NumPy 3 IDLE Python (Sec. 3.2 ) π >>> import numpy >>> numpy.pi 6: 3 NumPy( ):http://www.numpy.org/ 6
5 matplotlib 5.1 matplotlib 4 IDLE Python (Sec. 3.2 ) File New File Python sample test.py import numpy as np import matplotlib.pyplot as plt x=np.arange(-3,3,0.1) y= np.sin(x) plt.plot(x,y) plt.show() Run Run Module 7: ( ) 5.2 Python sample 2.py from pylab import * subplot(111, axisbg= darkslategray ) #subplot(111, axisbg #ababab ) t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) plot(t, s, y ) xlabel( time (s), color= r ) ylabel( voltage (mv), color= 0.5 ) # grayscale color title( About as silly as it gets, folks, color= #afeeee ) show() 4 matplotlib( ) http://matplotlib.org/ 7
[1] sample_2.py sample 2.py Run Run Module 8: 5 5 http://matplotlib.org/gallery.html 8
5.3 ( ) 1 1.1 2 1.2 3 1.6 1 x 2 y [1] plot_graph_data.txt import matplotlib.pyplot as plt x=[] y=[] fp = open( plot_graph_data.txt, r ) for i, line in enumerate(fp): data=line.split() x.append(data[0]) y.append(data[1]) plt.plot(x,y, ro ) # red circle plt.title( My graph ) plt.xlabel( time (s) ) plt.ylabel( hight (m) ) plt.text(1.2, 1.2, Hello Hello, rotation=45) plt.xlim(0.0, 4.0) plt.ylim(0.0, 2.0) plt.show() [1] plot_graph.py 9: 9
plt.title( My graph ) 10
6 Scipy Scipy 6 IDLE Python (Sec. 3.2 ) π >>> import scipy >>> scipy.pi 10: 6 Scipy.org( ): http://www.scipy.org/ 11
7 scikit-learn ( ) scikit-learn 7 IDLE Python (Sec. 3.2 ) >>> import sklearn scikit-learn [1] sample 4.py ( ) import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression # create samples sample_size = 30 err_sigma = 0.1 x = np.random.rand(sample_size, 1) err = err_sigma * np.random.randn(sample_size, 1) y = 3 * x + 1 + err # train a linear regression model regr = LinearRegression () regr.fit(x, y) # make predictions xt = np.linspace (0.0, 1.0, num = 1000).reshape((1000, 1)) yt = regr.predict (xt) # plot samples and regression result plt.plot(x, y, o ) plt.plot(xt, yt) plt.show() scikit-learn 11: 7 scikit learn( ): http://scikit-learn.org 12
8 URL python URL 1. PythonWeb IT http://www.pythonweb.jp/tutorial/ 2. Python http://docs.python.jp/2/tutorial/index.html math http://docs.python.jp/2/library/math.html#module-math 3. Python http://www.tohoho-web.com/python/index.html 4. Python http://www.geocities.jp/m_hiroi/light/python01.html 5. Python : 4 ( ) http://www.slideshare.net/yuichi110/python-introduction-42659983 6. Python Scientific Lecture Notes http://turbare.net/transl/scipy-lecture-notes/index.html [1] http://www.damp.tottori-u.ac.jp/~hoshi/ex.html 13