You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

## 1. 数值计算 numpy
### 1对于一个存在在数组如何添加一个用0填充的边界?
例如对一个二维矩阵
```
10, 34, 54, 23
31, 87, 53, 68
98, 49, 25, 11
84, 32, 67, 88
```
变换成
```
0, 0, 0, 0, 0, 0
0, 10, 34, 54, 23, 0
0, 31, 87, 53, 68, 0
0, 98, 49, 25, 11, 0
0, 84, 32, 67, 88, 0
0, 0, 0, 0, 0, 0
```
### 2 创建一个 5x5的矩阵并设置值1,2,3,4落在其对角线下方位置
### 3 创建一个8x8 的矩阵并且设置成国际象棋棋盘样式黑可以用0, 白可以用1
### 4求解线性方程组
给定一个方程组,如何求出其的方程解。有多种方法,分析各种方法的优缺点(最简单的方式是消元方)。
例如
```
3x + 4y + 2z = 10
5x + 3y + 4z = 14
8x + 2y + 7z = 20
```
编程写出求解的程序
### 5 翻转一个数组(第一个元素变成最后一个)
### 6 产生一个十乘十随机数组,并且找出最大和最小值
## Matplotlib
## (1) 画出一个二次函数,同时画出梯形法求积分时的各个梯形
例如:
![matplot_ex1](images/matplot_ex1.png)
## 2 绘制函数 $f(x) = sin^2(x - 2) e^{-x^2}$
需要画出标题xy轴。x的取值范围是[0, 2]
![matplot_ex2](images/matplot_ex2.png)
### 3 模拟一个醉汉在二维空间上的随机漫步。
例如1维的情况是
![random_walk](images/random_walk.png)
x轴表示步子y轴表示游走的位置
如果对于二维则xy分别是游走的位置。当然也可以画成三维其中z比表示步子。
## Reference
* [100 numpy exercises](https://github.com/rougier/numpy-100)