## `=, <>` -- equations and inequalities

#### Introduction

`x = y` defines an equation.

`x <> y` defines an inequality.

#### Call(s)

x = y `_equal(x, y)`
x <> y `_unequal(x, y)`

#### Parameters

`x, y` | - | arbitrary MuPAD objects

#### Returns

an expression of type `"_equal"` or `"_unequal"`, respectively.

#### Related Functions

`<`, `<=`, `>`, `>=`, `and`, `bool`, `FALSE`, `if`, `lhs`, `not`, `or`, `repeat`, `rhs`, `solve`, `TRUE`, `while`, `UNKNOWN`

#### Details

- `x = y` is equivalent to the function call `_equal(x, y)`.
- `x <> y` is equivalent to the function call `_unequal(x, y)`.
- The operators `=` and `<>` return symbolic expressions representing equations and inequalities, respectively.

  The resulting expressions can be evaluated to `TRUE` or `FALSE` by the function `bool`. They also serve as control conditions in `if`, `repeat`, and `while` statements. In all these cases, testing for equality or inequality is a purely syntactical test. E.g., `bool(0.5 = 1/2)` returns `FALSE` although both numbers coincide numerically. Correspondingly, `bool(0.5 <> 1/2)` returns `TRUE`.

  Further, Boolean expressions can be evaluated to `TRUE`, `FALSE`, or `UNKNOWN` by the function `is`. Tests using `is` are semantical comparing `x` and `y` subject to mathematical considerations.

- Equations and inequalities have two operands: the left hand side and the right hand side. One may use `lhs` and `rhs` to extract these operands.
- `not x = y` is always converted to `x <> y`.
- `not x <> y` is always converted to `x = y`.
- `_equal` is a function of the system kernel.
- `_unequal` is a function of the system kernel.

#### Example 1

In the following, note the difference between syntactical and numerical equality. The numbers 1.5 and 3/2 coincide numerically. However, 1.5 is of domain type `DOM_FLOAT`, whereas 3/2 is of domain type `DOM_RAT`. Consequently, they are not regarded as equal in the following syntactical test:

    >> 1.5 = 3/2; bool(%)

                                     1.5 = 3/2

                                       FALSE

The following expressions coincide syntactically:

    >> _equal(1/x, diff(ln(x),x)); bool(%)

                                       1   1
                                       - = -
                                       x   x

                                       TRUE

The Boolean operator `not` converts equalities and inequalities:

    >> not a = b, not a <> b

                                   a <> b, a = b

#### Example 2

The examples below demonstrate how `=` and `<>` deal with non-mathematical objects and data structures:

    >> if "text" = "t"."e"."x"."t" then "yes" else "no" end

                                       "yes"

    >> bool(table(a = PI) <> table(a = E))

                                       TRUE

#### Example 3

We demonstrate the difference between the syntactical test via `bool` and the semantical test via `is`:

    >> bool(1 = x/(x + y) + y/(x + y)), is(1 = x/(x + y) + y/(x + y))

                                    FALSE, TRUE

#### Example 4

Equations and inequalities are typical input objects for system functions such as `solve`:

    >> solve(x^2 - 2*x = -1, x)

                                        {1}

    >> solve(x^2 - 2*x <> -1, x)

                                   C_ minus {1}

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000