Sponsored links: Algebra eBooks ### The Maxima on-line user's manual

Algebra Calculator

#### Search: #### Charfun

Function: charfun (<p>) Return 0 when the predicate <p> evaluates to `false`; return 1 when the predicate evaluates to `true`. When the predicate evaluates to something other than `true` or `false` (unknown), return a noun form. Examples:

```          (%i1) charfun (x < 1);
(%o1)                    charfun(x < 1)
(%i2) subst (x = -1, %);
(%o2)                           1
(%i3) e : charfun ("and" (-1 < x, x < 1))\$
(%i4) [subst (x = -1, e), subst (x = 0, e), subst (x = 1, e)];
(%o4)                       [0, 1, 0]```

There are also some inexact matches for `charfun`. Try `?? charfun` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

##### charfun

f(n):=2+charfun(n>...

f(37);

f(62);

Calculate

charfun (2 < 1);

Calculate

charfun (x < 1);

Calculate

##### charfun

h(x,y,t):=charfun(x&g...

Calculate

? charfun;

Calculate

##### charfun-subst

charfun (x < 1);

subst (x = -1, %);

e : charfun ('"and" ...

Calculate

##### charfun

h(x,y,t):=charfun(x&g...

Calculate

? charfun;

Calculate

##### charfun-integrate-sin

f(x):=charfun(x<0)...

integrate(f(x),x);

Calculate

##### charfun

charfun (x < 1);

Calculate 