python笔记:5.1.1matplotlib_函数绘图_多项式_图形参数

# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 19:11:56 2019

@author: User
"""


import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

a=np.array([2,-3.5,1.6,-2,9])
p=np.poly1d(a)
print(p)

x=np.linspace(-10,10,30)
y=p(x)

p1=p.deriv(m=1)
y1=p1(x)
plt.plot(x,y,'b|',x,y1,'k-.')
plt.show()

运行:

python笔记:5.1.1matplotlib_函数绘图_多项式_图形参数_第1张图片

你可能感兴趣的:(python学习)