ConditionalExpression[expr,cond]
is a symbolic construct that represents the expression expr when the condition cond is True.
ConditionalExpression
ConditionalExpression[expr,cond]
is a symbolic construct that represents the expression expr when the condition cond is True.
Details
- ConditionalExpression[expr,True] evaluates to expr.
- ConditionalExpression[expr,False] evaluates to Undefined.
- ConditionalExpression is automatically propagated from the arguments of mathematical functions, equations and inequalities, and Boolean operators, i.e. h[ConditionalExpression[e1,c1],ConditionalExpression[e2,c2],…] is transformed to ConditionalExpression[h[e1,e2,…],c1&&c2&&⋯].
- If a function takes assumptions, then the conditional part of ConditionalExpression arguments gets added to the assumptions.
- Algebraic transformation functions applied to a conditional expression apply to the first argument.
Examples
open all close allBasic Examples (2)
Scope (16)
Solve[a x ^ 2 + b x + c == 0, x, Reals]Solve[x ^ 2 - 2y ^ 2 == 1 && x > 0 && y > 0 , {x, y}, Integers]Conditionally valid integration results:
Integrate[Exp[x ^ a], {x, 0, 1}]Conditionally valid summation results:
Sum[1 / n ^ a, {n, ∞}, GenerateConditions -> True]Conditionally valid Fourier series:
FourierSeries[a ^ x, x, 3, GenerateConditions -> True]ConditionalExpression with True or False conditions:
ConditionalExpression[a, True]ConditionalExpression[a, False]Mathematical functions with ConditionalExpression arguments:
Sin[ConditionalExpression[x, x > 0] + 1] ConditionalExpression[x, x < 1] ^ 2Boolean combinations of equations and inequalities involving ConditionalExpression:
ConditionalExpression[x, x > 0] ^ 2 == 1 && ConditionalExpression[y, y < 0] > -1ConditionalExpression[x, x > 0] + ConditionalExpression[x, x < 0]Inverse of a function with a restricted domain:
InverseFunction[ConditionalExpression[# ^ 2 + # + 1, # ≤ -1 / 2]&]Simplify a conditional expression:
Simplify[ConditionalExpression[Sqrt[x ^ 2], x < 0]]Find solutions of equations involving conditional expressions:
Reduce[ConditionalExpression[x ^ 2 - 1, x > 0] == 0, x]Plot a function with a restricted domain:
Plot3D[ConditionalExpression[x ^ 2 - y ^ 2, x ^ 2 + y ^ 2 < 1], {x, -1, 1}, {y, -1, 1}]Piecewise function involving conditional expressions:
Piecewise[{{ConditionalExpression[x + y, x > 0], y > 0}, {x - y, ConditionalExpression[y ≤ 0, y > -1]}}]Transform a conditionally valid expression:
Expand[ConditionalExpression[(x + y) ^ 2, x - y > 0]]Factor[%]Conditionally valid expressions in calculus functions:
Integrate[ConditionalExpression[a ^ x, a > 0], x]D[%, x]FourierTransform[ConditionalExpression[x ^ n, n > 0], x, t]Properties & Relations (4)
ConditionalExpression with True condition evaluates to its first argument:
ConditionalExpression[a, True]ConditionalExpression with False condition evaluates to Undefined:
ConditionalExpression[a, False]ConditionalExpression is propagated from the arguments of mathematical functions:
Sin[ConditionalExpression[x, x > 0]] + 3ConditionalExpression[Cos[x], x < 1] ^ 2ConditionalExpression is propagated from the arguments of equations and inequalities:
{ConditionalExpression[x ^ 2, x > 0] == 1, ConditionalExpression[x ^ a, a > 0] < 2}ConditionalExpression is propagated from the arguments of Boolean functions:
ConditionalExpression[p, c] && ( ConditionalExpression[q, d] || r)For functions taking the Assumptions option, argument conditions are used as assumptions:
Limit[ConditionalExpression[a ^ x, 0 < a < 1], x -> Infinity]Refine, Simplify, and FullSimplify use the conditions to transform the values:
Refine[{ConditionalExpression[Sqrt[x ^ 2], x > 0], ConditionalExpression[Sqrt[x ^ 2], x < 0]}]Possible Issues (1)
For functions taking the Assumptions option, argument conditions are used as assumptions:
Residue[Tan[x], ConditionalExpression[{x, (2n + 1) Pi / 2}, Element[n, Integers]]]ConditionalExpression subexpressions that are not arguments are not used:
Residue[Tan[x], {x, ConditionalExpression[(2n + 1) Pi / 2, Element[n, Integers]]}]Related Guides
History
Text
Wolfram Research (2010), ConditionalExpression, Wolfram Language function, https://reference.wolfram.com/language/ref/ConditionalExpression.html.
CMS
Wolfram Language. 2010. "ConditionalExpression." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ConditionalExpression.html.
APA
Wolfram Language. (2010). ConditionalExpression. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ConditionalExpression.html
BibTeX
@misc{reference.wolfram_2026_conditionalexpression, author="Wolfram Research", title="{ConditionalExpression}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/ConditionalExpression.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_conditionalexpression, organization={Wolfram Research}, title={ConditionalExpression}, year={2010}, url={https://reference.wolfram.com/language/ref/ConditionalExpression.html}, note=[Accessed: 12-June-2026]}