python linspace
来源:互联网 发布:最好的网络推广公司 编辑:程序博客网 时间:2024/05/22 14:19
numpy.linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None)
在指定的间隔内返回均匀间隔的数字。
返回num均匀分布的样本,在[start, stop]。
这个区间的端点可以任意的被排除在外。
start : scalar(标量)
The starting value of the sequence(序列的起始点).
stop : scalar
序列的结束点,除非endpoint被设置为False,在这种情况下, the sequence consists of all but the last of num + 1 evenly spaced samples(该序列包括所有除了最后的num+1上均匀分布的样本(感觉这样翻译有点坑)), 以致于stop被排除.当endpoint is False的时候注意步长的大小(下面有例子).
num : int, optional(可选)
生成的样本数,默认是50。必须是非负。
endpoint : bool, optional
如果是真,则一定包括stop,如果为False,一定不会有stop
retstep : bool, optional
If True, return (samples, step), where step is the spacing between samples.(看例子)
dtype : dtype, optional
The type of the output array. If dtype is not given, infer the data type from the other input arguments(推断这个输入用例从其他的输入中).
New in version 1.9.0.
samples : ndarray
There are num equally spaced samples in the closed interval [start, stop] or the half-open interval [start, stop) (depending on whether endpoint is True or False).
step : float(只有当retstep设置为真的时候才会存在)
Only returned if retstep is True
Size of spacing between samples.
See also
- arange
- Similar to linspace, but uses a step size (instead of the number of samples).
- arange使用的是步长,而不是样本的数量
- logspace
- Samples uniformly distributed in log space.
>>> np.linspace(1, 10, 10)
array([ 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.])
>>> np.linspace(1, 10, 10, endpoint = False)
array([ 1. , 1.9, 2.8, 3.7, 4.6, 5.5, 6.4, 7.3, 8.2, 9.1])
Out[4]: (array([ 1. , 1.9, 2.8, 3.7, 4.6, 5.5, 6.4, 7.3, 8.2, 9.1]), 0.9)
官网的例子
Examples
Graphical illustration:
- python linspace
- python的range和linspace
- python中linspace的用法
- linspace
- linspace
- Python--python中arange()和linspace()区别
- python中arange()和linspace()区别
- python中linspace()和arange()的区别
- python中numpy模块中的linspace函数
- python 采样——np.linspace
- Python numpy函数:linspace()创建等差数列
- linspace 函数
- linspace()使用说明
- tensorflow linspace
- numpy.linspace()
- np.linspace、 np.arange、np.logspace三个函数的对比分析--python学习笔记24
- python np.arange,np.linspace和np.logspace之间的区别
- MATLAB——linspace
- android开源库--FilePicker
- 计算1^1+2^2+3^3+4^4+5^5+……+20^20 ,大数运算java实现
- JavaScript中trim 、indexOf
- LeetCode
- Codeforces Round #197 (Div. 2) C(dfs)
- python linspace
- matlab函数功能简介(fopen|fread|uint8|size|bitand|bitshift)
- No Persistence provider for EntityManager named JPA
- 小学数学(Java)acm.sdut
- JSF初了解
- List leaves
- Android Debug Bridge的使用
- Java JVM 8:垃圾回收(GC 在什么时候,对什么东西,做了什么事情)
- 2017华为软件精英挑战赛--总结