As mentioned in the title, I have two questions.

1. I have code that looks similar to:

(* This gives 1 - (x-1)/2 + (3/8)(x-1)^2 + O[x-1]^3 *)

I want this to be equivalent to defining

f[x_]:=1 - (x-1)/2 + (3/8)*(x-1)^2

but instead Mathematica doesn't seem to know what do do with it. Any ideas on how to accomplish this sort of thing? More generally, I often find this kind of problem, where I want to define a function or variable from the output of a previous expression, but I don't know deeply enough how Mathematica works to accomplish this. Any advice?

2. Frequently, especially when integrating or solving differential equations, Mathematica outputs its answers as ConditionalExpression[answer, conditions]. Obviously there are good reasons for this, but sometimes it just makes the Mathematica document look messy. Does anyone know of a way to tell Mathematica, "if the answer is a conditional expression, output the answer as if the conditions are met"?

For example, the code



ConditionalExpression[Pi Sqrt[1/x^2], Im[x^2] != 0 || Re[x^2]>=0]

I could obviously get around this by adding Assumptions->Re[x^2]>=0, but the assumptions clause will be different for every expression I evaluate. I want something more general that I can write to always skip the ConditionalExpression, e.g., something like

Integrate[1/(x^2 + y^2 + z^2), {z, -Infinity, Infinity},Assumptions->"Conditions are all satisfied"]

Thanks very much for any help that you can provide.


closed as too broad by Michael E2, Bob Hanlon, bbgodfrey, Sjoerd C. de Vries, Dr. belisarius May 7 '15 at 20:30

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Please ask separate questions in separate questions. $\endgroup$ – Michael E2 May 7 '15 at 17:59
  • $\begingroup$ Use Normal on the output to get an "usable" form ( Q1 ) $\endgroup$ – Sektor May 7 '15 at 18:25

As to the second question: you could change ConditionalExpression itself.


ConditionalExpression[a_, ___] := a

but this is potentially dangerous. Who knows where else ConditionalExpression is being used? So, a safer alternative is just change the way it's being output


Format[ConditionalExpression[a_, ___]] := a

Another alternative, with side effects that I can't oversee and that's probably too stupid to consider (but that works in your case) would be the simple:

$Assumptions := {_ -> True}

Integrate[1/(x^2 + y^2), {y, -Infinity, Infinity}]
(* π Sqrt[1/x^2] *)

Perhaps the safest approach would be using a version of Michael E2's comment in combination with $Post:

$Post = (#/.ConditionalExpression->First &)
  • $\begingroup$ It seemed like the OP wanted something that would work on a whole series of operations without intervention of the user. Putting /. ConditionalExpression -> First behind every expression would not really meet the requirement. $\endgroup$ – Sjoerd C. de Vries May 7 '15 at 18:52
  • $\begingroup$ It works in all cases, though - the OP seemed willing to add assumptions, just not different and unpredictable ones each time. Frankly, I think the question should be split, edited or even deleted. $\endgroup$ – Michael E2 May 7 '15 at 18:55
  • $\begingroup$ @MichaelE2 I agree $\endgroup$ – Sjoerd C. de Vries May 7 '15 at 19:06

Use Normal with Series

f[x_] = Series[1/Sqrt[x], {x, 1, 2}] // Normal

1 + (1 - x)/2 + (3/8)*(-1 + x)^2

Use GenerateConditions -> False with Integrate

Integrate[1/(x^2 + y^2), {y, -Infinity, Infinity},
 GenerateConditions -> False]



Alternatively, and perhaps more generally, conditions can be eliminated by prepending First, as in

First@Integrate[1/(x^2 + y^2), {y, -Infinity, Infinity}]

Not the answer you're looking for? Browse other questions tagged or ask your own question.