0

I found that using Series and Normal command, I am able to approximate the first order of x or y, but If I also get rid of x*y (cross term), Series command does not work any more.

Let's define some arbitrary function for example.

f = 1/x + (x^2 y + 1)/(2 + x + x^2) + (y^2 + x)/x^2 + (x y + 1)/x^2

Series command

If I use Series function,

Series[Series[f, {x, 0, 1}], {y, 0, 1}] // Normal // Together

This will give me

(4 + 8 x + 2 x^2 - x^3 + 4 x y)/(4 x^2)

But I still have cross term but series command cannot get rid of cross term.

Series[%, {x*y, 0, 0}] // Normal // Together

Which does not know that it is cross term, and also I still have 2nd order

(4 + 8 x + 2 x^2 - x^3 + 4 x y)/(4 x^2)

By hand

(4 + 8 x )/(4 x^2)
=> 1/x^2 + 2/x

Ideal Result

Here is what I want to get, which results quite differently with previous approach.

Together[f]

This will give me

 (2 + 5 x + 4 x^2 + 2 x^3 + 2 x y + x^2 y + x^3 y + x^4 y + 2 y^2 + 
 x y^2 + x^2 y^2)/(x^2 (2 + x + x^2))

Get rid of all the higher order term of x and y and cross term (Since the Denominator expands to 2 x^2 + x^3 + x^4, So I get rid of all the higher order so it will become 2 x^2,)

By hand

(2 + 5 x)/(2 x^2)

=> 1/x^2 + 5/(2 x)

So I have two question

  1. Why do I get different answer?
  2. How to do by hand part in MMA?
Saesun Kim
  • 1,810
  • 13
  • 24
  • 1
    How did you use Series - you're not explaining what you tried, i.e., the code using Series that you said doesn't work. What are the small variables? Just x, or also y, or some combination of them? Are you expanding around zero? – Jens Apr 01 '16 at 15:51
  • I cannot figure out what is the desired result. – Daniel Lichtblau Apr 01 '16 at 16:17
  • I modified the question to make it clear. I am sorry for confusing question. @DanielLichtblau – Saesun Kim Apr 01 '16 at 16:20
  • I modified the question to make it clear. I am sorry for confusing question. @Jens – Saesun Kim Apr 01 '16 at 16:25
  • what happend to the 2*y^2 part in the numerator? From your desired result, I guess that you want to neglect it because its exponent (2) is larger than the smallest non-zero exponent belonging to x (1)? I do not have time to answer right now, will do that later if noone else does in the meantime. As a start for you: To get rid of crossterms, consider this: term/.x^(n___:1)*y^(n___:1)->0 where term is some polynomial. – Lukas Apr 01 '16 at 16:25
  • @Lukas Since the Denominator x^2 (2 + x + x^2), when I expand it, it will be 2 x^2 + x^3 + x^4, So I get rid of all the higher order so it will become 2 x^2, I edit the post! Thank you! – Saesun Kim Apr 01 '16 at 16:28
  • No I mean the numerator. The “upper“ part of your fraction. There is a 2y^2 term not involved into crossterms. It just disappears, although it is (apart from constant) the lowest order in y – Lukas Apr 01 '16 at 16:30
  • @Lukas Ah, because y^2 is also higher than y, so I only keep until the first order – Saesun Kim Apr 01 '16 at 16:31

1 Answers1

4

I suspect that your "by hand" math is wrong. Here is what you get when doing a consistent first-order expansion:

expr = (2 + 5 x + 4 x^2 + 2 x^3 + 2 x y + x^2 y + x^3 y + 
    x^4 y + 2 y^2 + x y^2 + x^2 y^2)/(x^2 (2 + x + x^2));

Normal[
  Series[expr /. {x -> ϵ x, y -> ϵ y}, {ϵ, 0, 1}]] /. ϵ -> 1

$$\frac{y^2}{x^2}+\frac{1}{x^2}+\frac{y}{x}-\frac{x}{4}+\frac {2}{x}+\frac{1}{2}$$

Jens
  • 97,245
  • 7
  • 213
  • 499
  • Thank you for the help, but when I combine together, (4 + 8 x + 2 x^2 - x^3 + 4 x y + 4 y^2)/(4 x^2) I still have cross term. and second order on top. – Saesun Kim Apr 01 '16 at 16:36
  • Oh, Sorry, I guess I can just separate , numerator and denaminator again and do the series – Saesun Kim Apr 01 '16 at 16:37