Re: Need a better Integrate
- To: mathgroup at smc.vnet.net
- Subject: [mg43027] Re: [mg42976] Need a better Integrate
- From: Dr Bob <drbob at bigfoot.com>
- Date: Fri, 8 Aug 2003 00:26:42 -0400 (EDT)
- References: <200308070453.AAA24039@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
In this case, Integrate could use the following rule: integratePower[x_] = {(b_)*(a_)^(n_) :> (b*a^(n + 1))/((n + 1)* D[a, x]) /; FreeQ[D[a, x]/b, x], (a_)^(n_) :> a^(n + 1)/((n + 1) *D[a, x]) /; FreeQ[D[a, x], x]}; x*(-5 + x^2)^3 /. integratePower[x] D[%, x] (1/8)*(-5 + x^2)^4 Here's a look at simplifying the integral (plus a constant) into a power of a polynomial (if we know the integral is a polynomial): poly[k_Integer, x_] := Sum[a[i]x^i, {i, 0, k}] expr = First@Last@FactorList@(c + Integrate[x*(-5 + x^2)^3, x]); n = Length@CoefficientList[expr, x] - 1; Select[Flatten[poly[#, x]^(n/#) /. SolveAlways[poly[#, x]^(n/#) == expr, x] & /@ Divisors@n], FreeQ[#, a] &] {(-5*I + I*x^2)^4, (5*I - I*x^2)^4, (5 - x^2)^4, (-5 + x^2)^4, (-25 + 10*x^2 - x^4)^2, (25 - 10*x^2 + x^4)^2} We can select the simplest of these, but I'm not sure how often this will improve things. Bobby On Thu, 7 Aug 2003 00:53:34 -0400 (EDT), Ersek, Ted R <ErsekTR at navair.navy.mil> wrote: > A user sent me an email with an interesting problem. See below. > In[1]:= deriv = D[(-5 + x^2)^4/8, x] > Out[1]= x*(-5 + x^2)^3 > > In[2]:= int = FullSimplify[Integrate[x*(-5 + x^2)^3, x]]; > Out[2]= (x^2*(-10 + x^2)*(50 - 10*x^2 + x^4)) > > Why doesn't FullSimplify return (-5 + x^2)^4/8 which is simpler? > It doesn't because the expression Integrate returned is different from (- > 5 + x^2)^4/8 by 625/8. Of course both answers are correct because the > result of an indefinite integral includes an arbitrary constant. > However, Mathematica never includes the constant in the result Integrate > returns. In the next line we get the result we expected above. > In[3]:= Factor[int + 625/8] > Out[3]= (-5+x^2)^4/8 > > I wonder if somebody can figure out how to define a better integrate that > would do the following: > MyIntegrate[f_,x_]:= FullSimplify[Integrate[f,x]+const] > (* Through some clever algebra find the value of (const) that will give > the simplest answer. *) > > We would then get: > In[4]:= MyIntegrate[x*(-5 + x^2)^3, x] > Out[4]= (-5+x^2)^4/8 > > ------------------- > Regards, > Ted Ersek > > > -- majort at cox-internet.com Bobby R. Treat
- References:
- Need a better Integrate
- From: "Ersek, Ted R" <ErsekTR@navair.navy.mil>
- Need a better Integrate