Re: problem with Expand

• To: mathgroup at smc.vnet.net
• Subject: [mg26259] Re: problem with Expand
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Sun, 10 Dec 2000 00:19:34 -0500 (EST)
• Organization: Universitaet Leipzig
• References: <90kqsc\$r3g@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

a bit of basic algebra

-a - b == -(a+b)

and

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

is
Expand[pn1 - (pn + k/2*fn*fn)]

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

Don't use a computer algebra before you have
finished the primary school.

Regards
Jens

Peter Pollner wrote:
>
> 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?
>