三角函數(sin,cos,tan)、log等等


 

 

 

函數關系

 

 

 還有更多的數據具體看:https://baike.baidu.com/item/%E4%B8%89%E8%A7%92%E5%87%BD%E6%95%B0%E5%85%AC%E5%BC%8F/4374733?fr=aladdin

主要看看圖形是怎么樣的

 

#三角函數的自變量是角度
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 50)
y = np.sin(x)
plt.plot(x, y)
plt.title('sin(x)')
plt.xticks( (0, np.pi * 0.5, np.pi, np.pi * 1.5, np.pi * 2), ('0', '2/π', 'π', '1.5π', '') )
plt.annotate(s='sin(2/π)=1',xy=(np.pi * 0.5,1),xytext=(0.5,0.5),color='red',arrowprops=dict(arrowstyle='-|>',connectionstyle='arc3',color='red'))
plt.annotate(s='sin(π)=1',xy=(np.pi,0),xytext=(0.5,-0.5),color='red',arrowprops=dict(arrowstyle='-|>',connectionstyle='arc3',color='red'))
plt.show()

 

 

 

import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 50)
y = np.cos(x)
plt.plot(x, y)
plt.title('cos(x)')
plt.xticks( (0, np.pi * 0.5, np.pi, np.pi * 1.5, np.pi * 2), ('0', '2/π', 'π', '1.5π', '') )
plt.annotate(s='cos(2/π)=1',xy=(np.pi * 0.5,0),xytext=(0.5,0.5),color='red',arrowprops=dict(arrowstyle='-|>',connectionstyle='arc3',color='red'))
plt.annotate(s='cos(π)=1',xy=(np.pi,-1),xytext=(0.5,-0.5),color='red',arrowprops=dict(arrowstyle='-|>',connectionstyle='arc3',color='red'))
plt.show()

 

 

import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2 * np.pi, 50)
y = np.sin(x)/np.cos(x)
plt.plot(x, y)
plt.title('tan(x)')
plt.xticks( (0, np.pi * 0.5, np.pi, np.pi * 1.5, np.pi * 2), ('0', '2/π', 'π', '1.5π', '') )
plt.show()

 

 

lnx是以e為底的對數函數,其中e是一個無du限不循環小數,其值約等於2.718281828459…
函數的圖象是過點(1,0)的一條C型的曲線,串過第一,第四象限,且第四象限的曲線逐漸靠近Y
軸,但不相交,第一象限的曲線逐漸的遠離X軸。
其定義域:x>0 值域:y(無窮)一般表示方法為lnx。數學中也常見以logx表示自然對數

import matplotlib.pyplot as plt
import numpy as np
x=np.arange(0.1,1000)
y=np.log(x)
plt.plot(x, y)
plt.title('lnx 或者是 logx')
plt.annotate(s='ln1=0',xy=(1,0),xytext=(0.5,0.5),color='red',arrowprops=dict(arrowstyle='-|>',connectionstyle='arc3',color='red'))
plt.show()

 

 

log10(x)又叫lg(x)是以10為底的對數

import matplotlib.pyplot as plt
import numpy as np
x=np.arange(0.1,50)
y=np.log10(x)
plt.plot(x, y)
plt.title('lgx')
plt.annotate(s='lg10=1',xy=(10,1),xytext=(0.5,0.5),color='red',arrowprops=dict(arrowstyle='-|>',connectionstyle='arc3',color='red'))
plt.show()

 


免責聲明!

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



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