problem with Expand

• To: mathgroup at smc.vnet.net
• Subject: [mg26241] problem with Expand
• From: Peter Pollner <pollner at physik.uni-marburg.de>
• Date: Wed, 6 Dec 2000 02:16:24 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```hi,

I got a strange answer from Expand in the following situation:
fn1, pn1, fn and pn are polynomials upto order to in x. I want to check
the identity:

pn1 - pn - k/2*fn*fn = 0 + O(x^3)

the answer depends on the usage of Expand:
Expand[pn1 - pn - k/2*fn*fn]
and
Expand[pn1] - Expand[pn - k/2*fn*fn]
are not the same (the first expansion contains O(x^2) terms)!

Here is the full input:

pn1 = p0*x - k/12*n(n + 1)(2n + 1)x^2p0^2 - k/2*n(n + 1)p0*f0*x^2 -
k/2*(n + 1)x^2f0^2

fn1 = f0*x + (n + 1)p0*x - k/24*n(n + 1)(n + 1)(n + 2)x^2 p0^2 -
k/6*n(n + 1)(n + 2)x^2p0*f0 - k/4*(n + 1)(n + 2)x^2f0^2

pn = p0*x - k/12*(n - 1)n(2(n - 1) + 1)x^2p0^2 - k/2*n(n - 1)p0*f0*x^2 -
k/2*n x^2f0^2

fn = f0*x + n p0*x - k/24*(n - 1)n^2(n + 1)x^2 p0^2 -
k/6*(n - 1)n(n + 1)x^2p0*f0 - k/4*n(n + 1)x^2f0^2

Expand[pn1 - pn - k/2*fn*fn]

Expand[pn1] - Expand[pn - k/2*fn*fn]

I am using Mathematica 4.0.1.0, Platform : X

Is it a bug?