Re: same input ... different results???

• To: mathgroup at smc.vnet.net
• Subject: [mg87274] Re: same input ... different results???
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Sun, 6 Apr 2008 06:43:12 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <ft7gho\$bt5\$1@smc.vnet.net>

```ich wrote:

> i'm trying to solve the following equation with mathematica. why are there different results depending on whether or not i factor x out (see the two def. for f1)?
>
> Sum[f1[n1, n2, x, m, i, j, k], {i, 0, n1}, {j, 0, n2}, {k, 0, n2 + i - j}]
>
> f1[n1_, n2_, x_, m_, i_, j_, k_] :=
>  Exp[I*2*Pi*(m/3*(n1 + n2 - i - 2 j - k) + x*(n2 + i - j - 2 k))]
>
> f1[n1_, n2_, x_, m_, i_, j_, k_] :=
>  Exp[I*2*Pi*(m/3*(n1 + n2 - i - 2 j - k) + x*n2 + x*i - x*j - 2 x*k)]
>
> and still, both results do not match the sum if i enter specific values. so there must be something wrong, but what?

Not sure about what you did, but both sums appear to be identical. For
instance (note that I have change the order of the expressions and
renamed the second f1 to f2),

In[1]:= f1[n1_, n2_, x_, m_, i_, j_, k_] :=
Exp[I*2*Pi*(m/3*(n1 + n2 - i - 2 j - k) + x*(n2 + i - j - 2 k))]

s1 = Sum[f1[n1, n2, x, m, i, j, k], {i, 0, n1}, {j, 0, n2}, {k, 0,
n2 + i - j}]

f2[n1_, n2_, x_, m_, i_, j_, k_] :=
Exp[I*2*Pi*(m/3*(n1 + n2 - i - 2 j - k) + x*n2 + x*i - x*j - 2 x*k)]

s2 = Sum[f2[n1, n2, x, m, i, j, k], {i, 0, n1}, {j, 0, n2}, {k, 0,
n2 + i - j}]

s1 === s1 // Simplify

Out[2]= ((-(-1)^(1/3))^(-m n2 - 3 n2 x)
E^(-(2/3) I m \[Pi] + 2/3 I m n1 \[Pi] -
2 I \[Pi] (-(m/3) - 2 x) -
2 I \[Pi] x) (-(((1 - (-1)^((4 m)/3 + (4 m n1)/3 - 4 x -
4 n1 x)) E^((4 I m \[Pi])/3 + 2 I \[Pi] (-(m/3) - 2 x) +
2 I \[Pi] x + 2/3 I \[Pi] (2 m + 3 x)))/(
1 - (-1)^(
4/3 (m - 3 x)))) + ((1 - (-1)^((4 m)/3 + (4 m n1)/3 - 4 x -
4 n1 x)) E^((2 I m \[Pi])/3 + 2 I \[Pi] (-(m/3) - 2 x) +
4 I \[Pi] x + 2/3 I \[Pi] (2 m + 3 x)))/(
1 - (-1)^(
4/3 (m - 3 x))) + ((1 - (-1)^((4 m)/3 + (4 m n1)/3 - 4 x -
4 n1 x)) E^((4 I m \[Pi])/3 + 2 I \[Pi] (-(m/3) - 2 x) +
2 I \[Pi] x - 2/3 I n2 \[Pi] (2 m + 3 x)))/(
1 - (-1)^(
4/3 (m - 3 x))) - ((1 - (-1)^((4 m)/3 + (4 m n1)/3 - 4 x -
4 n1 x)) E^((2 I m \[Pi])/3 + 2 I \[Pi] (-(m/3) - 2 x) +
4 I \[Pi] x - 2/3 I n2 \[Pi] (2 m + 3 x)))/(
1 - (-1)^(4/3 (m - 3 x))) +
E^(n2 (-(4/3) I m \[Pi] - 2 I \[Pi] (-(m/3) - 2 x) -
2 I \[Pi] x)) (((-1)^(4 x)
E^(-(2/3) I (1 + n2) \[Pi] (m + 6 x)))/((-1)^(
4 x) - (-1)^(4 m/3) E^(2 I \[Pi] (-(m/3) - 2 x))) - ((-1)^(
4/3 (m - 3 x) + 4 x) E^(
2 I \[Pi] (-(m/3) - 2 x) -
2/3 I (1 + n2) \[Pi] (m + 6 x)) ((-1)^(4/3 (m - 3 x)) E^(
2 I \[Pi] (-(m/3) - 2 x)))^n1)/((-1)^(
4 x) - (-1)^(4 m/3) E^(2 I \[Pi] (-(m/3) - 2 x)))) -
E^((4 I m \[Pi])/3 + 2 I \[Pi] (-(m/3) - 2 x) +
2 I \[Pi] x) (((-1)^(4 x)
E^(-(2/3) I (1 + n2) \[Pi] (m + 6 x)))/((-1)^(
4 x) - (-1)^(4 m/3) E^(2 I \[Pi] (-(m/3) - 2 x))) - ((-1)^(
4/3 (m - 3 x) + 4 x) E^(
2 I \[Pi] (-(m/3) - 2 x) -
2/3 I (1 + n2) \[Pi] (m + 6 x)) ((-1)^(4/3 (m - 3 x)) E^(
2 I \[Pi] (-(m/3) - 2 x)))^n1)/((-1)^(
4 x) - (-1)^(4 m/3) E^(2 I \[Pi] (-(m/3) - 2 x)))) +
E^((4 I m \[Pi])/3 + 2 I \[Pi] (-(m/3) - 2 x) + 2 I \[Pi] x +
2/3 I \[Pi] (2 m + 3 x)) (((-1)^(4 x)
E^(-(2/3) I (1 + n2) \[Pi] (m + 6 x)))/((-1)^(
4 x) - (-1)^(4 m/3) E^(2 I \[Pi] (-(m/3) - 2 x))) - ((-1)^(
4/3 (m - 3 x) + 4 x) E^(
2 I \[Pi] (-(m/3) - 2 x) -
2/3 I (1 + n2) \[Pi] (m + 6 x)) ((-1)^(4/3 (m - 3 x)) E^(
2 I \[Pi] (-(m/3) - 2 x)))^n1)/((-1)^(
4 x) - (-1)^(4 m/3) E^(2 I \[Pi] (-(m/3) - 2 x)))) -
E^(2/3 I \[Pi] (2 m + 3 x) +
n2 (-(4/3) I m \[Pi] - 2 I \[Pi] (-(m/3) - 2 x) -
2 I \[Pi] x)) (((-1)^(4 x)
E^(-(2/3) I (1 + n2) \[Pi] (m + 6 x)))/((-1)^(
4 x) - (-1)^(4 m/3) E^(2 I \[Pi] (-(m/3) - 2 x))) - ((-1)^(
4/3 (m - 3 x) + 4 x) E^(
2 I \[Pi] (-(m/3) - 2 x) -
2/3 I (1 + n2) \[Pi] (m + 6 x)) ((-1)^(4/3 (m - 3 x)) E^(
2 I \[Pi] (-(m/3) - 2 x)))^n1)/((-1)^(
4 x) - (-1)^(4 m/3) E^(2 I \[Pi] (-(m/3) - 2 x))))))/((-1 +
E^(I \[Pi] (-(m/3) - 2 x))) (1 + E^(
I \[Pi] (-(m/3) - 2 x))) (E^((I m \[Pi])/3) - E^(
I \[Pi] x)) (E^((I m \[Pi])/3) + E^(I \[Pi] x)) (-1 + E^(
1/3 I \[Pi] (2 m + 3 x))) (1 + E^(1/3 I \[Pi] (2 m + 3 x))))

Out[4]= E^(2 I \[Pi] x)/(1 - E^(2 I \[Pi] x))^2 + (
1 - E^(2 I \[Pi] x + 2 I n1 \[Pi] x))/(
1 - E^(2 I \[Pi] x)) - (E^(2 I \[Pi] x))^(
1 + n1) (E^(2 I \[Pi] x)/(1 - E^(2 I \[Pi] x))^2 -
1/(-1 + E^(2 I \[Pi] x)) - n1/(-1 + E^(2 I \[Pi] x))) + (
3 (1 - E^(2 I \[Pi] x + 2 I n1 \[Pi] x)) n2)/(
2 (1 - E^(2 I \[Pi] x))) + (E^(
2 I \[Pi] x)/(1 - E^(2 I \[Pi] x))^2 - (E^(2 I \[Pi] x))^(
1 + n1) (E^(2 I \[Pi] x)/(1 - E^(2 I \[Pi] x))^2 -
1/(-1 + E^(2 I \[Pi] x)) -
n1/(-1 + E^(2 I \[Pi] x)))) n2 + ((1 - E^(
2 I \[Pi] x + 2 I n1 \[Pi] x)) n2^2)/(2 (1 - E^(2 I \[Pi] x)))

Out[5]= True

Regards,
-- Jean-Marc

```

• Prev by Date: Re: Help with Check Function Arguments & Options
• Next by Date: Re: Label vertices in Graph to display with GraphPlot
• Previous by thread: same input ... different results???
• Next by thread: Help with Check Function Arguments & Options