# Integration - symbols make a difference?

**URL:** <https://community.wolfram.com/t/integration-symbols-make-a-difference/5992>\
**Category:** Questions\
**Tags:** physics, mathematica\
**Created:** [June 20, 2015, 4:03am UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992 "2015-06-20T04:03:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![yajnaval](https://avatars.discourse-cdn.com/v4/letter/y/8edcca/32.png) [@yajnaval](https://community.wolfram.com/u/yajnaval)\
**Post date:** [June 20, 2015, 4:03am UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992/1 "2015-06-20T04:03:00Z")

</div>

Integrate$[\frac{q\_1}{(q\_1^2 + b^2)} Log [(p + q\_1^2)+m^2],{q\_1,0,Infinity}]$

gives a different answer than

Integrate$[\frac{a}{(a^2 + b^2)} Log [(p + a^2)+m^2],{a,0,Infinity}]$

Using Mathematica 10.0

Why?

---

<div class="post-metadata">

**Author:** ![gianlucagorni](https://avatars.discourse-cdn.com/v4/letter/g/ec9cab/32.png) [@gianlucagorni](https://community.wolfram.com/u/gianlucagorni)\
**Post date:** [June 20, 2015, 5:16am UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992/2 "2015-06-20T05:16:18Z")

</div>

With Mathematica 10.1 both integrals return non convergent, which seems to be correct.

---

<div class="post-metadata">

**Author:** ![yajnaval](https://avatars.discourse-cdn.com/v4/letter/y/8edcca/32.png) [@yajnaval](https://community.wolfram.com/u/yajnaval)\
**Post date:** [June 20, 2015, 12:03pm UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992/3 "2015-06-20T12:03:04Z")

</div>

Is there such a drastic difference between Mathematica 10.0 and 10.1? The second integral yields

ConditionalExpression [(b^2 Log[b^2] - m^2 Log[m^2])/(2 b^4 - 2 b^2 m^2), Re[b] != 0]

whereas the first one goes unsolved?

---

<div class="post-metadata">

**Author:** ![jbaldwin](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jbaldwin](https://community.wolfram.com/u/jbaldwin)\
**Post date:** [June 20, 2015, 4:12pm UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992/4 "2015-06-20T16:12:08Z")

</div>

Would you attach a notebook with both equations (or use the Code Sample option) so that the equation is more readable and more immediately accessible for us to try in Mathematica?

---

<div class="post-metadata">

**Author:** ![yajnaval](https://avatars.discourse-cdn.com/v4/letter/y/8edcca/32.png) [@yajnaval](https://community.wolfram.com/u/yajnaval)\
**Post date:** [June 21, 2015, 12:51pm UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992/5 "2015-06-21T12:51:34Z")

</div>

Yes, here is a Notebook with 3 Integrals, two of them with just a difference in symbol (“q1” instead of “a”).  
Also (reply to another post) the Integrals are not all necessarily divergent, all variables are Real and greater than 0.

---

<div class="post-metadata">

**Author:** ![jbaldwin](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jbaldwin](https://community.wolfram.com/u/jbaldwin)\
**Post date:** [June 21, 2015, 3:08pm UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992/6 "2015-06-21T15:08:47Z")

</div>

Thanks. At some point `q` must have been defined to be zero which is why you see

 ![integration.png](https://global.discourse-cdn.com/wolfram/original/2X/0/0a236131be53e2b9ba39adb5631eb2000b95df43.png)

This means that when you write

```
Integrate[a/(a^2 + b^2)^2 Log[(a + q)^2 + m^2], {a, 0, Infinity}]

```

you are really evaluating this with `q = 0` which gives you the definite result that you see.

```
ConditionalExpression[(b^2 Log[b^2] - m^2 Log[m^2])/(2 b^4 - 2 b^2 m^2), Re[b] != 0]

```

If you try running all equations with a fresh session, you will find that none will have been evaluated to a closed-form solution. (And I would suggest that avoiding subscripts unless absolutely necessary. Use `q1` instead of `Subscript[q, 1]`.)

---

<div class="post-metadata">

**Author:** ![jbaldwin](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jbaldwin](https://community.wolfram.com/u/jbaldwin)\
**Post date:** [June 21, 2015, 5:22pm UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992/7 "2015-06-21T17:22:19Z")

</div>

For special case with `p -> 1`

```
Integrate[a/(a^2 + b)^2 Log[(a + p)^2 + m] /. p -> 1, {a, 0, Infinity}]

```

one obtains

```
ConditionalExpression[(1/(2 b))(Log[m] + (Sqrt[b] \[Pi] + b^(3/2) \[Pi] - 2 b Sqrt[m] \[Pi] + 
      Sqrt[b] m \[Pi] + 4 b Sqrt[m] ArcTan[1/Sqrt[m]] + 
      b (1 + b - m) Log[b] + Log[1 + 1/m] + 2 b Log[1 + 1/m] + 
      b^2 Log[1 + 1/m] + 2 m Log[1 + 1/m] - 2 b m Log[1 + 1/m] + 
      m^2 Log[1 + 1/m] - b Log[1 + m] - b^2 Log[1 + m] + 
      b m Log[1 + m])/(b^2 - 2 b (-1 + m) + (1 + m)^2)),
     (-1 < Im[Sqrt[m]] < 1 || Re[Sqrt[m]] > 0) && (Re[Sqrt[-m]] < 1 || 
    Sqrt[-m] \[NotElement] Reals) && Re[Sqrt[b]] > 0 && Re[m] > 0]

```

So it would seem that you could be successful in getting a general solution with a change in variable with `a = p u`. (And note that I changed `m^2` to `m` and `b^2` to `b`. Mathematica still gives a solution when `p = 1` but it’s a bit less messy with the squares removed. But I don’t think that really changes anything with respect to getting a general solution.)

---

<div class="post-metadata">

**Author:** ![jbaldwin](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jbaldwin](https://community.wolfram.com/u/jbaldwin)\
**Post date:** [June 21, 2015, 7:48pm UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992/8 "2015-06-21T19:48:32Z")

</div>

Following the change-in-variable approach…

```
sol = Integrate[u/(p^2 (u^2 + c)^2) (2 Log[p] + Log[(u + 1)^2 + d]), {u, 0, Infinity},
   Assumptions -> {c > 0, d > 0}] /. {c -> b^2/p^2, d -> m^2/p^2};
sol = FunctionExpand[sol, Assumptions -> {m > 0, p > 0, b > 0}] //. {Sqrt[(b^2 m^2)/p^4] -> b m/p^2, 
    Sqrt[b^2/p^2] -> b/p, ((b^2 m^2)/p^4)^(3/2) -> b^3 m^3/p^6, 
    Sqrt[(b^10 m^2)/p^12] -> b^5 m/p^6, (b^2/p^2)^(3/2) -> b^3/p^3, (b^2/p^2)^(5/2) -> b^5/p^5};
sol = FullSimplify[sol];
sol = Collect[sol, {\[Pi], Log[b], Log[m], Log[p], Log[1 + m^2/p^2], Log[1 + p^2/m^2]}]

```

I get the following solution (which certainly could be compacted a bit more):

```
(p \[Pi])/(2 b ((b + m)^2 + p^2)) + 
(2 m p ArcTan[p/m])/(((b - m)^2 + p^2) ((b + m)^2 + p^2)) + ((b^2 - m^2 + p^2) Log[b])/(((b - m)^2 + p^2) ((b + m)^2 + p^2)) + 
((2 b^4 - 4 b^2 m^2 + 2 m^4 + 4 b^2 p^2 + 4 m^2 p^2 + 2 p^4) Log[m])/(2 b^2 ((b - m)^2 + p^2) ((b + m)^2 + p^2)) +
((-b^4 + b^2 m^2 - b^2 p^2) Log[1 + m^2/p^2])/(2 b^2 ((b - m)^2 + p^2) ((b + m)^2 + p^2)) +
((-2 b^4 + 2 b^2 m^2 - 2 b^2 p^2) Log[p])/(2 b^2 ((b - m)^2 + p^2) ((b + m)^2 + p^2)) +
(((b^2 - m^2)^2 + 2 (b^2 + m^2) p^2 + p^4) Log[1 + p^2/m^2])/(2 b^2 ((b - m)^2 + p^2) ((b + m)^2 + p^2))

```

As a way to do some checking:

```
parms = {b -> 2.3, p -> 4.7, m -> 18.2};
sol /. parms
NIntegrate[a/(a^2 + b^2)^2 Log[(a + p)^2 + m^2] /. parms, {a, 0, Infinity}]

```

which results in 0.567437 for both.

---

<div class="post-metadata">

**Author:** ![seanc](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/seanc/32/34005_2.png) [@seanc](https://community.wolfram.com/u/seanc)\
**Post date:** [June 22, 2015, 9:15pm UTC](https://community.wolfram.com/t/integration-symbols-make-a-difference/5992/9 "2015-06-22T21:15:39Z")

</div>

I can answer your question abstractly. To paraphrase, you asked:

> Can changing the name of a variable affect the outcome of a symbolic  
> calcuation?

Yes it can. And this is a fact of life you have to live with. It’s as fundamental a problem to scientific computing as floating point error is.

When you add variables together, they get sorted alphabetically: a+c+b gets turned into a+b+c. These are equivalent algebraically, but not equivalent numerically with floating point numbers. This is one reason to be warry of mixing symbolic transformations with floating point calculations. Why does it sort? Cannonicalization. This helps with many things including comparing expressions.

Mathematica also can’t try every possible combination of transformations. So the ordering of terms has some possible effect on which terms are adjacent and which transformations will be tried.

TL;DR When using symbolic computing the names of your variables can matter. They aren’t variables in the sense of most programming languages, but are symbols, which means something deeper.
