Documentation

# `Type`::`ConstantIdents`

Set of constant identifiers in MuPAD

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```contains(`Type::ConstantIdents`, `obj`)
```

## Description

`Type::ConstantIdents` is the set ```{ CATALAN , E , EULER , I , PI }```.

`Type::ConstantIdents` is the set of identifiers that represent constants. As of version 4.0, these are CATALAN, E (= `exp(1)`), EULER, I, PI.

These constants will be returned by the function `indets`, but they cannot be treated like other identifiers. For example, they cannot have properties or be the left-hand side of an assignment.

See Example 1 for an application.

`Type::Constant` makes use of `Type::ConstantIdents`, see Example 2.

## Examples

### Example 1

MuPAD® implements π as the identifier PI.

`domtype(PI)`
` `

However, `PI` is constant:

`testtype(PI, Type::Constant)`
` `

Still, `indets` regards `PI` as an identifier with no value (which is syntactically correct), and you can even use `PI` as an indeterminate of a polynomial:

```indets(PI/2*x); poly(PI/2*x)```
` `
` `

To find the “real” indeterminates, use the following call:

`indets(PI/2*x) minus Type::ConstantIdents`
` `

### Example 2

In the following, the `solve` command solves for all identifiers found in the equation:

`solve(x^2 = KHINTCHINE)`
` `

Assume you want MuPAD to regard the identifier `KHINTCHINE` as a constant. (Probably, it should represent the Khintchine constant K, which is approximately 2.685452.) First of all, you should make sure that the identifier does not have a value yet and protect it:

```testtype(KHINTCHINE, DOM_IDENT); protect(KHINTCHINE, ProtectLevelError)```
` `
` `

Next, add `KHINTCHINE` to `Type::ConstantIdents` (note that we have to unprotect the identifier `Type`, because `Type::ConstantIdents` is a slot of it):

```old_protection := unprotect(Type): Type::ConstantIdents := Type::ConstantIdents union {KHINTCHINE}: protect(Type, old_protection): Type::ConstantIdents```
` `

Now, MuPAD regards `KHINTCHINE` as a constant:

`testtype(sin(PI + KHINTCHINE), Type::Constant)`
` `

After clearing the remember table of `solve`, we now obtain:

```solve(Remember, Clear): solve(x^2 = KHINTCHINE)```
` `

## Parameters

 `obj` Any MuPAD object