일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 일차변환
- matrix trnasformations
- NumPy
- 빅오 표기법
- trivial solution
- 배열 섞기
- Big-O 예제
- homogeneous linear system
- recursive algorithms
- 재귀함수
- nonhomogeneous linear system
- Big-Oh 예제
- 코틀린 시작하기
- 이진 탐색
- 빅오메가
- matrix-vector product
- 랜덤 순서 배열
- Big-Oh notation
- one-to-one
- linear dependence
- solutions of matrix equation
- Big Theta
- matrix fo a linear transformation
- python
- 알고리즘 분석의 실례
- 코틀린 Hello World!
- 빅세타
- Big Omega
- nontrivial solution
- itertools
- Today
- Total
코딩 연습
파이썬을 이용하여 최빈값(mode)를 구하기 위해서는 collections 모듈의 Counter 클래스를 알고 있어야 한다. Counter는 사전(dict) 클래스의 하위 클래스로 리스트나 튜플에서 각 데이터가 등장한 횟수를 사전 형식으로 돌려준다. 예를 들면 다음과 같다. >>> from collections import Counter >>> colors = ['red', 'blue', 'red', 'green', 'blue', 'blue'] >>> cnt = Counter(colors) >>> cnt Counter({'blue': 3, 'red': 2, 'green': 1}) 또한 Counter 클래스의 most_common() 메쏘드는 등장한 횟수를 내림차순으로 정리하여 다음과 같이 보여준다. >>..
파이썬을 이용한 막대 그래프 그리기에 대해 알아보겠다. 예제에서는 KOSIS에서 얻은 2010년부터 2014년까지의 서울지역 평균기온을 사용하였다. 다음의 코드를 barchart.py 로 저장한 후, 터미널에서 python barchart.py를 해주면 그래프를 볼 수 있다. import matplotlib.pyplot as plt def barchart(data, labels): num_bars = len(data) positions = range(1, num_bars + 1) plt.barh(positions, data, align='center') plt.yticks(positions, labels) plt.xlabel('Temperature') plt.ylabel('Year') plt.title(..
꺽은선 그래프 그리기 를 공부하였다면 이제는 함수식을 이용하여 그래프 그리기에 도전해 볼 차례다. 여기서는 이차함수 \(y=ax^2+bx+c\) 의 그래프 그리기를 예제로 함수의 그래프를 어떻게 그리는지 알아보겠다. 이를 위하여 사용자로부터 계수 \(a, \;b,\;c\) 와 그래프를 그릴 \(x\) 의 범위 \(x{\rm min},\; x{\rm max}\) 를 입력받아 이차함수의 그래프를 완성해 볼 것이다. 다음은 이를 위한 파이썬 코드이다. 다음 코드를 quadraticgraph.py 로 저장한 후, 터미널에서 python quadraticgraph.py 를 해 보면 그래프가 보이 것이다. from matplotlib import pyplot as mplp def draw_graph(x, y): m..