# How to remove ConditionalExpression from output

I need define the function with parameter so I could directly generate a power series expansion. The problem is that in some cases ConditionalExpression appears in output. Here is my code:

S[x_, l_] :=
(C[1] +
Integrate[
E^(2 Sum[t^i/i, {i, 1, l - 1}])*(1 - t)^2*
Sum[(l - i*2)*t^i, {i, 1, l - 1}]/((t - 1)*t^l),
{t, 1, x}])*
x^(l - 1)*E^(-2 Sum[x^i/i, {i, 1, l - 1}])/(1 - x)^2;

Table[S[x, i], {i, 2, 3}] // TableForm
CoefficientList[Series[S[x, 2] , {x, 0, 3}], x]
CoefficientList[Series[S[x, 3] , {x, 0, 3}], x]
CoefficientList[Series[S[x, 3][[1]] , {x, 0, 3}], x]

• Why not make up a rule (if you are sure of the Trueness of your conditional) rule = ConditionalExpression[a_, b__] -> a and apply it to the output? i.e. CoefficientList[Series[S[x, 3], {x, 0, 3}], x] /. rule – gpap Nov 11 '13 at 10:14

You can use GenerateConditions->False to eliminate conditions (assuming they do not affect your planned use):

S[x_, l_] := (C[1] +
Integrate[
E^(2 Sum[t^i/i, {i, 1, l - 1}]) (1 - t)^2*
Sum[(l - i*2) t^i, {i, 1, l - 1}]/((t - 1) t^l), {t, 1, x},
GenerateConditions -> False]) x^(l - 1)*
E^(-2 Sum[x^i/i, {i, 1, l - 1}])/(1 - x)^2;
Table[S[x, i], {i, 2, 3}] // TableForm
CoefficientList[Series[S[x, 2], {x, 0, 3}], x]
CoefficientList[Series[S[x, 3], {x, 0, 3}], x]
CoefficientList[Series[S[x, 3][[1]], {x, 0, 3}], x]

• I would not recommend using GenerateConditions -> False as there are many cases where adding this option results in Mma either not being able to solve the integral, or returning a different answer than it otherwise would do. In my experience, a better approach is to let it do its thing, and then remove the ConditionalExpression – wolfies Apr 6 '17 at 15:48

A more general way, which can be used for other functions like Solve, is to use Normal.

Integrate[1/x^s, {x, 1, Infinity}]

(* ConditionalExpression[1/(-1 + s), Re[s] > 1] *)

Normal[%, ConditionalExpression]

(* 1/(-1 + s) *)


## Edit

It looks like as of version 10, one can just use the one argument Normal:

Integrate[1/x^s, {x, 1, Infinity}]

(* ConditionalExpression[1/(-1 + s), Re[s] > 1] *)

Normal[%]

(* 1/(-1 + s) *)

• Just as a note for prefix form: Normal@f'[x] does not seem to work. Normal@(f'[x]) rectifies the issue. – user55405 Apr 2 '19 at 13:53
• Correct. @ appears above ' in this list: reference.wolfram.com/language/tutorial/OperatorInputForms.html. – Chip Hurst Apr 2 '19 at 14:26

It might be late to answer this, but I think it's important to add my approach.

I came to the same problem of having ConditionalExpressions in my outputs.

After googling I came about this solution, by using the Assuming[] function.

An example:

Assuming[Re[s] > 1, Integrate[1/x^s,{x,1,Infinity}]


Which gives:

1/(-1+s)

• What are cases where Normal didn't work? – Chip Hurst Jul 1 '15 at 12:43
• Normal[] worked after all too. – milia Jul 2 '15 at 13:51
• Normal does a whole bunch of other stuff other than removing the assumption. You will have much more control using Assuming and won't inadvertently cause any unintended consequences. – sgdsgyhetwaraw Nov 17 '19 at 18:16

Assuming[Re[s] > 1, Integrate[1/x^s, {x, 1, Infinity}]] is the fastest way to do an integral. If you don't know the conditions for which the integral works, you can also use Integrate[1/x^s, {x, 1, Infinity}, GenerateConditions -> False]

Normal[Integrate[1/x^s, {x, 1, Infinity}]] is significatively longer because you must compute the conditions and then throw them away. It can be very long in some cases.

For example,

In[215]:= Normal[Integrate[1/x^s, {x, 1, Infinity}]] // AbsoluteTiming

Out[215]= {0.319937,1/(s-1)}

In[212]:=
Integrate[1/x^s, {x, 1, Infinity},
GenerateConditions -> False] // AbsoluteTiming

Out[212]= {0.140617,1/(s-1)}

In[214]:=
Integrate[1/x^s, {x, 1, Infinity},
Assumptions -> s > 1] // AbsoluteTiming

Out[214]= {0.148892,1/(s-1)}

In[219]:=
Assuming[Re[s] > 1,
Integrate[1/x^s, {x, 1, Infinity}]] // AbsoluteTiming

Out[219]= {0.103522,1/(s-1)}