这篇blog会长期更新。我会在其中更新一些让我印象深刻的bug。
Sklearn
Scipy
Scipy Homework
Exercise 10.1: Least squares
Generate matrix $A \in R^{m \times n}$ with m > n. Also generate some vector $b \in R^m$ Now find $x=\arg \min_x||Ax - b||_2$ Print the norm of the residual.
Matplotlib
Matplotlib Homework
Exercise 11.1: Plotting a function
Plot the function $f(x)=\sin^2(x-2)e^{-x^2}$ over the interval [0, 2]. Add proper axis labels, a title, etc.
Numpy Practise
numpy practise
prerequisize
Generate matrices A, with random Gaussian entries, B, a Toeplitz matrix, where A ∈ R n×m and B ∈ R m×m , for n = 200, m = 500
Leetcode Array
561 数组拆分
题面
给定长度为 2n 的数组, 你的任务是将这些数分成 n 对, 例如 (a1, b1), (a2, b2), …, (an, bn) ,使得从1 到 n 的 min(ai, bi) 总和最大。
Week Five Assignment
ch10
``` python
10-1
assume that there is a file called learning_py.txt
in current directory
with open(‘learning_py.txt’, ‘r’) as f: s = f.read() print(s) with open(‘learning_py.txt’, ‘r’) as f: for line in f: print(line, end=’’) with open(‘learning_py.txt’, ‘r’) as f: lines = f.readlines() for line in lines: print(line, end=’’)
Week Four Assignment (PART II)
Chp 8
``` python
8-12
def make_sandwiches(*food): print(‘sandwiches has’, food) make_sandwiches(‘egg’) make_sandwiches(‘egg’, ‘bread’) make_sandwiches(‘egg’, ‘bread’, ‘hot dog’)
Week Four Assignment (PART I)
Ch7
7-1 ~ 7-5
``` python
7-1
carName = input(‘what car do you like?\n’) print(‘let me see if I could find you a(n) {}’.format(carName))
Week Three Assignment
第五章
5-3至5-7
``` python
5-3(1)
alien_color = ‘red’ if alien_color == ‘green’: print(‘you get 5 points’)
5-3(2)
alien_color = ‘green’ if alien_color == ‘green’: print(‘you get 5 points’)