資訊內(nèi)容
學(xué)習(xí)Python解決高等數(shù)學(xué)問(wèn)題
ykZ少兒編程網(wǎng)-https://www.pxcodes.com
使用Python解決高等數(shù)學(xué)中極限、導(dǎo)數(shù)、偏導(dǎo)數(shù)、定積分、不定積分、雙重積分等問(wèn)題ykZ少兒編程網(wǎng)-https://www.pxcodes.com
Sympy是一個(gè)Python的科學(xué)計(jì)算庫(kù),它旨在成為功能齊全的計(jì)算機(jī)代數(shù)系統(tǒng)。 SymPy 包括從基本符號(hào)算術(shù)到微積分,代數(shù),離散數(shù)學(xué)和量子物理學(xué)的功能。 它可以在 LaTeX 中顯示結(jié)果。ykZ少兒編程網(wǎng)-https://www.pxcodes.com
Sympy*網(wǎng)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
文章目錄ykZ少兒編程網(wǎng)-https://www.pxcodes.com
Python解決高等數(shù)學(xué)問(wèn)題,媽媽再也不用擔(dān)心我的學(xué)習(xí)1. 實(shí)用技巧1.1 符號(hào)函數(shù)1.2 展開(kāi)表達(dá)式expand1.3 泰勒展開(kāi)公式series1.4 符號(hào)展開(kāi)2. 求極限limit3. 求導(dǎo)diff3.1 一元函數(shù)3.2 多元函數(shù)4. 積分integrate4.1 定積分4.2 不定積分4.3 雙重積分5. 求解方程組solve6. 計(jì)算求和式summation(免費(fèi)學(xué)習(xí)推薦:python視頻教程)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
ykZ少兒編程網(wǎng)-https://www.pxcodes.com
看到這圖,是不是感覺(jué)快喘不過(guò)氣了呢。Python來(lái)幫你解決。ykZ少兒編程網(wǎng)-https://www.pxcodes.com
from sympy import *import sympy輸入“x= symbols(“x”)”命令定義一個(gè)符號(hào)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
x = Symbol("x")y = Symbol("y")1. 實(shí)用技巧ykZ少兒編程網(wǎng)-https://www.pxcodes.com
1.1 符號(hào)函數(shù)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
sympy提供了很多數(shù)學(xué)符號(hào),總結(jié)如下ykZ少兒編程網(wǎng)-https://www.pxcodes.com
虛數(shù)單位sympy.I自然對(duì)數(shù)sympy.E無(wú)窮大sympy.oo圓周率 sympy.pi求n次方根 sympy.root(8,3)取對(duì)數(shù)sympy.log(1024,2)求階乘sympy.factorial(4)三角函數(shù)sympy.sin(sympy.pi)sympy.tan(sympy.pi/4)sympy.cos(sympy.pi/2)1.2 展開(kāi)表達(dá)式expandykZ少兒編程網(wǎng)-https://www.pxcodes.com
f = (1+x)**3expand(f)x 3 + 3 x 2 + 3 x + 1 displaystyle x^{3} + 3 x^{2} + 3 x + 1 x3+3x2+3x +1ykZ少兒編程網(wǎng)-https://www.pxcodes.com
1.3 泰勒展開(kāi)公式seriesykZ少兒編程網(wǎng)-https://www.pxcodes.com
ln(1+x).series(x,0,4)x ? x 2 2 + x 3 3 + O ( x 4 ) displaystyle x - frac{x^{2}}{2} + frac{x^{3}}{3} + Oleft(x^{4}ight) x?2x2+3x3+O (x4)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
sin(x).series(x,0,8)x ? x 3 6 + x 5 120 ? x 7 5040 + O ( x 8 ) displaystyle x - frac{x^{3}}{6} + frac{x^{5}}{120} - frac{x^{7}}{5040} + Oleft(x^{8}ight) x?6x3+120x 5?5040x7+O(x8)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
cos(x).series(x,0,9)1 ? x 2 2 + x 4 24 ? x 6 720 + x 8 40320 + O ( x 9 ) displaystyle 1 - frac{x^{2}}{2} + frac{x^{4}}{24} - frac{x^{6}}{720} + frac{x^{8}}{40320} + Oleft(x^{9}ight) 1? 2x2+24x4?720x6+ 40320x8+O(x9)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
(1/(1+x)).series(x,0,5)1 ? x + x 2 ? x 3 + x 4 + O ( x 5 ) displaystyle 1 - x + x^{2} - x^{3} + x^{4} + Oleft(x^{5}ight) 1?x+x2?x 3+x4+O(x5)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
tan(x).series(x,0,4)x + x 3 3 + O ( x 4 ) displaystyle x + frac{x^{3}}{3} + Oleft(x^{4}ight) x+3x3+ O(x4)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
(1/(1-x)).series(x,0,4)1 + x + x 2 + x 3 + O ( x 4 ) displaystyle 1 + x + x^{2} + x^{3} + Oleft(x^{4}ight) 1+x+x2+x3+O(x4)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
(1/(1+x)).series(x,0,4)1 ? x + x 2 ? x 3 + O ( x 4 ) displaystyle 1 - x + x^{2} - x^{3} + Oleft(x^{4}ight) 1?x+x2?x3+O(x4)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
1.4 符號(hào)展開(kāi)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
a = Symbol("a")b = Symbol("b")#simplify( )普通的化簡(jiǎn)simplify((x**3 + x**2 - x - 1)/(x**2 + 2*x + 1))#trigsimp( )三角化簡(jiǎn)trigsimp(sin(x)/cos(x))#powsimp( )指數(shù)化簡(jiǎn)powsimp(x**a*x**b)x a + b displaystyle x^{a + b} x a+bykZ少兒編程網(wǎng)-https://www.pxcodes.com
2. 求極限limitykZ少兒編程網(wǎng)-https://www.pxcodes.com
limit(sin(x)/x,x,0)1 displaystyle 1 1ykZ少兒編程網(wǎng)-https://www.pxcodes.com
f2=(1+x)**(1/x)f2( x + 1 ) 1 x displaystyle left(x + 1ight)^{frac{1}{x}} (x+1)x1ykZ少兒編程網(wǎng)-https://www.pxcodes.com
重要極限ykZ少兒編程網(wǎng)-https://www.pxcodes.com
f1=sin(x)/x f2=(1+x)**(1/x)f3=(1+1/x)**x lim1=limit(f1,x,0)lim2=limit(f2,x,0)lim3=limit(f3,x,oo)print(lim1,lim2,lim3)1 E Edir可以表示極限的趨近方向ykZ少兒編程網(wǎng)-https://www.pxcodes.com
f4 = (1+exp(1/x))f4e 1 x + 1 displaystyle e^{frac{1}{x}} + 1 e x1+1ykZ少兒編程網(wǎng)-https://www.pxcodes.com
lim4 = limit(f4,x,0,dir="-")lim41 displaystyle 1 1ykZ少兒編程網(wǎng)-https://www.pxcodes.com
lim5 = limit(f4,x,0,dir="+")lim5∞ displaystyle infty ∞ykZ少兒編程網(wǎng)-https://www.pxcodes.com
3. 求導(dǎo)diffykZ少兒編程網(wǎng)-https://www.pxcodes.com
diff(函數(shù),自變量,求導(dǎo)次數(shù))ykZ少兒編程網(wǎng)-https://www.pxcodes.com
3.1 一元函數(shù)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
求導(dǎo)問(wèn)題ykZ少兒編程網(wǎng)-https://www.pxcodes.com
diff(sin(2*x),x)2 cos ? ( 2 x ) displaystyle 2 cos{left(2 x ight)} 2cos(2x)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
diff(ln(x),x)1 x displaystyle frac{1}{x} x1ykZ少兒編程網(wǎng)-https://www.pxcodes.com
3.2 多元函數(shù)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
求偏導(dǎo)問(wèn)題ykZ少兒編程網(wǎng)-https://www.pxcodes.com
diff(sin(x*y),x,y)? x y sin ? ( x y ) + cos ? ( x y ) displaystyle - x y sin{left(x y ight)} + cos{left(x y ight)} ?xysin(xy)+cos(xy)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
4. 積分integrateykZ少兒編程網(wǎng)-https://www.pxcodes.com
4.1 定積分ykZ少兒編程網(wǎng)-https://www.pxcodes.com
函數(shù)的定積分: integrate(函數(shù),(變量,下限,上限))函數(shù)的不定積分: integrate(函數(shù),變量)f = x**2 + 1integrate(f,(x,-1.1))? 1.54366666666667 displaystyle -1.54366666666667 ?1.54366666666667ykZ少兒編程網(wǎng)-https://www.pxcodes.com
integrate(exp(x),(x,-oo,0))1 displaystyle 1 1ykZ少兒編程網(wǎng)-https://www.pxcodes.com
4.2 不定積分ykZ少兒編程網(wǎng)-https://www.pxcodes.com
f = 1/(1+x*x)integrate(f,x)atan ? ( x ) displaystyle operatorname{atan}{left(x ight)} atan(x)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
4.3 雙重積分ykZ少兒編程網(wǎng)-https://www.pxcodes.com
f = (4/3)*x + 2*y integrate(f,(x,0,1),(y,-3,4))11.6666666666667 displaystyle 11.6666666666667 11.666666 6666667ykZ少兒編程網(wǎng)-https://www.pxcodes.com
5. 求解方程組solveykZ少兒編程網(wǎng)-https://www.pxcodes.com
#解方程組#定義變量f1=x+y-3f2=x-y+5solve([f1,f2],[x,y]){x: -1, y: 4}ykZ少兒編程網(wǎng)-https://www.pxcodes.com
6. 計(jì)算求和式summationykZ少兒編程網(wǎng)-https://www.pxcodes.com
計(jì)算求和式可以使用sympy.summation函數(shù),其函數(shù)原型為sympy.summation(f, *symbols, **kwargs)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
**ykZ少兒編程網(wǎng)-https://www.pxcodes.com
10100ykZ少兒編程網(wǎng)-https://www.pxcodes.com
到這里就結(jié)束了,如果對(duì)你有幫助,歡迎點(diǎn)贊關(guān)注評(píng)論,你的點(diǎn)贊對(duì)我很重要。在此也祝愿大家可以把數(shù)學(xué)學(xué)好ykZ少兒編程網(wǎng)-https://www.pxcodes.com
相關(guān)免費(fèi)學(xué)習(xí)推薦:python教程(視頻)ykZ少兒編程網(wǎng)-https://www.pxcodes.com
以上就是學(xué)習(xí)Python解決高等數(shù)學(xué)問(wèn)題的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注少兒編程網(wǎng)其它相關(guān)文章!ykZ少兒編程網(wǎng)-https://www.pxcodes.com

- 上一篇
python單引號(hào)和雙引號(hào)、三引號(hào)的區(qū)別是什么
簡(jiǎn)介區(qū)別:?jiǎn)我?hào)和雙引號(hào)是等效的,如果要換行,那么需要使用符號(hào)“”;三引號(hào)則可以直接換行,并且可以包含注釋。單引號(hào)里不能加單引號(hào),但可加“”或者是雙引號(hào)進(jìn)行轉(zhuǎn)義輸出。雙引號(hào)里面不能再加雙引號(hào),但是可以加“”或者是單引號(hào)進(jìn)行轉(zhuǎn)義輸出。本教程操作環(huán)境:windows7系統(tǒng)、DellG3電腦、Pytho
- 下一篇
python 操作 excel 系列之:數(shù)據(jù)清洗
簡(jiǎn)介python在對(duì)excel操作的同時(shí),前面文章中說(shuō)了數(shù)據(jù)的讀取、插入、簡(jiǎn)單分析,還有一個(gè)非常重要的點(diǎn)就是數(shù)據(jù)清洗。那什么叫數(shù)據(jù)清洗,說(shuō)白了就是去除數(shù)據(jù)文本中的垃圾值,比如:存在的空值、多余的空格、數(shù)據(jù)格式等等的處理。相關(guān)免費(fèi)學(xué)習(xí)推薦:python視頻教程1,導(dǎo)入python庫(kù)、讀取excel數(shù)據(jù)#導(dǎo)