>> syms x;
f=sin(x)/x;
>> limit(f,x,0)
ans =
1
>> v=symvar(f)
v =
x
>> L=limit(f,0)
L =
1
----------------------------------------------
>> syms x a b;
>> f=x*(1+a/x)^x*sin(b/x);L=limit(f,x,inf)
L =
b*exp(a)
------------------------------------------------
>> syms x;
>> f(x)=(exp(x^3)-1)/(1-cos(sqrt(x-sin(x))));
>> c=limit(f,x,0,'right')
c(x) =
12
>> x0=-0.1:0.001:0.1;
>> x0=x0(x0~=0);%将x=0去掉
>> y0=f(x0);
>> plot(x0,y0,0,c,'o')
>> syms x n;
f=n*atan(1/(n*(x^2+1)+x))*tan(pi/4+x/2/n)^n;
>> limit(f,n,inf)
ans =
exp(x)/(x^2 + 1)
------------------------------------------------
>> syms x n real;
>> f=x^n;
>> L1=limit (f,n,inf),L2=limit (f,x,inf)
L1 =
piecewise([x == 1, 1], [1 < x, Inf], [x < -1, limit(x^n, n, Inf)], [x in Dom::Interval(-1, 0) | x in Dom::Interval(0, 1), 0])
L2 =
piecewise([n == 0, 1], [0 < n, Inf], [n < 0, 0])
>> syms a b positive , syms x; f=a*sin(8*x^2)+b*cos(2*x-2);
L=feval (symengine,'limit',f,'x=infinity','Intervals')
L =
Dom::Interval([- a - b], [a + b])
分段函数.m
function f=piecewise(varargin),str=[];
try
for i=1:2:length(varargin),
str=[str ,'[',varargin{i},',',varargin{i+1},'],'];
end
catch,error('Input arguments should be given in pairs.'),
end
f=feval(symengine,'piecewise',str(1:end-1));
syms x;f(x)=piecewise('abs(x)>1.1','1.1*sign(x)','abs(x)<=1.1','x');x0=-3:0.01:3;f1=f(x0);plot(x0,f1);
多元函数求极限
>> syms x a;syms y positive;
>> f=exp(-1/(y^2+x^2))*sin(x)^2*(1+1/y^2)^(x+a^2*y^2);
>> L=limit(limit(f,x,1/sqrt(y)),y,inf)
L =
0
---------------------------------------------------------
>> syms x y;
>> f=(x*y/(x^2+y^2))^(x^2);
>> L1=limit(limit(f,x,inf),y,inf),L2=limit(limit(f,y,inf),x,inf),L3=limit(limit(f,x,y^2),y,inf),L4=limit(limit(f,y,x^2),x,inf)
L1 =
0
L2 =
0
L3 =
0
L4 =
0