Re: [Mathematica 6] Integrate strange result
- To: mathgroup at smc.vnet.net
- Subject: [mg78432] Re: [Mathematica 6] Integrate strange result
- From: Bhuvanesh <lalu_bhatt at yahoo.com>
- Date: Sun, 1 Jul 2007 07:47:53 -0400 (EDT)
> notice in the above, it says for k<-1 there is NO answer That's not what the If structure is saying. It's giving a result for k>=-1 and the third argument of the If statement is held (unevaluated). For a given result If[cond, res, int], if you want the result when the condition cond is satisfied, you can extract that from the If (by using a replacement rule or by using Refine); if you want the other part, you have to explicitly evaluate the held integral. In[1]:= f = (1 + k*Sin[a]^2)^(1/2); In[2]:= Assuming[Element[k, Reals], Integrate[f, {a, 0, 2*Pi}]] //InputForm Out[2]//InputForm= If[k >= -1, 4*EllipticE[-k], Integrate[Sqrt[1 + k*Sin[a]^2], {a, 0, 2*Pi}, Assumptions -> k < -1]] In[3]:= PiecewiseExpand[%] //InputForm Out[3]//InputForm= Piecewise[{{4*EllipticE[-k], k >= -1}}, 0] Bhuvanesh, Wolfram Research
- Follow-Ups:
- Re: Re: [Mathematica 6] Integrate strange result
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: [Mathematica 6] Integrate strange result