print 1 minute | Arithmetic | Analysis | Geometry | Statistics | Menus, icons,... Mathematical Objects | Linear algebra | Functions | 2D Graphics | Combinatorics | Toolbar WIRIS ++ | Equations and systems of equations | Progressions | 3D Graphics | Units of measurement | Primary
Functions

One of the most valuable capabilities of WIRIS is that it allows us to define new functions in such a way that these functions are treated the same way as those already built into WIRIS. The arguments to these functions can be any mathematical object.

In this section we will learn how functions are defined and how they are used. We will also study the various functions of real variables which are of fundamental importance in mathematics, and which WIRIS already has built in.

 >>fast Defining functions Real functions square root root trigonometry exponential logarithm absolute value sign maximum minimum

To define functions, use the symbol :=, created using the keyboard or the icon . To the left of this symbol we enter the name of the function followed by the list of function arguments in parentheses. To the right we enter the body of the function. That is, we enter the operations that need to be carried out on the arguments.

A function can have as many arguments as we like, or none. The body of the function can use other functions previously defined. To use the function with specific arguments, enter the function name followed by the arguments in parentheses, separated by commas. (This structure is referred to as a Sequence).

If you attempt to use a function that has not been defined, no calculation is carried out.

The function f in the example above takes one argument. However, as we have already stated, the number of arguments can be any non-negative number. Furthermore, the same function can have different definitions depending on the number of arguments passed to it.

A function can also have more than one definition depending on the domain of its arguments. In the definition of a function, to specify the domain of one of its arguments, enter the argument followed by the character : and the name of the domain. It is also possible to define a function for a specific object. The following examples illustrate all these options. Note that the command definition applied to a function, gives us the definitions of that function.

A useful command to define a function, which is evaluated one way with certain elements in its domain of application but in another way for a different subset of the domain is the command check. Write it between the function arguments and the symbol := in the form check <condición>, where <condición> is a boolean expression (that is, it is an expression that can always be evaluated as true or false) constructed from function arguments. In this way it is possible to define discontinuous functions that cannot be converted into analytical elements (they can be evaluated but limits, derivatives and integrals cannot be calculated).

The names we can give to functions are of the same form as those that can be used with variables.

Functions, like any object in WIRIS are entities independent of the names given to them. For example, the function that returns the square of a number and then adds 1 can be understood as a function in its own right. Nonetheless, it is helpful to give it a name for convenience. A function, which does not have a name assigned to it, is called an anonymous function. Anonymous functions are defined using the icon , which is equivalent to --> entering their arguments between parentheses to the left of the symbol --> and the body of the function to the right of this symbol. Note that the command definition, as seen in previous examples, returns a list of anonymous functions.

If a function has been defined, and we wish to delete it, apply the command clear

Here, we will discuss some of the predefined real functions in WIRIS that correspond to basic mathematical functions.

square root:  Icon , command sqrt or square_root

Calculates the square root of the argument. Another way to calculate the square root of a number is to raise it to the 1/2. The command sqrts or square_roots command calculates all the square roots of a real number.

root:  Icon , command root

Calculates the nth root of x, where x is the first argument (the one in the main box if the icon was used) and n is the second (the one in the upper box). As in the previous case, the calculation of the nth root is equivalent to raising x to 1/n. The command roots calculates all the complex (or real) roots of a real number.

trigonometry:

The trigonometric functions are as follow:
 sin cos tan cosec sec cotan

These correspond respectively to the sine, cosine, tangent, cosecant, secant and cotangent. The argument for these functions is assumed to be expressed in radians. To use degrees, apply the symbol º, which is located in the tab Units.

The inverse trigonometric functions included in WIRIS are:
 asin acos atan

These correspond respectively to arcsine, arccosine and arctangent. The argument of these functions is a real number. The result of all these is the main result of the function, expressed in radians (the same given by the keys sin -1, cos -1 and tan -1 commonly found on a pocket calculator). If the answer is required in degrees, use the function convert.

exponential:  command exp , Icon or

Calculates the result of applying the exponential function to its single argument (that is, the number that results from raising the number e to the argument). The icon can be used to obtain exact values (i.e. without evaluating) and the icon can be used to obtain approximations. WIRIS also incorporates complex exponentials.

logarithm:  command ln or log

If the commands above are given a single argument, they calculate the natural (Naperian) and decimal logarithms, respectively. If log takes two arguments a and b, it calculates the logarithm of a in base b.

logb(a) calculates the logarithm of a in base b. It is equivalent to log(a,b). Remember that to create a subscript use the icon

absolute value:  Icon , command absolute

Calculates the absolute value of the argument.

sign:  command sign

Obtains the sign of a real number. Returns 1 if the number is positive, -1 if it is negative and 0 if it is neither positive nor negative.

 maximum:  command maximum or max Calculates the maximum values of the functions arguments. If the argument is a List or Vector, it calculates the maximum of its elements.

minimum:  command minimum or min

Calculates the minimum of the arguments entered in the function. If the argument is a List or Vector, it calculates the maximum of its elements.