PiecewiseExpand and conditional results from Integrate

PiecewiseExpand and conditional results from Integrate

Post by dimitri » Fri, 06 Jul 2007 19:20:19


The following are based on a recent thread.
I found it good to collect the results.
(Version 5.2 is used)
-------------------------------------------------------------

When Integrate returns conditional results (that is If[...]
structures)
it does not mean necessary that for the other values of the
parameter(s)
there is divergence or no closed form solution.
Below there is a nice example

In[10]:=
Integrate[E^(-x^2 - x*y)/Sqrt[x], {x, 0, Infinity}]

Out[10]=
If[Re[y] < 0, (E^(y^2/8)*Pi*Sqrt[-y]*(BesselI[-(1/4), y^2/8] +
BesselI[1/4, y^2/8]))/(2*Sqrt[2]),
Integrate[1/(E^(x*(x + y))*Sqrt[x]), {x, 0, Infinity}, Assumptions -

At first someone might think that for Re[y]>0 there is no convergence
or closed form solution. However it is just that the integrator found
a result
which is valid for Re[y]<0. Nothing more, nothing less.
Specifying assumptions shows the situation

In[11]:=
(Integrate[E^(-x^2 - x*y)/Sqrt[x], {x, 0, Infinity}, Assumptions ->
#1[Re[y], 0]] & ) /@ {Greater, Less}

Out[11]=
{(1/2)*E^(y^2/8)*Sqrt[y]*BesselK[1/4, y^2/8], (E^(y^2/8)*Pi*Sqrt[-
y]*(BesselI[-(1/4), y^2/8] + BesselI[1/4, y^2/8]))/
(2*Sqrt[2])}

A nice application of PiecewiseExpand is given below

In[11]:=
Integrate[E^(-x^2 - x*y)/Sqrt[x], {x, 0, Infinity}]
PiecewiseExpand[%]

Out[11]=
If[Re[y] < 0, (E^(y^2/8)*Pi*Sqrt[-y]*(BesselI[-(1/4), y^2/8] +
BesselI[1/4, y^2/8]))/(2*Sqrt[2]),
Integrate[1/(E^(x*(x + y))*Sqrt[x]), {x, 0, Infinity}, Assumptions -
Out[12]=
Piecewise[{{(E^(y^2/8)*Pi*Sqrt[-y]*(BesselI[-(1/4), y^2/8] +
BesselI[1/4, y^2/8]))/(2*Sqrt[2]), Re[y] <= 0}},
(1/2)*E^(y^2/8)*Sqrt[y]*BesselK[1/4, y^2/8]]

As another example consider

In[17]:=
Integrate[(1 + k*Sin[a]^2)^(1/2), {a, 0, 2*Pi}, Assumptions -> k
Reals]
PiecewiseExpand[%]

Out[17]=
If[k >= -1, 4*EllipticE[-k], Integrate[Sqrt[1 + k*Sin[a]^2], {a, 0,
2*Pi}, Assumptions -> k < -1]]
Out[18]=
4*EllipticE[-k]

which shows that although the If structure would indicate that there
is closed form
solution valid only for k>=-1, application of PiecewiseExpand shows
that the closed
form result is valid for all real k.

Dimitris
 
 
 

1. Conditional Statement with ANDs

2. Conditional ANDS!

Hi all,

I have the following query:

The two and clauses in the subquery need to be conditional.(if possible)
Only included in the select if @current_hazards = True Or @areas IS NOT NULL

If @current_hazards = False AND @areas IS NULL then both add statements are
to be ignored???

If this is possible i would appreciate any insight on how to achieve this...

Cheers,
Adam

SELECT
oce_rep_areas.oce_rep_area_id, oce_rep_areas.name
FROM
oce_rep_areas
WHERE
oce_rep_areas.oce_rep_area_id IN (
SELECT
parent
FROM
oce_rep_areas
INNER JOIN
oce_rep_items
ON
oce_rep_areas.oce_rep_area_id = oce_rep_items.oce_rep_area_id
WHERE
oce_rep_items.oce_report_id = @oceid
AND ///to bo conditional : ie add only if @hazards = True
oce_rep_items.current_hazard = True
AND //to be conditional : ie only include when @areas is not null
oce_rep_areas.oce_rep_area_id IN(@areas))

3. Proper way to write a conditional statement with ands

4. a suprising result from Integrate (Null appeared in the result!)

5. Using query results within Conditional Statement...sequenced conditional queries

6. Conditional Sum Argument results do not equal cell results Exc

7. Conditional Sum Argument results do not equal cell results Excel

8. PiecewiseExpand bug?

9. PiecewiseExpand problem.

10. Poor choice in PiecewiseExpand ?

11. AD integrated DNS with conditional forwarding on windows 2000 and 2003

12. If Integrate returns no result, can we conclude that no

13. Integrate (a curious result)

14. Strange results of Integrate

15. Integrating Search result from external sources