一、前期高等数学知识:
二、matlab、python 求极限命令函数limit(),具体格式如下:

例1:
MATLAB代码:
clear ;
clc;
close all;
syms x;
y=limit(((x^2-1)/(x-1)),x,1)
%%
clear
syms x;
f=(x^2-1)/(x-1);
y=limit(f,x,1)
结果:
ans =2
Python代码:
from sympy import * #
x=symbols('x')
f=(x**2-1)/(x-1)
y=limit(f,x,1) #从负方向逼近,可用 limit(f,x,1,dir='-');从正方向逼近,可用limit(f,x,0,dir='+')
print(y)
例2:

MATLAB 代码:
clear
clc;
close all;
syms x;
f=(3*x+1)/(2*x+1);
limit(f,x,inf)
Python代码:
from sympy import * #
x=symbols('x')
f=(3*x+1)/(2*x+1)
y=limit(f,x,oo) #正无穷 limit(f,x,oo);负无穷limit(f,x,-oo)
print(y)
网友评论