Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: How to disable Integrate[] ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109501] Re: How to disable Integrate[] ?
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Sat, 1 May 2010 06:51:14 -0400 (EDT)
  • References: <hrbaas$hon$1@smc.vnet.net> <hre937$6o$1@smc.vnet.net>

slawek wrote:
> U=BFytkownik "Christoph Lhotka" <christoph.lhotka at univie.ac.at> napisa=B3w
> wiadomo=B6ci grup dyskusyjnych:hrbaas$hon$1 at smc.vnet.net...
>> 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 
operations.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • 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[] ?