Re: Extending Integrate[]

*To*: mathgroup at smc.vnet.net*Subject*: [mg87789] Re: Extending Integrate[]*From*: dh <dh at metrohm.ch>*Date*: Wed, 16 Apr 2008 22:34:22 -0400 (EDT)*References*: <fu4lnj$si9$1@smc.vnet.net>

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. hope this helps, Daniel Szabolcs Horvát wrote: > According to the documentation it is possible to extend Integrate[] with > new rules: > > http://reference.wolfram.com/mathematica/tutorial/IntegralsThatCanAndCannotBeDone.html > > The specific example that is given is: > > Unprotect[Integrate] > > Integrate[Sin[Sin[a_. + b_. x_]], x_] := Jones[a, x]/b > > Now Integrate[Sin[Sin[3x]], x] will return Jones[0, x]/3 > > But if I try an integrand that is just slightly more complicated, > Mathematica returns it unevaluated: > > In[21]:= Integrate[a + Sin[Sin[x]], x] > Out[21]= Integrate[a + Sin[Sin[x]], x] > > My question is: Is it really possible to extend Integrate in an > intelligent way? The above example seems to be just simple pattern > matching. It would work with any function, not just Integrate[]. There > is nothing new or surprising about it. > > But is it *really* possible to extend Integrate[] with new definitions > in a way that Mathematica will use these rules when calculating more > complicated Integrals? > > If (as I suspect) it is not possible to do this, then the documentation > is a bit misleading ... >