惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
V
Visual Studio Blog
T
Tor Project blog
量子位
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
博客园 - 司徒正美
博客园_首页
罗磊的独立博客
美团技术团队
人人都是产品经理
人人都是产品经理
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
IT之家
IT之家
C
Check Point Blog
博客园 - 聂微东
爱范儿
爱范儿
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
L
LINUX DO - 热门话题
大猫的无限游戏
大猫的无限游戏
V
Vulnerabilities – Threatpost
C
Cisco Blogs
GbyAI
GbyAI
Spread Privacy
Spread Privacy
博客园 - 叶小钗
博客园 - 【当耐特】
T
Tenable Blog
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
J
Java Code Geeks
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
宝玉的分享
宝玉的分享
Microsoft Azure Blog
Microsoft Azure Blog
Simon Willison's Weblog
Simon Willison's Weblog
N
Netflix TechBlog - Medium
T
The Exploit Database - CXSecurity.com
腾讯CDC
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
Scott Helme
Scott Helme
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler

博客园 - 哈哈

cas服务器搭建后的调整 使用python直接连接http服务器获取数据 request的url地址 pandas相关 tcp与ip的包结构 江苏铁路 易经-64卦 使用python实现rpc服务 图书分类-中图法,值得一看的图书 linux时区,curl的使用,nginx日志,watch 使用selenium模仿登录,执行js python与java的交互 计算斐波那契数列 Python线程 selenium的使用 pip使用 python读取postgresql 18位身份证的验证码 python读取docx文件属性-最后一次保存的时间等
numpy的多项式函数与求导
哈哈 · 2021-03-17 · via 博客园 - 哈哈

numpy提供了多项式函数

import numpy as np
# 3 * x*x*x + 2 * x*x + 5 * x + 4
y = np.poly1d([3,2,5,4])
y(2)

# 求导
dy = np.polyder(y)
# np.poly1d([9,4,5])
dy(2)

根据系数计算导数

# 输入为数组,输出为导数的数组
def my_polyder(d):
    s = len(d)
    ret = []
    for i,x in enumerate(d[0:s-1]):
        ret.append(x * (s-1-i))
    return ret

# 输入[3,2,5,4]
# 输出[9,4,5]

 随机数

# [0,1),参数是维度
np.random.rand()
np.random.rand(10)
np.random.rand(10,2)

# 标准正态分布,参数是维度
np.random.randn()
np.random.randn(10)
np.random.randn(10,2)

# 整数[low,high),用size表示维度
np.random.randint(10,21)
# 10-20间100个数
np.random.randint(10,21,100)
np.random.randint(10,21,size=100)
np.random.randint(10,21,size=(2,100))

# 浮点数, [0.0, 1.0)
np.random.random_sample()
np.random.random_sample((10,2))
# 调整范围使用 (b - a) * random_sample() + a
50*np.random.random_sample()+50

np.random.rand()与np.random.random_sample()区别在哪?