Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Re: Integrate vs NIntegrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89206] Re: [mg89182] Re: [mg89147] Re: [mg89129] Integrate vs NIntegrate
  • From: DrMajorBob <drmajorbob at att.net>
  • Date: Thu, 29 May 2008 07:04:38 -0400 (EDT)
  • References: <9489155.1211802216995.JavaMail.root@m08> <op.ubr1yjh52c6ksp@bobbys-imac> <2b8d8f40805261936u2ec81454r1b6ba16be0897662@mail.gmail.com> <200805271114.HAA01380@smc.vnet.net> <29744585.1211975587467.JavaMail.root@m08>
  • Reply-to: drmajorbob at longhorns.com

> Not a proof, of course, but I would bet a fair amount on it [Integrate]  
> being right.

I believe someone recently said we should ignore predictions from those 
who haven't staked actual money on it.

But anyway, is Integrate correct in BOTH these calculations?

q = -1/2; a = 0; b = 3;
h[x_] = (1 + x^3)^q;
f[x_] = Integrate[h[x], x];
f[b] - f[a] // N

-2.55387 - 2.42865 I

f[x_] = Integrate[h[t], {t, 0, x}];
f[b] - f[a] // N

1.65267

Along with the OP, I'm betting the first result from Integrate is wrong, 
in view of

NIntegrate[h[x], {x, a, b}]

1.65267

If NIntegrate is wrong instead, that hardly improves matters.

Bobby

On Wed, 28 May 2008 03:46:27 -0500, Andrzej Kozlowski <akoz at mimuw.edu.pl>  
wrote:

> I would say that Integrate is correct. Evidence:
>
> In[1]:= q = -2^(-1);
>
> In[2]:= f = Integrate[(1 + x^3)^q, x];
>
> In[3]:= g = Chop[N[D[Normal[f + O[x]^12], x]]]
>
> Out[3]= -0.3125000000000013*x^9 + 0.37500000000000105*x^6 -
> 0.5000000000001258*x^3 +
>     0.9999999999999998
>
> and, on the other hand:
>
> In[4]:= N[Normal[(1 + x^3)^q + O[x]^10]]
> Out[4]= -0.3125*x^9 + 0.375*x^6 - 0.5*x^3 + 1.
>
>
> Not a proof, of course, but I would bet a fair amount on it being right.
>
> Andrzej Kozlowski
>
>
> On 27 May 2008, at 20:14, DrMajorBob wrote:
>
>> Because they're completely different. One is an antiderivative in
>> Complex
>> variables; the other is a definite integral from 0 to x (so you know
>> that
>> it is zero at zero, among other things). Antiderivatives tend to have
>> branch cuts, poles, etc., and Mathematica's chosen branch is complex
>> in
>> part of your region.
>>
>> Or... it's entirely possible Mathematica's answer for
>> Integrate[h[x], x]
>> is simply WRONG.
>>
>> Let's check whether it has the correct derivative:
>>
>> q = -1/2; a = 0; b = 3;
>> h[x_] = (1 + x^3)^q;
>> f[x_] = Integrate[h[x], x];
>> FullSimplify[f'[x] == h[x], a < x < b]
>>
>> Sqrt[-(1 + x) (-1 + (-1)^(1/3) x)] == (
>>  2 (-1)^(1/12) Sqrt[-(-1)^(1/6) ((-1)^(2/3) + x) (1 + x^3)])/(
>>  Sqrt[1 - I/Sqrt[3] + (-1 - I/Sqrt[3]) x] Sqrt[
>>   3 + I Sqrt[3] + I (3 I + Sqrt[3]) x])
>>
>> As you see, FullSimplify doesn't think Integrate got a correct
>> result. Or
>> at least, it couldn't verify it.
>>
>> Here's an attempt to provide FullSimplify some adult supervision:
>>
>>  simple= FullSimplify[ #, a<x<b]&;
>>  test= f'[x]== h[x]//simple
>>
>> Sqrt[(-(1 + x))*(-1 + (-1)^(1/3)*x)] ==
>> (2*(-1)^(1/12)*Sqrt[(-(-1)^(1/6))*((-1)^(2/3) + x)*(1 + x^3)])/
>> (Sqrt[1 -
>> I/Sqrt[3] + (-1 - I/Sqrt[3])*x]*Sqrt[3 + I*Sqrt[3] + I*(3*I +
>> Sqrt[3])*x])
>>
>>  test2 = simple[test /. {(-1)^(1/3) -> -1, (-1)^(2/3) ->
>> ComplexExpand[Exp[I*(Pi/3)]], (-1)^(1/6) -> ComplexExpand[Exp[I*(Pi/
>> 6)]],
>> (-1)^(1/12) -> ComplexExpand[Exp[I*(Pi/12)]]}]
>>
>> 1 + x == (((1/2 + I/2)*(3 - I*Sqrt[3])*Sqrt[(-(2*I + (I +
>> Sqrt[3])*x))*(1
>> + x^3)])/Sqrt[3 - I*Sqrt[3] + (-3 - I*Sqrt[3])*x])*Sqrt[3 + I*Sqrt[3]=

>> + I*(3*I + Sqrt[3])*x]
>>
>>  test3 = test2 /. (z_)^(r_) :> ComplexExpand[z]^r
>>
>> 1 + x == (((1/2 + I/2)*(3 - I*Sqrt[3])*Sqrt[(-Sqrt[3])*x - Sqrt[3=
]*x^4
>> + I*(-2 - x - 2*x^3 - x^4)])/Sqrt[3 - 3*x + I*(-Sqrt[3] -
>> Sqrt[3]*x)])*Sqrt[3 - 3*x + I*(Sqrt[3] + Sqrt[3]*x)]
>>
>>  simple[(#1^2 & ) /@ test3]
>>
>> 2*I + (3*I + Sqrt[3])*x == 0
>>
>> I don't think Integrate has the right answer.
>>
>> Bobby
>>
>> On Mon, 26 May 2008 21:36:31 -0500, Armen Kocharyan
>> <armen.kocharyan at gmail.com> wrote:
>>
>>> Dear Bob,
>>>
>>> Sorry for the asterisks, it wasn't intentional. I just cut and paste=

>>> from my
>>> notebook.
>>>
>>> I understand. But why would Mathematica give different results for
>>> the
>>> following?
>>>
>>> Integrate[h[t], {t, 0, x}] and Integrate[h[x], x]
>>>
>>>
>>> Regards,
>>> Armen
>>>
>>> 2008/5/27 DrMajorBob <drmajorbob at att.net>:
>>>
>>>> The fundamental theorem of calculus frequently does not apply
>>>> when, as
>>>> in
>>>> your example, Integrate is free to return a Complex-valued function=


  • Prev by Date: Re: Soundnote, musical instruments playing at arbitrary pitch
  • Next by Date: Re: Re: Re: Integrate vs NIntegrate
  • Previous by thread: Re: Re: Integrate vs NIntegrate
  • Next by thread: Re: Re: Re: Integrate vs NIntegrate