MathGroup Archive 1997

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

Search the Archive

Re: Integrate[ ] returns If[ ] function; how to say it's True?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9419] Re: [mg9359] Integrate[ ] returns If[ ] function; how to say it's True?
  • From: jpk at max.mpae.gwdg.de
  • Date: Wed, 5 Nov 1997 01:56:35 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

> Doing an Integrate[ ] returns an If[condition,a,b] result, with
> complicated expressions for condition, a, and b.
> 
Here is an example to avoid the explicit creation of a condition

In[4]:=
Integrate[
  Exp[-a*x^2],
  {x,-Infinity,Infinity},
  Assumptions->{a>0}
 ] //InputForm

Out[4]//InputForm=
Sqrt[Pi]/Sqrt[a]


> I want to get B as input for the next cell (automatically, not by just
> copying it by hand).
> 

In Your If[condition, a, b]  ?

In[7]:=
Integrate[Exp[-a*x^2],{x,-Infinity,Infinity}] //InputForm

Out[7]//InputForm=
If[Re[a] > 0, 
  Sqrt[Pi]/Sqrt[a], 
  Integrate[E^(-(a*x^2)), 
   {x, -Infinity, Infinity}]]

This will copy a (with out the condition and the unevaluated integral)

In[8]:=
%[[2]] //InputForm

Out[8]//InputForm=
Sqrt[Pi]/Sqrt[a]


Hope that helps
Jens


  • Prev by Date: Re: Argument typing in Compile [correction]
  • Next by Date: Mathematica tests on RS6000-AIX?
  • Previous by thread: Re: Integrate[ ] returns If[ ] function; how to say it's True?
  • Next by thread: Re: Integrate[ ] returns If[ ] function; how to say it's True?