Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: more in Assumptions (comparison)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75020] Re: more in Assumptions (comparison)
  • From: "dimitris" <dimmechan at yahoo.com>
  • Date: Sat, 14 Apr 2007 01:10:34 -0400 (EDT)
  • References: <evn7ro$ns$1@smc.vnet.net>

As comparison of what I do consider a good performance of Mathematica
(in contrast with its performance regards Assumptions in the first
post) let me consider the integral
of 1/(x^2 + 2*a*x + b) in [0,infinity), where the a,b, are both real.

First in the limits of integration we have

In[108]:=
1/(x^2 + 2*a*x + b) + O[x, 0]^4
1/(x^2 + 2*a*x + b) + O[x, Infinity]^4

Out[108]=
SeriesData[x, 0, {b^(-1), (-2*a)/b^2, (4*a^2)/b^3 - b^(-2), (-8*a^3)/
b^4 + (4*a)/b^3}, 0, 4, 1]
Out[109]=
SeriesData[x, Infinity, {1, -2*a}, 2, 4, 1]

So b!=0.

Let examine the denominator in the integration range

In[167]:=
Reduce[x^2 + 2*a*x + b == 0 && x >= 0 && a^2 < b, x, Reals]
Reduce[x^2 + 2*a*x + b == 0 && x >= 0 && a^2 > b && a > 0 && b > 0, x,
Reals]
Reduce[x^2 + 2*a*x + b == 0 && x >= 0 && a^2 > b && a >= 0 && b < 0,
x, Reals]
Reduce[x^2 + 2*a*x + b == 0 && x >= 0 && a^2 > b && a < 0 && b > 0, x,
Reals]
Reduce[x^2 + 2*a*x + b == 0 && x >= 0 && a^2 > b && a <= 0 && b < 0,
x, Reals]
Reduce[x^2 + 2*a*x + b == 0 && x >= 0 && b == a^2 && a > 0, x, Re=
als]
Reduce[x^2 + 2*a*x + b == 0 && x >= 0 && b == a^2 && a < 0, x, Re=
als]

Out[167]=
False
Out[168]=
False
Out[169]=
a >= 0 && b < 0 && x == -a + Sqrt[a^2 - b]
Out[170]=
a < 0 && 0 < b < a^2 && (x == -a - Sqrt[a^2 - b] || x == -a + Sqrt[=
a^2
- b])
Out[171]=
a <= 0 && b < 0 && x == -a + Sqrt[a^2 - b]
Out[172]=
False
Out[173]=
a < 0 && b == a^2 && x == -a - Sqrt[a^2 - b]

So, for real values of the parameters, the integral converges if:

1) a^2<b. In this case we have

In[273]:=
Dt[x]/(x^2 + 2*a*x + b) /. x^2 + (a_)*x + (c_) -> (x + a/2)^2 + c -
a^2/4(*completing the square*)
Factor[% /. b - a^2 -> c^2 /. x -> u - a /. Dt[a] -> 0 /. u -> c*t /.
Dt[c] -> 0]
(Simplify[#1, 0 < u < Pi/2] & )[% /. t -> Tan[v]]
Integrate[% /. Dt[v] -> 1, v]
Factor[(% /. v -> Pi/2) - (% /. v -> ArcTan[a/c]) /. c -> Sqrt[b -
a^2]]

Out[273]=
Dt[x]/(-a^2 + b + (a + x)^2)
Out[274]=
Dt[t]/(c*(1 + t^2))
Out[275]=
Dt[v]/c
Out[276]=
v/c
Out[277]=
(Pi - 2*ArcTan[a/Sqrt[-a^2 + b]])/(2*Sqrt[-a^2 + b])

and the last result is what is returned by Mathematica for this range
of the parameters.

In[279]:=
Integrate[1/(x^2 + 2*a*x + b), {x, 0, Infinity}, Assumptions -> a^2 <
b]

Out[279]=
(Pi - 2*ArcTan[a/Sqrt[-a^2 + b]])/(2*Sqrt[-a^2 + b])

2) a>0&&b>0&&a^2>b. In this case we have

In[335]:=
Solve[LogicalExpand[1 == Numerator[Together[Tr[(a[#1]/(x - j[#1]) & ) /
@ {1, 2}]]] + O[x]^3], Array[a, 2]]
Tr[(a[#1]/(x - j[#1]) & ) /@ {1, 2}] /. %[[1]]
(Integrate[#1, x] & ) /@ %
% /. MapThread[Rule, {Array[j, 2], x /. Solve[x^2 + 2*a*x + b == 0,
x]}]
Simplify[Limit[%, x -> Infinity] - Limit[%, x -> 0]] /. (a_.)*Log[b_]
+ (c_.)*Log[d_] :> Log[b^a*d^c]
% /. (a_)*Log[(b_)/(c_)] :> a*Log[Expand[b*b]/Expand[c*b]]

Out[335]=
{{a[1] -> -(1/(-j[1] + j[2])), a[2] -> -(1/(j[1] - j[2]))}}
Out[336]=
-(1/((x - j[2])*(j[1] - j[2]))) - 1/((x - j[1])*(-j[1] + j[2]))
Out[337]=
Log[x - j[1]]/(j[1] - j[2]) + Log[x - j[2]]/(-j[1] + j[2])
Out[338]=
Log[a - Sqrt[a^2 - b] + x]/(2*Sqrt[a^2 - b]) - Log[a + Sqrt[a^2 - b] +
x]/(2*Sqrt[a^2 - b])
Out[339]=
Log[(a + Sqrt[a^2 - b])/(a - Sqrt[a^2 - b])]/(2*Sqrt[a^2 - b])
Out[340]=
Log[(2*a^2 + 2*a*Sqrt[a^2 - b] - b)/b]/(2*Sqrt[a^2 - b])

In this case we have also coincidence.

In[342]:=
Integrate[1/(x^2 + 2*a*x + b), {x, 0, Infinity}, Assumptions -> a > 0
&& b > 0 && a^2 > b] /.
  (a_)*Log[(b_)/(c_)] :> a*Log[Expand[b]/c]

Out[342]=
Log[(2*a^2 + 2*a*Sqrt[a^2 - b] - b)/b]/(2*Sqrt[a^2 - b])

3) a>0&&b==a^2. Now we have

In[346]:=
Factor[1/(x^2 + 2*a*x + b) /. b -> a^2]
Integrate[%, x]
Limit[%, x -> Infinity] - % /. x -> 0

Out[346]=
1/(a + x)^2
Out[347]=
-(1/(a + x))
Out[348]=
1/a

Again

In[350]:=
Assuming[b == a^2 && a > 0, Integrate[1/(x^2 + 2*a*x + b), {x, 0,
Infinity}]]

Out[350]=
1/a

However, note that

In[355]:=
Assuming[b == a^2 && Element[a, Reals], Integrate[1/(x^2 + 2*a*x + b),
{x, 0, Infinity}]]

Out[355]=
If[a >= 0, 1/a, Integrate[1/(b + 2*a*x + x^2), {x, 0, Infinity},
Assumptions -> a < 0]]

That is MATHEMATICA does not understand that the integral diverges for
a=0.

Note also that

In[359]:=
Limit[{Log[(2*a^2 + 2*a*Sqrt[a^2 - b] - b)/b]/(2*Sqrt[a^2 - b]), (Pi -
2*ArcTan[a/Sqrt[-a^2 + b]])/(2*Sqrt[-a^2 + b])},
  b -> a^2, Assumptions -> a > 0]

Out[359]=
{1/a, 1/a}

Dimitris






=CF/=C7 dimitris =DD=E3=F1=E1=F8=E5:
> On the same vein with some recent posts of mine, let me consider the
> integral of f[x,a,c] in the range [0,infinity), where
>
> In[93]:=
> f[x_, a_, c_] := 1/(x^4 + 2*a*x^2 + 1 + c)
>
> Let investegate ranges of a,c in which the integral converges.
> (I am interested in real values.)
>
> In the integration limits we have
>
> In[95]:=
> f[x, a, c] + O[x]^6
> f[x, a, c] + O[x, Infinity]^6
>
> Out[95]=
> SeriesData[x, 0, {(1 + c)^(-1), 0, (-2*a)/(1 + c)^2, 0, (4*a^2)/(1 +
> c)^3 - (1 + c)^(-2)}, 0, 6, 1]
> Out[96]=
> SeriesData[x, Infinity, {1}, 4, 6, 1]
>
> So in Infinity there is not problem, whereas in zero, it must be c !=
> -1.
>
> With this in mind we examine the denominator of f[x,a,c] for possible
> poles
> in the integration range.
>
> In[100]:=
> ToRadicals[Reduce[Denominator[f[x, a, c]] == 0 && c < -1 && x > 0, x,
> Reals]]
> ToRadicals[Reduce[Denominator[f[x, a, c]] == 0 && c > -1 && x > 0, x,
> Reals]]
>
> Out[100]=
> c < -1 && x == -Sqrt[-a - Sqrt[-1 + a^2 - c]]
> Out[101]=
> a < 0 && ((-1 < c < -1 + a^2 && (x == Sqrt[-a + Sqrt[-1 + a^2 - c]] ||
> x == -Sqrt[-a + Sqrt[-1 + a^2 - c]])) ||
>    (c == -1 + a^2 && x == Sqrt[-a + Sqrt[-1 + a^2 - c]]))
>
> In[102]:=
> ToRadicals[Reduce[Denominator[f[x, a, c]] == 0 && c > -1 && x > 0 && a
> > 0, x, Reals]]
> ToRadicals[Reduce[Denominator[f[x, a, c]] == 0 && c > -1 && x > 0 && a
> < 0, x, Reals]]
>
> Out[102]=
> False
> Out[103]=
> a < 0 && ((-1 < c < -1 + a^2 && (x == Sqrt[-a + Sqrt[-1 + a^2 - c]] ||
> x == -Sqrt[-a + Sqrt[-1 + a^2 - c]])) ||
>    (c == -1 + a^2 && x == Sqrt[-a + Sqrt[-1 + a^2 - c]]))
>
> In[104]:=
> ToRadicals[Reduce[Denominator[f[x, a, c]] == 0 && c > -1 + a^2 && x >
> 0 && a < 0, x, Reals]]
>
> Out[104]=
> False
>
> I think we have enough evidence that the integral converges for
> {a<0&&c > -1 + a^2 and a>0&&c>-1}.
>
> However Mathematica for each one of the following commands
> return alsmost the same unecessary complicated If[...] structure
> (*outputs are ommited*)
>
> In[124]:=
> Integrate[f[x, a, c], {x, 0, Infinity}, Assumptions -> Element[{a,
> c} , Reals]]
>
> In[125]:=
> Integrate[f[x, a, c], {x, 0, Infinity}, Assumptions -> a < 0]
>
> In[126]:=
> Integrate[f[x, a, c], {x, 0, Infinity}, Assumptions -> a > 0 && c >
> -1]
>
> In[127]:=
> Integrate[f[x, a, c], {x, 0, Infinity}, Assumptions ->a < 0 && c > -1
> + a^2]
>
> Let see some examples with specific values for {a,c}
>
> In[132]:=
> Integrate[f[x, 1, -9/10], {x, 0, Infinity}](*a>0&&c>-1*)
> {N[%], NIntegrate[f[x, 1, -9/10], {x, 0, Infinity}]}
> Integrate[f[x, -2, 3 + 1/10], {x, 0, Infinity}](*a<0&&c>-1+a^2*)
> {N[%], NIntegrate[f[x, -2, 3 + 1/10], {x, 0, Infinity}]}
> Integrate[f[x, 1, -1], {x, 0, Infinity}](*a>0&&c<=-1*)
> Integrate[f[x, -2, 3], {x, 0, Infinity}](*a<0&&c<=-1+a^2*)
>
> Out[132]=
> (1/6)*Sqrt[50 - 5*Sqrt[10]]*Pi
> Out[133]=
> {3.061535891296801, 3.0615358912965314}
> Out[134]=
> (5*Pi)/Sqrt[82*(-20 + Sqrt[410])]
> Out[135]=
> {3.48007,3.48007}
> Integrate::idiv: Integral of 1/(2*x^2 + x^4) does not converge on \
> {0,Infinity}.
> Out[136]=
> Integrate[1/(2*x^2 + x^4), {x, 0, Infinity}]
> Integrate::idiv: Integral of 1/(-2 + x^2)^2 does not converge on
> {0,Infinity}.
> Out[137]=
> Integrate[1/(4 - 4*x^2 + x^4), {x, 0, Infinity}]
>
> and compare them with the result of the symbolic definite integration
>
> In[145]:=
> ff = Integrate[f[x, a, c], {x, 0, Infinity}]
> FullSimplify[% /. {{a -> 1, c -> -9/10}, {a -> -2, c -> 3 + 1/10}}]
> N[%]
>
> Out[145]=
> If[Im[Sqrt[-a - Sqrt[-1 + a^2 - c]]] > 0 && Im[Sqrt[-a + Sqrt[-1 + a^2
> - c]]] > 0,
>   -((I*Pi)/(2*(Sqrt[-a - Sqrt[-1 + a^2 - c]] + Sqrt[-a + Sqrt[-1 + a^2
> - c]])*Sqrt[-a - Sqrt[-1 + a^2 - c]]*
>      Sqrt[-a + Sqrt[-1 + a^2 - c]])), Integrate[1/(1 + c + 2*a*x^2 +
> x^4), {x, 0, Infinity},
>    Assumptions -> Im[Sqrt[-a - Sqrt[-1 + a^2 - c]]] <= 0 || Im[Sqrt[-a
> + Sqrt[-1 + a^2 - c]]] <= 0]]
> Out[146]=
> {(5*Pi)/Sqrt[2*(10 + Sqrt[10])], (5*Pi)/Sqrt[82*(-20 + Sqrt[410])]}
> Out[147]=
> {3.061535891296801, 3.480066694467329}
>
>
> Indeed the symbolic definite integration result is correct, but the
> question of its
> unecessary (?) complicated form still remains.
>
> Seeing carefully the following I think there is a connection with
> Mathematica's antiderivative
>
> In[191]:=
> Integrate[f[x, a, c], x]
>
> Out[191]=
> (ArcTan[x/Sqrt[a - Sqrt[-1 + a^2 - c]]]/Sqrt[a - Sqrt[-1 + a^2 - c]] -
> ArcTan[x/Sqrt[a + Sqrt[-1 + a^2 - c]]]/
>     Sqrt[a + Sqrt[-1 + a^2 - c]])/(2*Sqrt[-1 + a^2 - c])
>
> In[190]:=
> Integrate[f[x, a, c], {x, 0, Infinity}, Assumptions -> Im[Sqrt[-a -
> Sqrt[-1 + a^2 - c]]] > 0 &&
>     Im[Sqrt[-a + Sqrt[-1 + a^2 - c]]] > 0]
>
> Out[190]=
> -((I*Pi)/(2*(Sqrt[-a - Sqrt[-1 + a^2 - c]] + Sqrt[-a + Sqrt[-1 + a^2 -
> c]])*Sqrt[-a - Sqrt[-1 + a^2 - c]]*
>     Sqrt[-a + Sqrt[-1 + a^2 - c]]))
>
> but I don't see any mathematical reason that could support this fact.
>
> Any insight will be greatly appreciate.
>
> Dimitris



  • Prev by Date: our good (?!) friend RootSum
  • Next by Date: Mathematica help
  • Previous by thread: Re: our good (?!) friend RootSum
  • Next by thread: Beryl x Mathematica