# lim(y, x=x0) ; #lim(k_*y_,x_,c_,d_) := If(isfree(k,x), k*lim(y,x,c,d)); #lim(k_+y_,x_,c_,d_) := If(isfree(k,x), k+lim(y,x,c,d)); #lim(y_, x_,oo) := replace(y,x,oo); #lim(a_^b_, x_,c_) := If(isfree(b,x), lim(a,x,c)^b, exp(lim(b*ln(a),x,c))); lim(a_^b_, x_,c_) := block(f:=lim(a,x,c),g:=lim(b,x,c),if((f<>0 or f<>oo) and g<>0 or (f<>1 and g<>oo), f^g,exp(lim(b*ln(a),x,c)) )); lim(a_+b_, x_,c_) := block(f:=lim(a,x,c),g:=lim(b,x,c),if(f<>oo and g<> -oo, f+g )); #lim(a_*b_, x_,c_) := block(f:=lim(a,x,c),g:=lim(b,x,c),if((f<>0 and g<>oo) or (f<>oo and g<>0), f*g )); lim(a_*b_, x_,c_) := If(isfree(a,x), a*lim(b,x,c), block(f:=lim(a,x,c),g:=lim(a,x,c),if((f<>0 and g<>oo) or (f<>oo and g<>0), f*g ))); lim(a_/b_, x_,c_) := If(isfree(a,x), a/lim(b,x,c), block(f:=lim(d(a,x),x,c),g:=lim(d(b,x),x,c),if((f<>0 and g<>0) or (f<>oo and g<>oo), f/g,lim(d(a,x,2),x,c)/lim(d(b,x,2),x,c) ))); lim(1/a_*b_, x_,c_) := If(isfree(a,x), a/lim(b,x,c), block(f:=lim(d(a,x),x,c),g:=lim(d(b,x),x,c),if((f<>0 and g<>0) or (f<>oo and g<>oo), g/f,lim(d(b,x,2),x,c)/lim(d(a,x,2),x,c) ))); #lim(a_*b_, x_,inf) := If(has(a,exp(-x)) or has(b,exp(-x)), 0, lim(d(a,x),x,inf)*lim(d(b,x),x,inf)); lim(x_^n_*y_, x_,0) := if(n<0, d(y,x=0,-n)/(-n)!); lim(a_*x_^n_, x_,0) := if(n<0, d(a,x=0,-n)/(-n)!); lim((f(x_+h_)-f(x_))/h_, h_,0) := d(f(x)); lim(sum(y_,k_,a_,n_),n_,Infinity):=sum(y,k,a,oo); lim(sums(y_,k_,a_,n_),n_,Infinity):=sum(y,k,a,oo); #lim(x_*infsums(y_,k_),k_,infinity):= If(isatom(x),x*sum(y,k,infinity)); #lim(infsums(y_,k_)/x_,k_,infinity):= 1/x*sum(y,k,infinity); #lim(infsums(y_,k_),k_,infinity):= infsum(y,k); #lim(infsums((-1)^(k_-1)*x_^k_/k_),k_,infinity) := log(1+x); #lim(infsums(k_*x_^(k_-1),k_),k_,infinity):=1/(x-1)^2; lim(a_/x_,x_,0) := If(isfree(a,x), NaN); lim(1/x_,x_,0) := NaN; lim(x_^n_,x_,0,right) := If(n<0,infinity, If(n>0, 0)); lim(x_^n_,x_,0,left) := If(n<0, If(iseven(n), infinity, If(isodd(n), -inf )), If(n>0, 0)); lim(x_/(1+x_),x_,0) := 0; lim(1/x_*(1+x_),x_,infinity) := 1; lim(x_^x_,x_,0) :=1; lim(x_^x_,x_,-inf):=0; lim(x_^sin(x_),x_,0):=1; lim((1+1/k_)^k_,k_,0,right) :=1; lim((1+1/k_)^k_,k_,0,left) :=infinity; lim((1+k_)^(a_/k_),k_,0) :=exp(a); lim((1+k_)^(1/k_),k_,0) :=e; lim((1+1/k_)^k_,k_,infinity) :=e; lim((1+1/k_)^(k_*a_),k_,infinity) :=exp(a); lim((1+1/k_)^(k_*x_),k_,infinity) :=exp(x); lim((1+1/k_*x_)^(k_*a_),k_,infinity) :=exp(a*x); lim((1+x_/k_)^k_,k_,infinity) :=exp(x); lim((1+a_/k_)^k_,k_,infinity) :=exp(a); lim((1+a_/k_*x_)^k_,k_,infinity) :=exp(a*x); lim(sin(x_)/x_,x_,inf):=0; lim(sin(1/x_)*x_,x_,oo):=1; lim(sin(1/x_)*x_,x_,-oo):=1; lim(sin(x_)/x_,x_,0):=1; lim(sin(a_*x_)/x_,x_,0):=if(hasnot(a,x),a); lim(sin(a_*x_)/sin(b_*x_),x_,0):=if(hasnot(a,b,x),a/b); lim(cos(x_)/x_,x_,0,right) := infinity; lim(cos(x_)/x_,x_,0,left) := -inifity; #lim(x_^(-1)*tan(x_),x_,0) :=1; lim(tan(x_)/x_,x_,pi/2,right) :=-infinity; lim(tan(x_)/x_,x_,pi/2,left) :=infinity; lim(x_*log(x_),x_,0,right) :=0; lim(log(x_)/x_,x_,0,right) :=-infinity; lim(log(x_)/x_,x_,infinity) :=0; #lim(log(1+x_)/x_,x_,0) :=1; lim(log(1+x_)/x_,x_,infinity) :=0; lim(log(1+x_)/x_,x_,(-1),right) :=infinity; lim(log(x_),x_,0,right) := -infinity; lim(log(x_),x_,0,left) := -infinity; lim(log(x_),x_,0) := -infinity; lim(exp(1/x_),x_,0,right) := infinity; lim(exp(1/x_),x_,0,left) := 0; lim(x_*exp(1/x_),x_,0,right) := infinity; lim(x_*exp(1/x_),x_,0, left) := 0; lim(y_,x_):=lim(y,x,0); lim(y_,x_=a_) := lim(y,x,a); lim(y_,x_=a_,c_) := lim(y,x,a,c); lim(y_):=lim(y,x,0);