Main Content

symfalse

Symbolic logical constant false

Since R2020a

Description

symfalse is the symbolic logical constant for the false condition.

example

F = symfalse(n) returns an n-by-n matrix of symbolic logical symfalses.

example

F = symfalse(sz) returns an array of symbolic logical symfalses where the size vector, sz, defines size(T). For example, symfalse([2 3]) returns a 2-by-3 array of symbolic logical symfalses.

example

T = symfalse(sz1,...,szN) returns a sz1-by-...-by-szN array of symbolic logical symfalses where sz1,...,szN indicates the size of each dimension. For example, symfalse(2,3) returns a 2-by-3 array of symbolic logical symfalses.

example

Examples

collapse all

Create a symbolic inequality x2>4.

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

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 = symfalse

Display the data type of F, which is sym.

class(F)
ans = 
'sym'

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
   0

Use symfalse to generate a 3-by-3 square matrix of symbolic logical symfalses.

F = symfalse(3)
F = 

(symfalsesymfalsesymfalsesymfalsesymfalsesymfalsesymfalsesymfalsesymfalse)

Display the data type of T, which is sym.

class(F)
ans = 
'sym'

Next, use symfalse to generate a 3-by-2-by-2 array of symbolic logical symfalses.

F = symfalse(3,2,2)
F(:,:,1) = 

(symfalsesymfalsesymfalsesymfalsesymfalsesymfalse)

F(:,:,2) = 

(symfalsesymfalsesymfalsesymfalsesymfalsesymfalse)

Alternatively, you can use a size vector to specify the size of the array.

F = symfalse([3,2,2])
F(:,:,1) = 

(symfalsesymfalsesymfalsesymfalsesymfalsesymfalse)

F(:,:,2) = 

(symfalsesymfalsesymfalsesymfalsesymfalsesymfalse)

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

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

(symtruesymfalse)

TF = and(A,B)
TF = 

(symtruesymfalsesymfalsesymfalse)

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

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

Convert the symbolic logical constant symfalse to a logical value.

T1 = logical(symfalse)
T1 = logical
   0

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.0

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

whos
  Name      Size            Bytes  Class      Attributes

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

Input Arguments

collapse all

Size of square matrix, specified as an integer. n sets the output array size to n-by-n. For example, symfalse(3) returns a 3-by-3 array of symbolic logical symfalses.

  • If n is 0, then F is an empty matrix.

  • If n is negative, then it is treated as 0.

Size vector, specified as a row vector of integers. For example, symfalse([2 3]) returns a 2-by-3 array of symbolic logical symfalses.

  • If the size of any dimension is 0, then F is an empty array.

  • If the size of any dimension is negative, then it is treated as 0.

  • If any trailing dimensions greater than 2 have a size of 1, then the output F does not include those dimensions. For example, symfalse([2 2 1 1]) returns a 2-by-2 array and symfalse([2 2 1 2 1]) returns a 2-by-2-by-1-by-2 array.

Size inputs, specified by a comma-separated list of integers. For example, symfalse(2,3) returns a 2-by-3 array of symbolic logical symfalses.

  • If the size of any dimension is 0, then F is an empty array.

  • If the size of any dimension is negative, then it is treated as 0.

  • If any trailing dimensions greater than 2 have a size of 1, then the output F does not include those dimensions. For example, symfalse([2,2,1,1]) returns a 2-by-2 array and symfalse([2,2,1,2,1]) returns a 2-by-2-by-1-by-2 array.

Output Arguments

collapse all

Symbolic logical constant for false condition, returned as a scalar, vector, matrix, or N-D array.

Data Types: sym

Tips

  • 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.

Version History

Introduced in R2020a

See Also

| | | | |