- 博客(5)
- 收藏
- 关注
原创 第十三周_Scipy题目
Exercise 10.1: Least squares 题目描述:Generate matrix A ∈ R m×n with m > n. Also generate some vector b ∈ Rm. Now find x = argminx||Ax−b||2. Print the norm of the residual.代码实现:from scipy.optimize impor...
2018-05-31 13:34:56 330
原创 第十二周_Matplotlib题目
Exercise 11.1: 题目描述: Plotting a function Plot the functionf(x) = sin2(x−2)e−x2 over the interval [0,2]. Add proper axis labels, a title, etc.代码:运行结果:
2018-05-27 09:12:31 265
原创 第十一周_Numpy题目
Exercise 9.1: 题目描述:Matrix operations Calculate A + A, AA>,A>A and AB. Write a function that computes A(B−λI) for any λ.代码:import numpy as np from scipy.linalg import toeplitz A = np.mat(n...
2018-05-20 17:42:35 293
原创 第十周_Leetcode
题目:344. Reverse String题目描述:Write a function that takes a string as input and returns the string reversed.测试样例:Given s = "hello", return "olleh".思路分析:string是不可变数组类型,要想改变字符串顺序需要采用s1 = s1[:i]+s[n-1-i]+s1...
2018-05-20 09:04:55 134
原创 第九周_Leetcode
题目一:485. Max Consecutive Ones题目描述:Given a binary array, find the maximum number of consecutive 1s in this array.Note:The input array will only contain 0 and 1.The length of input array is a positive i...
2018-05-02 20:39:11 96
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人