## Piecewise

### sign function

Returns the sign of the argument.

sign(z)

#### Description

The `sign` function, which is also called signum, returns the sign of `z`. `z` may be any numeric expression that evaluates to a real number or a complex number. When `z` is a real number, sign(z) returns 1 for `z`>0 and -1 for `z`<0. sign(z) returns 0 for `z`=0. When `z` evaluates to a complex number, sign(z) returns z/abs(z).

 Wikipedia MathWorld

### u function

The unit step function.

u(z)

#### Description

u(z) is commonly known as the unit step function. `z` may be any numeric expression that evaluates to a real number. The function is undefined when `z` has an imaginary part. u(z) returns 1 for `z`0 and 0 for `z`<0.

 Wikipedia MathWorld

### min function

Finds and returns the minimum of the values passed as arguments.

min(A,B,...)

#### Description

The `min` function returns the minimum value of its arguments. `min` can take any number of arguments not less than 2. The arguments may be any numeric expressions that evaluate to real numbers or complex numbers. If the arguments are complex numbers, the function returns min(re(A), re(B), ...) + min(im(A), im(B), ...)i.

### max function

Finds and returns the maximum of the values passed as arguments.

max(A,B,...)

#### Description

The `max` function returns the maximum value of its arguments. `max` can take any number of arguments not less than 2. The arguments may be any numeric expressions that evaluate to real numbers or complex numbers. If the arguments are complex numbers, the function returns max(re(A), re(B), ...) + max(im(A), im(B), ...)i.

### range function

Returns the second argument if it is in the range between the first argument and the third argument.

range(A,z,B)

#### Description

The `range` function returns `z`, if `z` is greater than `A` and less than `B`. If `z` < `A` then `A` is returned. If `z` > `B` then `B` is returned. The arguments may be any numeric expressions that evaluate to real numbers or complex numbers. The function has the same effect as max(A, min(z, B)).

### if function

Evaluates one or more conditions and returns a different result based on them.

#### Syntax

if(cond1, f1, cond2, f2, ... , condn, fn [,fz])

#### Description

The `if` function evaluates `cond1` and if it is different from 0 then `f1` is evaluated and returned. Else `cond2` is evaluated and if it is different from 0 then `f2` is returned and so forth. If none of the conditions are true `fz` is returned. `fz` is optional and if not specified `if` returns an error if none of the conditions are true. The arguments may be any numeric expressions that evaluate to real numbers or complex numbers.