From: Bob Hanlon on

f1[x_] = Integrate[1/(x + 1) - 1/(x + 6), x] // Simplify

log(-2 (x+1))-log(2 (x+6))

f1'[x]

1/(x + 1) - 1/(x + 6)

It means that for the result to be real that x must be less than -1.

Reduce[-2 (x + 1) > 0]

x < -1

Looking at both Logs

Reduce[{-2 (x + 1) > 0, 2 (x + 6) > 0}]

-6 < x < -1

Plot[f1[x], {x, -6, -1}]

If you don't like the Log form, use FullSimplify

f2[x_] = Integrate[1/(x + 1) - 1/(x + 6), x] // FullSimplify

-2*ArcTanh[(2*x)/5 + 7/5]

f2'[x] // Simplify // Apart

1/(x + 1) - 1/(x + 6)

f1[x] == f2[x] // FullSimplify

True


Bob Hanlon

---- Jon Joseph <josco.jon(a)gmail.com> wrote:

=============
All: Is this integral wrong? If not could someone explain the minus sign
inside the log?

Integrate[1/(x + 1) - 1/(x + 6), x] // Simplify

log(-2 (x + 1)) - log(2 (x + 6))

Thanks, Jon.=



From: Simon on
On Feb 7, 7:15 pm, Jon Joseph <josco....(a)gmail.com> wrote:
> All: Is this integral wrong? If not could someone explain the minus sign
> inside the log?
>
> Integrate[1/(x + 1) - 1/(x + 6), x] // Simplify
>
> log(-2 (x + 1)) - log(2 (x + 6))
>
> Thanks, Jon.=

The integral is correct (just take its derivative and see).
>From the look of the unsimplified output
In[1]:= Integrate[1/(x + 1) - 1/(x + 6), x]
Out[1]= 5 (1/5 Log[-2 (1 + x)] - 1/5 Log[2 (6 + x)])
I think that Mathematica is doing a Together before the integral.
If you integrate each term separately, you get what you'd expect
In[2]:= Integrate[{1/(x + 1), -1/(x + 6)}, x]
Out[2]= {Log[1 + x], -Log[6 + x]}
But of course, the different branches of Log only differ by a
constant
-- which is exactly what indefinite integrals don't care about.
If x > 1, then you can simply factor out the minus sign using
In[3]:= Log[-1]
Out[3]= I \[Pi]

From: Nasser M. Abbasi on

"Jon Joseph" <josco.jon(a)gmail.com> wrote in message
news:hkm7d8$os0$1(a)smc.vnet.net...
> All: Is this integral wrong? If not could someone explain the minus sign
> inside the log?
>
> Integrate[1/(x + 1) - 1/(x + 6), x] // Simplify
>
> log(-2 (x + 1)) - log(2 (x + 6))
>
> Thanks, Jon.=
>

Well, lets see:

log(-2 (x + 1)) - log(2 (x + 6))
= log(-2)+log(1+x) -log(2)-log(x+6)
= log(-1)+log(2)+log(1+x)-log(2)-log(x+6)
= log(-1)+ log(1+x) - log(x+6)

but log(-1) = Sqrt[-1]*Pi

so result is

Sqrt[-1]*Pi + log(1+x) - log(x+6)

But we all know that the result should be

log(1+x) - log(x+6)

So, an extra term, Sqrt[-1]*Pi term pops up. But this term is a constant, so
its derivative is zero, i.e. a constant of integration.

Since

D[log(-2 (x + 1)) - log(2 (x + 6)),x] will give back

1/(x + 1) - 1/(x + 6)

So, in theory, the answer given by Mathematica is NOT wrong.

But Mathematica does (normally?) return results for indefinite integrals
without an explicit constant of integration. So I am not sure why it does in
this case, and if it it does, why did not pick this constant? Why not C[1]
as it does for DSolve[]?

So, if I have to guess, I'd say this result is at least very weired, but
mathematically it is not wrong?

--Nasser



From: Jon Joseph on
Thanks Bob and David. I completely understand your responses and I
figured that was what Mathematica was doing. However, if I asked my
students to integrate 1/(x+1) - 1/(x+6) and they came back with the
answer Mathematica found I would, at the very least, call that student
over for a discussion. Log arguments in absolute value are certainly
more "traditional" .

I appreciate Mathematica's complexity but it is unfortunate that a user
has to piece together the underlying logic on such a simple problem. Jon


On Feb 7, 2010, at 7:38 AM, Bob Hanlon wrote:

>
> f1[x_] = Integrate[1/(x + 1) - 1/(x + 6), x] // Simplify
>
> log(-2 (x+1))-log(2 (x+6))
>
> f1'[x]
>
> 1/(x + 1) - 1/(x + 6)
>
> It means that for the result to be real that x must be less than -1.
>
> Reduce[-2 (x + 1) > 0]
>
> x < -1
>
> Looking at both Logs
>
> Reduce[{-2 (x + 1) > 0, 2 (x + 6) > 0}]
>
> -6 < x < -1
>
> Plot[f1[x], {x, -6, -1}]
>
> If you don't like the Log form, use FullSimplify
>
> f2[x_] = Integrate[1/(x + 1) - 1/(x + 6), x] // FullSimplify
>
> -2*ArcTanh[(2*x)/5 + 7/5]
>
> f2'[x] // Simplify // Apart
>
> 1/(x + 1) - 1/(x + 6)
>
> f1[x] == f2[x] // FullSimplify
>
> True
>
>
> Bob Hanlon
>
> ---- Jon Joseph <josco.jon(a)gmail.com> wrote:
>
> =============
> All: Is this integral wrong? If not could someone explain the minus sign
> inside the log?
>
> Integrate[1/(x + 1) - 1/(x + 6), x] // Simplify
>
> log(-2 (x + 1)) - log(2 (x + 6))
>
> Thanks, Jon.=
>
>


From: DrMajorBob on
A key point is that Log[ k g[x] ] == Log@k + Log@g[x], so the multipliers
2 and -2 inside the logs are simply (arbitrary) constants of integration.

Anyway, Mathematica's result has the intended derivative:

f[x_] = Integrate[1/(x + 1) - 1/(x + 6), x] // Simplify
D[f@x, x]

Log[-2 (1 + x)] - Log[2 (6 + x)]

1/(1 + x) - 1/(6 + x)

The question is only, "Where is it defined and continuous?"

The first term of the integrand, 1/(x+1), has a pole at -1. The second
term has a pole at -6.

Hence, plotting over the range between:

Plot[f@x, {x, -6, -1}, PlotRange -> All]

Plot[1/(x + 1) - 1/(x + 6), {x, -6, -1}]

The two plots seem consistent; I see no reason to question Mathematica's
result.

Near -6 (but greater), the second term dominates in both integrand and
integral. x+6 is small but positive, so 1/(6+x) is large but positive.

Near -1 (but smaller), the first term dominates. x+1 is small and
negative, so 1/(x+1) is large and negative, hence Log[-2 (1+x)] is large
and positive.

If we try to plot on other ranges, we'll have Complex results from Log...
but D and Integrate assume complex variables anyway.

Bobby

On Sun, 07 Feb 2010 05:12:45 -0600, Jon Joseph <josco.jon(a)gmail.com> wrote:

> All: Is this integral wrong? If not could someone explain the minus sign
> inside the log?
>
> Integrate[1/(x + 1) - 1/(x + 6), x] // Simplify
>
> log(-2 (x + 1)) - log(2 (x + 6))
>
> Thanks, Jon.=
>


--
DrMajorBob(a)yahoo.com

First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: parallel table
Next: Park's and Bergstrom's packages