[ Previous | Next | Contents ]


8. Functions

In addition to the many functions supplied by DERIVE, new functions can be defined using any combination of variables, arithmetic operators (*, /, etc.), DERIVE functions (SIN, LN, etc.), or even DERIVE commands. These "user-defined" functions greatly simplify the task of evaluating expressions.

8.1 - Defining Functions

Functions are defined using the [A]uthor command, although the notation is slightly different than normal function notation. For example, the function f(x) = x² + 2x would be entered as indicated below by the bold-face text.
		AUTHOR expression: f(x):=x^2+2x[Enter]
Notice that ":=" is used instead of just "=". It is a very important that the colon is used since DERIVE will not recognize the new function without it.

Previously defined functions and DERIVE functions can also be used to define new functions. In the following example, we will assume that the function f(x) = x² + 2x has already been defined as shown above.

Example 8.1: Define the function h(x) = .

Solution: Assuming the function f(x) = x² + 2x has already been defined, [A]uthor the function h(x):=sqrt(f(x)) and press [Enter]. This is an example of a composition of functions. Algebraically, the function h is the composition of g(x) = and f(x) = x² + 2x.

A function name may be any letter or word that is not already a DERIVE function. If a function name is used a second time in the same DERIVE session, the new definition replaces the previous definition. If you wish to use a function throughout a DERIVE session, you must avoid using that function name again to define a new function.

8.2- Evaluating Functions

Once a function has been defined, it can be evaluated using any numeric or symbolic input value. If the input value is a number, the output value can be found exactly or approximately. If the input value is an expression, the output value is given as an expression.

Example 8.2: Define the function f(x) = and find f(2), f (), and f(x - 1).

Solution: [A]uthor the function f(x):=x/(x^2+1). To find f(2), [A]uthor f(2) and [S]implify to get the output value 2/5. To find f(), [A]uthor f(pi) and appro[X] to get the decimal approximation 0.289025. To find f(x - 1), [A]uthor f(x - 1) and [S]implify to get the expression .

A table of function values can be generated by using the vector function. In the following example, we construct a table of 9 function values, although it would be just as easy to find 100, 1000, or more.

Example 8.3: Construct a table of function values for f(x) = with x starting at 0.1 and decreasing down to 0.02 by increments of 0.01.

Solution: First [A]uthor the function f(x):=sinx/x and then [A]uthor the expression vector(f(x),x,.1,.02,-.01) to indicate that we want the values of x to go from 0.1 down to 0.02 by increments of 0.01. To obtain approximations for these nine values, select appro[X]. The result is shown in Figure 8.4.

Figure 8.4

Notice that there is not room on one line to display all of the function values. To see the remaining values, press the right arrow key until the numbers start to scroll to the left.


[ Previous | Next | Contents ]


Copyright © 1995, Mark E. Gruenwald.
This file may be copied on the condition that its entire contents, including this copyright notice, remain intact.