# Efficient calculation of leading order behavior of rational function under a limit?

Considering a rational function, as for example

myExpr=(x+3)(2+5x+6x^2)/(x(x-5)(x+20))


I would like to have a function that tells me the leading order behavior of myExpr under limits to infinity or to zero. Note that I am not interested in explicit coefficients and would like to save computational resources. All I need the function to return is:

LeadingOrder[myExpr,{x,0}]


-1

and

LeadingOrder[myExpr,{x,Infinity}]


0

I know there is a built in function that does this for polynomials Exponent[myPoly,x] when considering a limit to infinity. So I wonder if this can be done computationally efficiently for rational functions? Thanks for any suggestion.

Why not just

myExpr = (x + 3) (2 + 5 x + 6 x^2)/(x (x - 5) (x + 20));
Series[myExpr, {x, Infinity, 0}] // Normal
(* 6 *)
Series[myExpr, {x, 0, -1}] // Normal
(* -3/(50 x) *)


For this myExpr, Limit[myExpr, x -> Infinity] works as well.

For ratios of polynomials, as suggested by the OP in a comment, the following may be of use.

Exponent[Numerator[myExpr], x] - Exponent[Denominator[myExpr], x]
(* 0 *)


indicating that myExpr becomes constant for large x. And,

-(Exponent[Numerator[myExpr /. x -> 1/y], y] -
Exponent[Denominator[myExpr /. x -> 1/y], y])
(* -1 *)


indicating that myExpr varies as 1/x for small x.

• Yes, I am aware of these functions. Unfortunately, they are too resource hungry for the application I need it for. (Calculating explicit coefficients or limit results is much more than what I am looking for - makes the functions slow.) Thus my question above. – Kagaratsch Dec 2 '15 at 5:07
• @Kagaratsch The solutions I gave are, of course, quite general. More efficient, special purpose solutions may be possible, but they would need to be tuned to specific classes of expressions. What sorts of expressions do you have in mind. – bbgodfrey Dec 2 '15 at 5:10
• As mentioned in the question, I have rational functions in mind. I don't think I could narrow it down more than that. – Kagaratsch Dec 2 '15 at 5:12
• The function in your edit works twice as fast as Series and is more universal. Thanks! – Kagaratsch Dec 2 '15 at 5:35