Symbolic logical constant false



F = symfalse returns the symbolic logical constant for the false condition.


collapse all

Create a symbolic inequality x2>4.

syms x
eq = x^2 > 4
eq = 4<x24 < x^2

Assume that -2<x<2.

assume(-2<x & x<2)

Simplify the condition represented by the symbolic inequality eq. The simplify function returns the symbolic logical constant symfalse since the condition never holds for the assumption -2<x<2.

F = simplify(eq)
F = symfalsesymfalse

Display the data type of symfalse, which is sym.

ans = 

You can also use isAlways to check if the inequality does not hold under the assumption being made. In this example, isAlways returns logical 0 (false).

TF = isAlways(eq)
TF = logical

Create a truth table for the and operation applied to the two symbolic logical constants, symtrue and symfalse.

A = [symtrue symfalse]
A = (symtruesymfalse)[symtrue, symfalse]
B = [symtrue; symfalse]
B = 

(symtruesymfalse)[symtrue; symfalse]

TF = and(A,B)
TF = 

(symtruesymfalsesymfalsesymfalse)[symtrue, symfalse; symfalse, symfalse]

Combine symbolic logical constants with logical operators and, not, or, and xor (or their shortcuts).

TF = xor(symtrue,or(symfalse,symfalse))
TF = symtruesymtrue
TF = symtrue & ~(symfalse)
TF = symtruesymtrue

Convert the symbolic logical constant symfalse to a logical value.

T1 = logical(symfalse)
T1 = logical

Convert the symbolic logical constant symfalse to numeric values in double precision and variable precision.

T2 = double(symfalse)
T2 = 0
T3 = vpa(symfalse)
T3 = 0.0vpa('0.0')

Show the data types of T1, T2, and T3.

  Name      Size            Bytes  Class      Attributes

  T1        1x1                 1  logical              
  T2        1x1                 8  double               
  T3        1x1                 8  sym                  

Output Arguments

collapse all

Symbolic logical constant for false condition, returned as a scalar.

Data Types: sym


  • The command sym(false) returns a symbolic number 0, and sym(symfalse) returns symfalse.

  • When you combine two arrays of symbolic logical constants with logical operations using and, or, or xor function, the arrays must either be the same size or have sizes that are compatible. For more information on the required input sizes for basic array operations, see Compatible Array Sizes for Basic Operations (MATLAB).

See Also

| | | | |

Introduced in R2020a