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: question 1 (Integrate and simplification)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75965] Re: question 1 (Integrate and simplification)
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Mon, 14 May 2007 03:37:51 -0400 (EDT)
  • References: <200705110924.FAA05900@smc.vnet.net>

>Sorry, that last remark just not true. Cleary Integrate uses Simplify
>before integration but does not Simplify its output (obviously to
>save time) so including Simplify does make a difference...

Hmmm!

I am a bit confused!
Until now I think Integrate use Simplify not in order
to simplify the input but also to simplify its output.
In fact there was a recent post about a complicated
integral with log where two successive executions
succeded in different outputs! The reason was that
Integrate use even (very little!) FullSimplify to its output.

See here...

http://groups.google.gr/group/comp.soft-sys.math.mathematica/browse_thread/=
thread/51a2b235eebfd92d/004350a53d3f071e?lnk=gst&q=a+log+integral&rnum=
=3&hl=el#004350a53d3f071e

To this end, add the following rules

In[24]:=
Unprotect[FullSimplify];
FullSimplify[a___] := Null /; (Print[InputForm[fullsimplify[a]]];
False)
Unprotect[Simplify];
Simplify[a___] := Null /; (Print[InputForm[simplify[a]]]; False)

Then

In[29]:=
Integrate[1/Sqrt[Sin[x]], {x, 0, Pi/2}]

>From In[29]:=
simplify[1/Sqrt[Sin[x]], TimeConstraint -> 1/2, Assumptions -> True]

>From In[29]:=
simplify[True, Assumptions -> True]

>From In[29]:=
simplify[1/Sqrt[Sin[x]], Assumptions -> 0 < x < Pi/2]

>From In[29]:=
simplify[Re[Sin[x]], Assumptions -> Im[x] == 0 && Re[x] >= 0 && Re[x]
<= Pi/2]

>From In[29]:=
simplify[Im[Sin[x]], Assumptions -> Im[x] == 0 && Re[x] >= 0 && Re[x]
<= Pi/2]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[{1, 0, 0, 0, 1/12}, True]

>From In[29]:=
simplify[Infinity, Assumptions -> x > 0 && x < 1/12, TimeConstraint ->
1]

>From In[29]:=
simplify[1/(x*(1/Sqrt[x] + x^(3/2)/12)), Assumptions -> True]

>From In[29]:=
simplify[Infinity, Assumptions -> x > 0 && x < 1/12, TimeConstraint ->
1]

>From In[29]:=
simplify[{1, 0, 1/4}, True]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[1/Sqrt[Sin[x]], TimeConstraint -> 1/2, Assumptions -> True]

>From In[29]:=
simplify[Re[Sin[x]], Assumptions -> Im[x] == 0 && Re[x] >= 0 && Re[x]
<= Pi/2]

>From In[29]:=
simplify[Im[Sin[x]], Assumptions -> Im[x] == 0 && Re[x] >= 0 && Re[x]
<= Pi/2]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[-2*EllipticF[(Pi/2 - x)/2, 2], Assumptions -> True]

>From In[29]:=
simplify[{}, Assumptions -> True]

>From In[29]:=
simplify[1, Assumptions -> True]

>From In[29]:=
simplify[0, Assumptions -> True]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[True, Assumptions -> True]

>From In[29]:=
simplify[Pi/2, Assumptions -> True]

>From In[29]:=
simplify[-2*EllipticF[(Pi/2 - x)/2, 2], Assumptions -> True]

>From In[29]:=
simplify[0, Assumptions -> True]

>From In[29]:=
simplify[-2*EllipticF[(Pi/2 - x)/2, 2], Assumptions -> True]

>From In[29]:=
simplify[2*EllipticF[Pi/4, 2], Assumptions -> True]

>From In[29]:=
simplify[2*EllipticF[Pi/4, 2], Assumptions -> True]

>From In[29]:=
simplify[True, Assumptions -> True]

>From In[29]:=
simplify[2*EllipticF[Pi/4, 2], Assumptions -> True]

>From In[29]:=
fullsimplify[2*EllipticF[Pi/4, 2], True]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[False, Assumptions -> True]

>From In[29]:=
simplify[2*EllipticF[Pi/4, 2], TimeConstraint -> 1/2, Assumptions ->
True]

>From In[29]:=
fullsimplify[2*EllipticF[Pi/4, 2], TimeConstraint -> 1/2, Assumptions -
> True]

Out[29]=
\!\(2\ EllipticF[=F0\/4, 2]\)

It is clear the attempt to (Full)Simplify the output BUT in very
little timing!

Dimitris



=CF/=C7 Andrzej Kozlowski =DD=E3=F1=E1=F8=E5:
> On 12 May 2007, at 10:37, Andrzej Kozlowski wrote:
>
> >
> > On 12 May 2007, at 10:23, Andrzej Kozlowski wrote:
> >
> >> On 11 May 2007, at 18:24, dimitris wrote:
> >>
> >>> I have
> >>>
> >>> In[5]:=
> >>> f = (o - 8)^4 - (e + 4)^8
> >>>
> >>> Out[5]=
> >>> -(4 + e)^8 + (-8 + o)^4
> >>>
> >>> In[6]:=
> >>> ff = Expand[f]
> >>>
> >>> Out[6]=
> >>> -61440 - 131072*e - 114688*e^2 - 57344*e^3 - 17920*e^4 - 3584*e^5 -
> >>> 448*e^6 - 32*e^7 - e^8 - 2048*o + 384*o^2 - 32*o^3 + o^4
> >>>
> >>> Is it possible to simplify ff to f again?
> >>>
> >>> Thanks!
> >>>
> >>>
> >>
> >> I don't think Mathematica can do it automatically, because the
> >> most obvious way of carrying out this simplification relies on
> >> transformations of the kind that  that Simplify or FullSimplify
> >> never use (such as adding and simultaneously subtracting some
> >> number, then rearranging the whole expression and factoring parts
> >> of it). These kind of transformations could be implemented but
> >> they would work in only a few cases, and would considerably
> >> increase the time complexity of simplifying. Here is an example of
> >> another  transformation that will work in this and some similar
> >> cases:
> >>
> >> transf[f_, {e_, o_}] :=
> >>  With[{a = Integrate[D[f, e], e], b = Integrate[D[f, o], o]},
> >>   Simplify[a] + Simplify[b] + Simplify[(f - (a + b))]]
> >>
> >> (one can easily implment a version with more than two variables).
> >>
> >> This works in your case:
> >>
> >> ff = Expand[(o - 8)^4 - (e + 4)^8];
> >>
> >> transf[ff, {e, o}]
> >>  (o - 8)^4 - (e + 4)^8
> >>
> >> and in quite many cases like yours :
> >>
> >> gg = Expand[(a + 3)^5 + (x - 7)^6];
> >>
> >> transf[gg, {a, x}]
> >>  (x - 7)^6 + (a + 3)^5
> >>
> >> but not in all
> >>
> >>  hh = Expand[(x - 5)^4 + (y - 3)^3];
> >>
> >>  transf[hh, {x, y}]
> >>  (x - 5)^4 + y*((y - 9)*y + 27) - 27
> >>
> >> Even this, however,  is better than the answer FullSimplify gives:
> >>
> >> FullSimplify[hh]
> >>
> >> (x - 10)*x*((x - 10)*x + 50) + y*((y - 9)*y +  27) + 598
> >>
> >> Unfortunately transf also has very high complexity (it uses
> >> Integrate)  and is unlikely to be useful in cases other than sums
> >> of polynomials in different variables (without "cross terms") so I
> >> doubt that it would be worth implementing some version of it in
> >> FullSimplify.
> >>
> >>
> >> Andrzej Kozlowski
> >>
> >
> > I forgot that Integrate already maks use of Simplify, so (probably)
> > the folowing version of transf will work just as well and faster:
> >
> > transf[f_, {e_, o_}] :=
> >  With[{a = Integrate[D[f, e], e], b = Integrate[D[f, o], o]},
> >   a + b + Simplify[(f - (a + b))]]
> >
> > Andrzej Kozlowski
>
> Sorry, that last remark just not true. Cleary Integrate uses Simplify
> before integration but does not Simplify its output (obviously to
> save time) so including Simplify does make a difference. Note also
> the following works much better, but is,, of course, much more tiem
> consuming:
>
>
> transf[f_, {e_, o_}] :=
>   With[{a = Integrate[D[f, e], e], b = Integrate[D[f, o], o]},
>    FullSimplify[Simplify[a] + Simplify[b] + Simplify[(f - (a + b))],
>     ExcludedForms -> {(x + c_)^n_, (y + d_)^m_}]]
>
>
> This will deal with many cases that would not work before:
>
> hh = Expand[(x - 5)^4 + (y - 3)^3];
>
>   transf[hh, {x, y}]
>   (x - 5)^4 + (y - 3)^3
>
>   p = Expand[(x - 2)^4 + (y + 1)^2];
>
>   transf[p, {x, y}]
>   (x - 2)^4 + (y + 1)^2
>
> but at least one power has to be higher than 3. This this will work
>
> q = Expand[(x - 2)^4 +  (y + 1)^3];
>   transf[q, {x, y}]
>   (x - 2)^4 + (y + 1)^3
>
> but this will not (all powers are <=3)
>
> q = Expand[(x - 2)^3 + (y + 1)^3];
>
> transf[q, {x, y}]
>
> x*((x - 6)*x + 12) + y*(y*(y + 3) + 3) - 7
>
> Andrzej Kozlowski



  • References:
  • Prev by Date: Re: Re: v.6 RevolutionPlot3D
  • Next by Date: Re: Picking out pieces of a list
  • Previous by thread: Re: Re: question 1
  • Next by thread: Re: question 1