Re: Integrate[ ] returns If[ ] function; how to say it's True?
- To: mathgroup at smc.vnet.net
- Subject: [mg9395] Re: [mg9359] Integrate[ ] returns If[ ] function; how to say it's True?
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Sun, 2 Nov 1997 01:02:25 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Sat, 1 Nov 1997 03:33:46 -0500
siegman at ee.stanford.edu (AES)
T[mg9359] Integrate[ ] returns If[ ] function; how to say it's True?
> 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?
Let's take
In[1]:= int =Integrate[x^n,{x,0,1}]
Out[1]=
1 n
If[Re[n] > -1, -----, Integrate[x , {x, 0, 1}]]
1 + n
We can easily get the 1/(1+n)
In[2]:= int[[2]]
Out[2]=
1
-----
1 + n
But int[[3]] immediately evaluates to Out[1], so we may want to hold it:
In[3]:= Extract[int,3, Hold]
Out[3]=
n
Hold[Integrate[x , {x, 0, 1}]]
Other holding functions might be used, for example Unevaluated.
Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk/training.html voice:+44 (0)116 2714198
fax: +44 (0)116 2718642
Leicester, UK