1

I am sorry for asking a similar question again. I asked How to find the lowest power of variable in expression? and I got a wonderful answer, but I have one more question for a multi-variable expression.

One variable expression

On last question, if I have expression

exp=a1/x + a2/x^2 + a3/x^3;   

Then @Algohi said

v=Min@Cases[exp, Power[_, x_?NumberQ] :> x, -1];
Cases[exp, Times[x_, Power[_, v]], -1]

and @Nasser said

r = {Coefficient[#, x, Exponent[#, x]], #, Exponent[#, x]} & /@ (List @@ expr)[[1,2]]

Multi-variable expression

Both solution gave me solution for my previous problem, but now I have some expression such as

exp=3/x + 6/(x^2 z^5) + 7/x^3+ 1/y^5+ 1/(z^3 x^4 y)+7/x^5+1/z^7;   

If I make it little more complicated, lets say I do not care about z, and only care about x and y, so I want MMA to return

1/y^5+ 1/(z^3 x^4 y)+7/x^5

Since the combined power of x and y are -5 which is the minimum, it will print the term with -5 power by x and y.

Again, I am sorry for duplicating the question, and I really appreciate Stack Exchange's Help!!!

Carl Woll
  • 130,679
  • 6
  • 243
  • 355
Saesun Kim
  • 1,810
  • 13
  • 24

2 Answers2

2
exp2 = List @@ exp /. y -> x;
xpow = Min@Cases[exp2, Power[x, p_] :> p, -1];
pos = Position[exp2, x^xpow, -1][[;; , 1]];
exp[[pos]]

(*7/x^5 + 1/y^5 + 1/(x^4 y z^3)*)
Basheer Algohi
  • 19,917
  • 1
  • 31
  • 78
2

I would scale x and y by a common factor, then use Series on this common factor to find the leading term, similar to my answer to Get leading series expansion term?:

series = (exp /. {x->x s, y->y s} /. s->s+O[s]^2);
series //TeXForm

$\frac{\frac{7}{x^5}+\frac{1}{x^4 y z^3}+\frac{1}{y^5}}{s^5}+O\left(\frac{1}{s^4}\right)$

We can extract the leading term using:

series[[3, 1]]

7/x^5 + 1/y^5 + 1/(x^4 y z^3)

Carl Woll
  • 130,679
  • 6
  • 243
  • 355