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 allclose all

Basic Examples  (2)

There is a solution only when :

In[1]:=
Click for copyable input
Out[1]=

The answer is valid when the condition is satisfied:

In[1]:=
Click for copyable input
Out[1]=

Scope  (16)

Properties & Relations  (4)

Possible Issues  (1)

See Also

Undefined  Condition  Piecewise  Assumptions  Solve  Integrate

Introduced in 2010
(8.0)