tft每日頭條

 > 生活

 > python計算平均函數

python計算平均函數

生活 更新时间:2024-07-17 18:24:33

python計算平均函數(python輸出sinand)1

sin and cos函數曲線

import numpy as np

import math

import matplotlib.pyplot as plt

#sin and cos curves

x=np.arange(0,6,0.1)

y1=np.sin(x)

y2=np.cos(x)

plt.plot(x,y1,label='sin')

plt.plot(x,y2,label='cos',linestyle='--')

plt.xlabel('x')

plt.ylabel('y')

plt.title('sin & cos') #print title

plt.legend() #print curve style

plt.show()

,

更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!

查看全部

相关生活资讯推荐

热门生活资讯推荐

网友关注

Copyright 2023-2024 - www.tftnews.com All Rights Reserved