python 繪制三角函數圖形 sin、con、arcsin、arccos


1、正弦和余弦的圖形

import numpy as np from matplotlib import pyplot as plt %matplotlib notebook x = np.linspace((-np.pi)*2, np.pi*2, 50, endpoint=True) y1, y2 = np.sin(x), np.cos(x) plt.plot(x, y1, c='g', marker='s', label='sin(x)') plt.plot(x, y2, c='r', marker='o', label='con(x)') plt.legend(loc='upper left', numpoints=2,)

 

 

2、反正弦和反余弦的圖形

import numpy as np from matplotlib import pyplot as plt %matplotlib notebook x = np.linspace(-4, 4, 100) y1, y2 = np.arcsin(x), np.arccos(x) plt.plot(x, y1, c='b', marker='s', label='arcsin(x)') plt.plot(x, y2, c='r', marker='o', label='arccon(x)') plt.legend(loc='upper right', numpoints=2,) plt.ylim(-4, 4)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM