Re: Extending Integrate[]

*To*: mathgroup at smc.vnet.net*Subject*: [mg87783] Re: Extending Integrate[]*From*: "Szabolcs HorvÃt" <szhorvat at gmail.com>*Date*: Wed, 16 Apr 2008 22:33:14 -0400 (EDT)*References*: <fu4lnj$si9$1@smc.vnet.net> <4805EADE.1010908@metrohm.ch>

On Wed, Apr 16, 2008 at 2:02 PM, dh <dh at metrohm.ch> wrote: > Hi Szabolcs, > it looks like mathematica does not automatically distribute your rule over > Plus. This comes a bit as a surprise. But you can teach it. If you > additionally give the following rule: > Integrate[a_+b_,x_]:=Integrate[a,x]+Integrate[b,x] > then your example works. Of course you also need linearity. Hi Daniel, Thanks for the reply! The problem with this approach is that it will prevent Integrate from working correctly in certain cases. Here's an example: In[1]:= expr = D[x*f[x], x] Out[1]= f[x] + x*f'[x] In[2]:= Integrate[expr, x] Out[2]= x*f[x] In[3]:= Unprotect[Integrate] Out[3]= {"Integrate"} In[4]:= Integrate[a_ + b_, x_] := Integrate[a, x] + Integrate[b, x] In[5]:= Integrate[expr, x] Out[5]= Integrate[f[x], x] + Integrate[x*f'[x], x] Jens's suggestion, i.e. Integrate[d_. + c_.*Sin[Sin[a_. + b_. x_]], x_] := c*Jones[a, x]/b + Integrate[d, x] /; FreeQ[c, x] appears to be reliable, but everything it does is still fully implemented with plain old pattern matching. So my original suspicion, that the internal algorithms of Integrate[] cannot use these new definitions in any way, seems to be true. Szabolcs