Re: Integrate[ ] returns If[ ] function; how to say it's True?
- To: mathgroup at smc.vnet.net
- Subject: [mg9406] Re: [mg9359] Integrate[ ] returns If[ ] function; how to say it's True?
- From: Daniel Lichtblau <danl>
- Date: Wed, 5 Nov 1997 01:56:26 -0500
- Sender: owner-wri-mathgroup at wolfram.com
AES wrote: > > Doing an Integrate[ ] returns an If[condition,a,b] result, with > complicated expressions for condition, a, and b. > > I want to get B as input for the next cell (automatically, not by just > copying it by hand). > > How can I get at the "parts" of the If[ ] statement, or use it in a > subsequent Input[ ] cell with condition set equal to True? To get the second element from the If[...] result, one can simply use Part to extract it: In[23]:= ee = If[a,b,c] Out[23]= If[a, b, c] In[24]:= ee[[2]] Out[24]= b One can force Integrate to avoid generation of conditions as below. Caveat: you may get a result that is only valid for conditions other than those you have in mind. In[25]:= Integrate[Cos[a*t^2], {t,-Infinity,Infinity}] Sqrt[Pi] Out[25]= If[Im[a] == 0, ---------------, 2 1/4 Sqrt[2] (a ) 2 > Integrate[Cos[a t ], {t, -Infinity, Infinity}]] In[26]:= Integrate[Cos[a*t^2], {t,-Infinity,Infinity}, GenerateConditions->False] Sqrt[Pi] Out[26]= --------------- 2 1/4 Sqrt[2] (a ) Daniel Lichtblau Wolfram Research danl at wolfram.com