MathGroup Archive 2010

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

Search the Archive

Re: How to disable Integrate[] ?

slawek wrote:
> U=BFytkownik "Christoph Lhotka" <christoph.lhotka at> napisa=B3w
> wiadomo=B6ci grup dyskusyjnych:hrbaas$hon$1 at
>> Simplifiy[...., ExcludedForms->{Integrate[__,_]}]
> Nice, but it doesn't work, check yourself:
> In[1]:= int1 = HoldForm[Integrate[x + x, {x, a + a, b + b}]];
> In[2]:= int2 = HoldForm[Integrate[1/(1 + Sin[x]^(1/3)), {x, a + a, b + b}]];
> In[3]:= Simplify[int1 // ReleaseHold,  ExcludedForms -> {Integrate[_, _ ]}]
> In[4]:= Simplify[int2 // ReleaseHold,  ExcludedForms -> {Integrate[_, _ ]}]
>> IntegrateH[expr,vars]
> Yes, it is possible replace Integrate by an dummyIntegrate or similar
> placeholder. It should be even possible to define some simple rules for
> dummyInterate,
> i.e. dummyIntegrate[a_,lst_]+ dummyIntegrate[b_,lst_] ->
> dummyIntegrate[a+b,lst] and so on. But, I think that it is not the most
> finesse way. I think that some global switch, like the iteration limit and
> the recursion limit should work better. Unfortunatelly these limits don't
> force Mathematica give up simplification but abort calculation with an
> "Abort" msg.
> slawek

How about using some other name - say, Integral - (yes, I know I should 
not use uppercase names!) that invokes Integrate only if a switch is 
set, otherwise returning unevaluated:

In[505]:= SetAttributes[Integral, HoldAll];
Integral[args___] := Integrate[args] /; DoIntegrals

In[507]:= Integral[Sin[x], x]

Out[507]= Integral[Sin[x], x]

In[508]:= DoIntegrals = True;

In[509]:= Integral[Sin[x], x]

Out[509]= -Cos[x]

BTW, it is almost never a good idea to modify the built-in Mathematica 

David Bailey

  • Prev by Date: Re: Why Return[] does not work?
  • Next by Date: Re: Sphere formula
  • Previous by thread: Re: Why Return[] does not work?
  • Next by thread: Re: How to disable Integrate[] ?