Accelerating the pace of engineering and science

# not

Logical NOT for symbolic expressions

~A
not(A)

## Description

~A represents the logical negation. ~A is true when A is false and vice versa.

not(A) is equivalent to ~A.

## Input Arguments

 A Symbolic equation, inequality, or logical expression that contains symbolic subexpressions.

## Examples

Create this logical expression using ~:

```syms x y
xy = ~(x > y);```

Use assume to set the corresponding assumption on variables x and y:

`assume(xy)`

Verify that the assumption is set:

`assumptions`
```ans =
~y < x```

Create this logical expression using logical operators ~ and &:

```syms x
range = abs(x) < 1 & ~(abs(x) < 1/3);```

Replace variable x with these numeric values. Note that subs does not evaluate these inequalities to logical 1 or 0.

```x1 = subs(range, x, 0)
x2 = subs(range, x, 2/3)```
```x1 =
0 < 1 & ~0 < 1/3
x2 =
2/3 < 1 & ~2/3 < 1/3```

To evaluate these inequalities to logical 1 or 0, use logical or isAlways:

```logical(x1)
isAlways(x2)```
```ans =
0

ans =
1```

Note that simplify does not simplify these logical expressions to logical 1 or 0. Instead, they return symbolic values TRUE or FALSE.

```s1 = simplify(x1)
s2 = simplify(x2)```
```s1 =
FALSE

s2 =
TRUE```

Convert symbolic TRUE or FALSE to logical values using logical:

```logical(s1)
logical(s2)```
```ans =
0

ans =
1```