%mathpiper,def="Limit"

100 # IsIrrationalFunction(Sqrt(_expr), _var)_(IsPolynomial(expr, var) And Degree(expr, var) > 0 Or IsIrrationalFunction(expr,var)) <-- True;
100 # IsIrrationalFunction(_expr^_p, _var)_((IsPolynomial(expr, var) Or IsIrrationalFunction(expr,var)) And IsRationalOrNumber(p) And Not IsZero(p) And Not IsPositiveInteger(p)) <-- True;
100 # IsIrrationalFunction(_e1 + _e2, _var)_(IsIrrationalFunction(e1, var) And IsIrrationalFunction(e2, var) Or IsPolynomial(e1, var) And IsIrrationalFunction(e2, var) Or IsIrrationalFunction(e1, var) And IsPolynomial(e2, var)) <-- True;
100 # IsIrrationalFunction(_e1 - _e2, _var)_(IsIrrationalFunction(e1, var) And IsIrrationalFunction(e2, var) Or IsPolynomial(e1, var) And IsIrrationalFunction(e2, var) Or IsIrrationalFunction(e1, var) And IsPolynomial(e2, var)) <-- True;
100 # IsIrrationalFunction(_e1 * _e2, _var)_(IsIrrationalFunction(e1, var) And IsIrrationalFunction(e2, var) Or IsPolynomial(e1, var) And IsIrrationalFunction(e2, var) Or IsIrrationalFunction(e1, var) And IsPolynomial(e2, var)) <-- True;
100 # IsIrrationalFunction(_e1 / _e2, _var)_(IsIrrationalFunction(e1, var) And IsIrrationalFunction(e2, var) Or IsPolynomial(e1, var) And IsIrrationalFunction(e2, var) Or IsIrrationalFunction(e1, var) And IsPolynomial(e2, var)) <-- True;

500 # IsIrrationalFunction(_expr, _var) <-- False;

100 # IrrationalFunctionDegree(Sqrt(_expr), _var)_(IsPolynomial(expr, var)) <-- Degree(expr, var) / 2;
105 # IrrationalFunctionDegree(Sqrt(_expr), _var)_(IsIrrationalFunction(expr, var)) <-- IrrationalFunctionDegree(expr, var) / 2;
110 # IrrationalFunctionDegree(_expr^_p, _var)_(IsPolynomial(expr, var) And IsRationalOrNumber(p) And Not IsZero(p) And Not IsPositiveInteger(p)) <-- Degree(expr, var) * p;
110 # IrrationalFunctionDegree(_e1 - _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var)) <-- Maximum(IrrationalFunctionDegree(e1,var), IrrationalFunctionDegree(e2,var));
110 # IrrationalFunctionDegree(_e1 - _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var)) <-- Maximum(IrrationalFunctionDegree(e1,var), Degree(e2, var));
110 # IrrationalFunctionDegree(_e1 - _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var)) <-- Maximum(Degree(e1, var), IrrationalFunctionDegree(e2,var));
110 # IrrationalFunctionDegree(_e1 + _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var)) <-- Maximum(IrrationalFunctionDegree(e1,var), IrrationalFunctionDegree(e2,var));
110 # IrrationalFunctionDegree(_e1 + _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var)) <-- Maximum(IrrationalFunctionDegree(e1,var), Degree(e2, var));
110 # IrrationalFunctionDegree(_e1 + _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var)) <-- Maximum(Degree(e1, var), IrrationalFunctionDegree(e2,var));
110 # IrrationalFunctionDegree(_e1 * _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var)) <-- IrrationalFunctionDegree(e1,var) + IrrationalFunctionDegree(e2,var);
110 # IrrationalFunctionDegree(_e1 * _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var)) <-- IrrationalFunctionDegree(e1,var) + Degree(e2, var);
110 # IrrationalFunctionDegree(_e1 * _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var)) <-- Degree(e1, var) + IrrationalFunctionDegree(e2,var);

110 # IrrationalFunctionDegree(_e1 / _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var)) <-- IrrationalFunctionDegree(e1,var) - IrrationalFunctionDegree(e2,var);
110 # IrrationalFunctionDegree(_e1 / _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var)) <-- IrrationalFunctionDegree(e1,var) - Degree(e2, var);
110 # IrrationalFunctionDegree(_e1 / _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var)) <-- Degree(e1, var) - IrrationalFunctionDegree(e2,var);

100 # IrrationalFunctionLeadingCoef(Sqrt(_expr), _var)_(IsPolynomial(expr, var)) <-- Sqrt(LeadingCoef(expr, var));
105 # IrrationalFunctionLeadingCoef(Sqrt(_expr), _var)_(IsIrrationalFunction(expr, var)) <-- Sqrt(IrrationalFunctionLeadingCoef(expr, var));
110 # IrrationalFunctionLeadingCoef(_expr^_p, _var)_(IsPolynomial(expr, var) And IsRationalOrNumber(p) And Not IsZero(p) And Not IsPositiveInteger(p)) <-- LeadingCoef(expr, var)^p;

110 # IrrationalFunctionLeadingCoef(_e1 + _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var) And IrrationalFunctionDegree(e1,var) > IrrationalFunctionDegree(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var);
110 # IrrationalFunctionLeadingCoef(_e1 + _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var) And IrrationalFunctionDegree(e1,var) < IrrationalFunctionDegree(e2,var)) <-- IrrationalFunctionLeadingCoef(e2,var);
110 # IrrationalFunctionLeadingCoef(_e1 + _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var) And IrrationalFunctionDegree(e1,var) = IrrationalFunctionDegree(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var) + IrrationalFunctionLeadingCoef(e2,var);

110 # IrrationalFunctionLeadingCoef(_e1 + _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var) And IrrationalFunctionDegree(e1,var) > Degree(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var);
110 # IrrationalFunctionLeadingCoef(_e1 + _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var) And IrrationalFunctionDegree(e1,var) < Degree(e2,var)) <-- LeadingCoef(e2,var);
110 # IrrationalFunctionLeadingCoef(_e1 + _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var) And IrrationalFunctionDegree(e1,var) = Degree(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var) + LeadingCoef(e2,var);

110 # IrrationalFunctionLeadingCoef(_e1 + _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var) And Degree(e1,var) > IrrationalFunctionDegree(e2,var)) <-- LeadingCoef(e1,var);
110 # IrrationalFunctionLeadingCoef(_e1 + _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var) And Degree(e1,var) < IrrationalFunctionDegree(e2,var)) <-- IrrationalFunctionLeadingCoef(e2,var);
110 # IrrationalFunctionLeadingCoef(_e1 + _e2, _var)_(IsPolynomiaml(e1,var) And IsIrrationalFunction(e2,var) And Degree(e1,var) = IrrationalFunctionDegree(e2,var)) <-- LeadingCoef(e1,var) + IrrationalFunctionLeadingCoef(e2,var);

110 # IrrationalFunctionLeadingCoef(_e1 - _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var) And IrrationalFunctionDegree(e1,var) > IrrationalFunctionDegree(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var);
110 # IrrationalFunctionLeadingCoef(_e1 - _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var) And IrrationalFunctionDegree(e1,var) < IrrationalFunctionDegree(e2,var)) <-- -IrrationalFunctionLeadingCoef(e2,var);
110 # IrrationalFunctionLeadingCoef(_e1 - _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var) And IrrationalFunctionDegree(e1,var) = IrrationalFunctionDegree(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var) - IrrationalFunctionLeadingCoef(e2,var);

110 # IrrationalFunctionLeadingCoef(_e1 - _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var) And IrrationalFunctionDegree(e1,var) > Degree(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var);
110 # IrrationalFunctionLeadingCoef(_e1 - _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var) And IrrationalFunctionDegree(e1,var) < Degree(e2,var)) <-- -LeadingCoef(e2,var);
110 # IrrationalFunctionLeadingCoef(_e1 - _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var) And IrrationalFunctionDegree(e1,var) = Degree(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var) - LeadingCoef(e2,var);

110 # IrrationalFunctionLeadingCoef(_e1 - _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var) And Degree(e1,var) > IrrationalFunctionDegree(e2,var)) <-- LeadingCoef(e1,var);
110 # IrrationalFunctionLeadingCoef(_e1 - _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var) And Degree(e1,var) < IrrationalFunctionDegree(e2,var)) <-- -IrrationalFunctionLeadingCoef(e2,var);
110 # IrrationalFunctionLeadingCoef(_e1 - _e2, _var)_(IsPolynomiaml(e1,var) And IsIrrationalFunction(e2,var) And Degree(e1,var) = IrrationalFunctionDegree(e2,var)) <-- LeadingCoef(e1,var) - IrrationalFunctionLeadingCoef(e2,var);

110 # IrrationalFunctionLeadingCoef(_e1 * _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var) * IrrationalFunctionLeadingCoef(e2,var);
110 # IrrationalFunctionLeadingCoef(_e1 * _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var) * LeadingCoef(e2, var);
110 # IrrationalFunctionLeadingCoef(_e1 * _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var)) <-- LeadingCoef(e1, var) * IrrationalFunctionLeadingCoef(e2,var);
110 # IrrationalFunctionLeadingCoef(_e1 / _e2, _var)_(IsIrrationalFunction(e1,var) And IsIrrationalFunction(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var) / IrrationalFunctionLeadingCoef(e2,var);
110 # IrrationalFunctionLeadingCoef(_e1 / _e2, _var)_(IsIrrationalFunction(e1,var) And IsPolynomial(e2,var)) <-- IrrationalFunctionLeadingCoef(e1,var) / LeadingCoef(e2, var);
110 # IrrationalFunctionLeadingCoef(_e1 / _e2, _var)_(IsPolynomial(e1,var) And IsIrrationalFunction(e2,var)) <-- LeadingCoef(e1, var) / IrrationalFunctionLeadingCoef(e2,var);



/*                            */
/*  Limit operator rule base  */
/*                            */

/* Special case: limits of polynomials as x approaches infinity */
100 # Lim(_var, _tar, _dir, _p)_(IsPolynomial(p, var) And Degree(p, var) > 0 And IsInfinity(tar))
    <-- LeadingCoef(p,var) * Sign(tar)^Degree(p,var) * Infinity;

/* Special case: limits of rational function as x approaches infinity */
110 # Lim(_var, _tar, _dir, _r)_(IsRationalFunction(r, var) And IsInfinity(tar)) <-- 
[
    Local(p,q,pd,qd,pc,qc);

    p:=Numerator(r);
    q:=Denominator(r);

    pd:=Degree(p,var);
    qd:=Degree(q,var);

    pc:=LeadingCoef(p,var);
    qc:=LeadingCoef(q,var);

    If(pd>qd,
        pc/qc*tar,
        If(pd=qd,pc/qc,0)
    );
];

/* Special case: limits of irrational function as x approaches infinity */
110 # Lim(_var, _tar, _dir, _expr)_(IsIrrationalFunction(expr, var) And IsInfinity(tar)) <-- 
[
    Local(lc,dg);

    lc:=IrrationalFunctionLeadingCoef(expr, var);
    dg:=IrrationalFunctionDegree(expr, var);

    If(lc = 0,
        0,
        If(dg > 0,
            Sign(tar)^dg * Infinity,
            If(dg = 0, lc, 0)
        )
    );
];


/* Special case: make use of the logarithm properties */
120 # Lim(_var, _tar, _dir, Ln(_a) + Ln(_b)) <-- Lim(var, tar, dir, Ln(a*b));
120 # Lim(_var, _tar, _dir, Ln(_a) - Ln(_b)) <-- Lim(var, tar, dir, Ln(a/b));

/*  Exponentiation rules  */

/*  Special limit #1:  0 ^ 0;  #2:  1 ^ Infinity;  #3:  Infinity ^ 0  */
200 # Lim(_var, _tar, _dir, _x ^ _y)_
( [
    Local(lx,ly); lx := Lim(var, tar, dir, x); ly := Lim(var, tar, dir, y);
    ((IsZero(lx) And IsZero(ly)) Or ((lx = 1) And IsInfinity(ly)) Or (IsInfinity(lx) And IsZero(ly)));
] )
<-- Exp(Lim(var, tar, dir, y * Ln(x)));

/*  Default rule  */
210 # Lim(_var, _tar, _dir, _x ^ _y)
<-- Lim(var, tar, dir, x)^Lim(var, tar, dir, y);


/*  Division rules  */

/*  Special limit #4:  0 / 0;  #5:  Infinity / Infinity  */
300 # Lim(_var, _tar, _dir, _x / _y)_
( [
    Local(lx,ly,infx,infy);
     lx := Lim(var, tar, dir, x);
     ly := Lim(var, tar, dir, y);
     infx := (IsInfinity(lx) Or (IsZero(Re(lx)) And IsInfinity(Im(lx))));
     infy := (IsInfinity(ly) Or (IsZero(Re(ly)) And IsInfinity(Im(ly))));
    ((IsZero(lx) And IsZero(ly)) Or
     (infx And infy)
     );
] )
<-- Lim(var, tar, dir, ApplyFast("Differentiate", {var, x})/ApplyFast("Differentiate", {var, y}));

/*  Special limit #6: null denominator  */
/*  Probably there are still some problems.  */

Dir(Right) <-- 1;
Dir(Left) <-- -1;

/*  To get the sign of the denominator on one side:  */
Sign(_var, _tar, _dir, _exp, _n)
<-- [
  Local(der, coef); der := ApplyFast("Differentiate", {var, exp});
  coef := Eval(ApplyFast("Subst", {var, tar, der}));
  If ( coef = 0,
       Sign(var, tar, dir, der, n+1),
       (Sign(coef)*Dir(dir)) ^ n
     );
];

/*  To avoid infinite recursion (with 1/Exp(-x) for instance)  */
310 # Lim(_var, _tar, _dir, _x / _y)_
(IsInfinity(tar) And IsZero(Lim(var, tar, dir, y)))
<-- Sign(Lim(var, tar, dir, x))*Sign(Lim(var, tar, dir, ApplyFast("Differentiate", {var, y})))*tar;

320 # Lim(_var, _tar, _dir, _x / _y)_IsZero(Lim(var, tar, dir, y))
<-- Sign(Lim(var, tar, dir, x))*Sign(var, tar, dir, y, 1)*Infinity;


/*  Default rule  */
330 # Lim(_var, _tar, _dir, _x / _y) <-- [
    Local(u,v,r);

    u := Lim(var, tar, dir, x);
    v := Lim(var, tar, dir, y);

    r := u / v;

    If (u = Undefined And IsInfinity(v), [
        Local(li, ls);

        li := LimInf(var,tar,dir,x); 
        ls := LimSup(var,tar,dir,x);
        r := (li * ls) / v;
    ]);

    r;
];


/*  Multiplication rules  */

/*  To avoid some infinite recursions  */
400 # Lim(_var, _tar, _dir, _x * Exp(_y))_
(IsInfinity(Lim(var, tar, dir, x)) And (Lim(var, tar, dir, y) = -Infinity))
<-- Lim(var, tar, dir, x/Exp(-y));
400 # Lim(_var, _tar, _dir, Exp(_x) * _y)_
((Lim(var, tar, dir, x) = -Infinity) And IsInfinity(Lim(var, tar, dir, y)))
<-- Lim(var, tar, dir, y/Exp(-x));
400 # Lim(_var, _tar, _dir, Ln(_x) * _y)_
(IsZero(Lim(var, tar, dir, x)) And IsZero(Lim(var, tar, dir, y)))
<-- Lim(var, tar, dir, y*Ln(x));

/*  Special limit #7:  0 * Infinity  */
410 # Lim(_var, _tar, _dir, _x * _y)_
((IsZero(Lim(var, tar, dir, x)) And IsInfinity(Lim(var, tar, dir, y)))
  Or (IsInfinity(Lim(var, tar, dir, x)) And IsZero(Lim(var, tar, dir, y))))
<-- Lim(var, tar, dir, Simplify(ApplyFast("Differentiate", {var, y})/ApplyFast("Differentiate",
{var, 1/x})));

/*  Default rule  */
420 # Lim(_var, _tar, _dir, _x * _y) <-- [
    Local(u,v,r);

    u := Lim(var, tar, dir, x);
    v := Lim(var, tar, dir, y);

    r := u * v;

    If (u = 0 And v = Undefined, [
        li := LimInf(var,tar,dir,y); 
        ls := LimSup(var,tar,dir,y);
        r := u * li * ls;
    ], If (u = Undefined And v = 0, [
        li := LimInf(var,tar,dir,x); 
        ls := LimSup(var,tar,dir,x);
        r := v * li * ls;
    ]));

    r;
];

/*  Substraction rules  */

/*  Special limit #8:  Infinity - Infinity  */
500 # Lim(_var, _tar, _dir, _x - _y)_
( [
    Local(lx,ly); lx := Lim(var, tar, dir, x); ly := Lim(var, tar, dir, y);
    ((lx = Infinity) And (ly = Infinity)) Or ((lx = -Infinity) And (ly = -Infinity));
] )
<-- Lim(var, tar, dir, x*(1-y/x));

/*  Default rule  */
510 # Lim(_var, _tar, _dir, _x - _y)
<-- Lim(var, tar, dir, x)-Lim(var, tar, dir, y);

/*  Unary minus  */
520 # Lim(_var, _tar, _dir, - _x)
<-- - Lim(var, tar, dir, x);


/*  Addition rules  */

/*  Special limit #9:  Infinity + (-Infinity)  */
600 # Lim(_var, _tar, _dir, _x + _y)_
( [
    Local(lx,ly); lx := Lim(var, tar, dir, x); ly := Lim(var, tar, dir, y);
    ((lx = Infinity) And (ly = -Infinity)) Or ((lx = -Infinity) And (ly = Infinity));
] )
<-- Lim(var, tar, dir, x*(1+y/x));

603 # Lim(_var, _tar, _dir, _x + _y)_
(
    Lim(var, tar, dir, x) = Infinity And Lim(var, tar, dir, y) = Undefined And LimInf(var, tar, dir, y) != -Infinity
    Or
    Lim(var, tar, dir, x) = Undefined And LimInf(var, tar, dir, x) != -Infinity And Lim(var, tar, dir, y) = Infinity

) <-- Infinity;

/*  Default rule  */
610 # Lim(_var, _tar, _dir, _x + _y)
<-- Lim(var, tar, dir, x)+Lim(var, tar, dir, y);

/*  Global default rule : evaluate expression  */

700 # Lim(_var, _tar, _dir, exp_IsFunction)
<-- Eval(MapArgs(exp,"LimitArgs"));

LimitArgs(_arg) <-- Lim(var,tar,dir,arg);
UnFence("LimitArgs",1); /* Allow LimitArgs to have access to the local variables of the caller. */

701 # Lim(_var, _tar, _dir, _exp)
<-- Eval(ApplyFast("Subst", {var, tar, exp}));


/*  Limit without direction  */

10 # Lim(_var, tar_IsInfinity, _exp) <-- Lim(var, tar, None, exp);

20 # Lim(_var, _tar, _exp)
<-- [
  Local(l); l := Lim(var, tar, Left, exp);
  If ( l = Lim(var, tar, Right, exp),
       l,
       Undefined
     );
];


100 # LimInf(_var, _tar, _dir, Cos( _exp ))_IsInfinity(Lim(var,tar,dir,exp)) <-- -1;
100 # LimInf(_var, _tar, _dir, Sin( _exp ))_IsInfinity(Lim(var,tar,dir,exp)) <-- -1;

500 # LimInf(_var, _tar, _dir, _exp) <-- Lim(var,tar,dir,exp);

100 # LimSup(_var, _tar, _dir, Cos( _exp ))_IsInfinity(Lim(var,tar,dir,exp)) <-- 1;
100 # LimSup(_var, _tar, _dir, Sin( _exp ))_IsInfinity(Lim(var,tar,dir,exp)) <-- 1;

500 # LimSup(_var, _tar, _dir, _exp) <-- Lim(var,tar,dir,exp);


/* User-callable function */

(Limit(_var,_lim)(_fie)) <-- [
    Check(IsAtom(var) And Not(IsNumber(var)), "Argument", ExpressionToString(var) : " is not a valid variable");
    Lim(var,lim,fie); 
];

(Limit(_var,_lim,_direction)(_fie)) <-- [
    Check(IsAtom(var) And Not(IsNumber(var)), "Argument", ExpressionToString(var) : " is not a valid variable");
    Lim(var,lim,direction,fie);
];

UnFence("Limit",3);


%/mathpiper



%mathpiper_docs,name="Limit",categories="User Functions;Calculus Related (Symbolic)"
*CMD Limit --- limit of an expression
*STD
*CALL
	Limit(var, val) expr
	Limit(var, val, dir) expr

*PARMS

{var} -- a variable

{val} -- a number

{dir} -- a direction ({Left} or {Right})

{expr} -- an expression

*DESC

This command tries to determine the value that the expression "expr"
converges to when the variable "var" approaches "val". One may use
{Infinity} or {-Infinity} for
"val". The result of {Limit} may be one of the
symbols {Undefined} (meaning that the limit does not
exist), {Infinity}, or {-Infinity}.

The second calling sequence is used for unidirectional limits. If one
gives "dir" the value {Left}, the limit is taken as
"var" approaches "val" from the positive infinity; and {Right} will take the limit from the negative infinity.

*E.G.

In> Limit(x,0) Sin(x)/x
Result: 1;
In> Limit(x,0) (Sin(x)-Tan(x))/(x^3)
Result: -1/2;
In> Limit(x,0) 1/x
Result: Undefined;
In> Limit(x,0,Left) 1/x
Result: -Infinity;
In> Limit(x,0,Right) 1/x
Result: Infinity;
%/mathpiper_docs
