首页 > 行业资讯 > NumPy教程-numpy.logspace()

NumPy教程-numpy.logspace()

时间:2023-11-24 来源: 浏览:

NumPy教程-numpy.logspace()

点击关注 Python架构师
Python架构师

gh_1d7504e4dee1

回复:python,领取Python面试题。分享Python教程,Python架构师教程,Python爬虫,Python编程视频,Python脚本,Pycharm教程,Python微服务架构,Python分布式架构,Pycharm注册码。

收录于合集
#numpy 73
#NumPy教程 73
#NumPy 73
#python web教程 133
#python教程 221
整理: python架构师
它通过在对数尺度上均匀分隔的数字创建一个数组。

语法

numpy.logspace( start , stop , num , endpoint, base, dtype)

参数

它接受以下参数。
  1. start:在基数中表示区间的起始值。
  2. stop:在基数中表示区间的结束值。
  3. num:区间内的值的数量。
  4. endpoint:一个布尔类型的值。它使得 stop 表示区间的最后一个值。
  5. base:表示对数空间的底数。
  6. dtype:表示数组项的数据类型。

返回值

返回在指定范围内的数组。

示例 1

import numpy as np arr = np.logspace( 10 , 20 , num = 5 , endpoint = True ) print( "The array over the given range is " ,arr)

输出:

The array over the given range is [ 1.00000000e+10 3.16227766e+12 1.00000000e+15 3.16227766e+17 1.00000000e+20 ]

资源分享

点击领取:最全Python资料合集

示例 2

import numpy as np arr = np.logspace( 10 , 20 , num = 5 ,base = 2 , endpoint = True ) print( "The array over the given range is " ,arr)

输出:

The array over the given range is [1.02400000e+03 5.79261875e+03 3.27680000e+04 1.85363800e+05 1.04857600e+06]

 
热门推荐
  • ULID 是什么?比 UUID 更好用的全局唯一标识符?
  • NumPy教程-numpy.linspace()
  • 用Python分析了波周杰伦,还做了数据可视化

版权:如无特殊注明,文章转载自网络,侵权请联系cnmhg168#163.com删除!文件均为网友上传,仅供研究和学习使用,务必24小时内删除。
相关推荐