2020-10-19 21:08:55

This commit is contained in:
wizardforcel
2020-10-19 21:08:55 +08:00
parent 7f63048035
commit ab0caba1f0
140 changed files with 3982 additions and 3982 deletions

View File

@@ -2,14 +2,14 @@
In [1]:
```
```py
import numpy as np
```
## 三角函数
```
```py
sin(x)
cos(x)
tan(x)
@@ -29,7 +29,7 @@ arctan2(x,y)
## 向量操作
```
```py
dot(x,y)
inner(x,y)
cross(x,y)
@@ -41,7 +41,7 @@ tensordot(x,y[,axis])
## 其他操作
```
```py
exp(x)
log(x)
log10(x)
@@ -62,7 +62,7 @@ minimum(x,y)
In [2]:
```
```py
x = np.array([1,2,3])
y = np.array([4,5,6])
np.hypot(x,y)
@@ -71,13 +71,13 @@ np.hypot(x,y)
Out[2]:
```
```py
array([ 4.12310563, 5.38516481, 6.70820393])
```
## 类型处理
```
```py
iscomplexobj
iscomplex
isrealobj
@@ -100,14 +100,14 @@ typename
In [3]:
```
```py
np.inf
```
Out[3]:
```
```py
inf
```
@@ -115,14 +115,14 @@ inf
In [4]:
```
```py
-np.inf
```
Out[4]:
```
```py
-inf
```
@@ -130,14 +130,14 @@ Out[4]:
In [5]:
```
```py
np.nan
```
Out[5]:
```
```py
nan
```
@@ -145,40 +145,40 @@ nan
In [6]:
```
```py
np.isinf(1.0)
```
Out[6]:
```
```py
False
```
In [7]:
```
```py
np.isinf(np.inf)
```
Out[7]:
```
```py
True
```
In [8]:
```
```py
np.isinf(-np.inf)
```
Out[8]:
```
```py
True
```
@@ -186,12 +186,12 @@ True
In [9]:
```
```py
np.array([0]) / 0.0
```
```
```py
c:\Miniconda\lib\site-packages\IPython\kernel\__main__.py:1: RuntimeWarning: invalid value encountered in divide
if __name__ == '__main__':
@@ -199,7 +199,7 @@ c:\Miniconda\lib\site-packages\IPython\kernel\__main__.py:1: RuntimeWarning: inv
Out[9]:
```
```py
array([ nan])
```
@@ -209,14 +209,14 @@ array([ nan])
In [10]:
```
```py
a = np.arange(5.0)
b = a / 0.0
b
```
```
```py
c:\Miniconda\lib\site-packages\IPython\kernel\__main__.py:2: RuntimeWarning: divide by zero encountered in divide
from IPython.kernel.zmq import kernelapp as app
c:\Miniconda\lib\site-packages\IPython\kernel\__main__.py:2: RuntimeWarning: invalid value encountered in divide
@@ -226,7 +226,7 @@ c:\Miniconda\lib\site-packages\IPython\kernel\__main__.py:2: RuntimeWarning: inv
Out[10]:
```
```py
array([ nan, inf, inf, inf, inf])
```
@@ -234,14 +234,14 @@ array([ nan, inf, inf, inf, inf])
In [11]:
```
```py
b == np.nan
```
Out[11]:
```
```py
array([False, False, False, False, False], dtype=bool)
```
@@ -249,20 +249,20 @@ array([False, False, False, False, False], dtype=bool)
In [12]:
```
```py
np.isnan(b)
```
Out[12]:
```
```py
array([ True, False, False, False, False], dtype=bool)
```
## 修改形状
```
```py
atleast_1d
atleast_2d
atleast_3d
@@ -282,7 +282,7 @@ squeeze
## 其他有用函数
```
```py
fix
mod
amax