Application Center - Maplesoft

App Preview:

Maple Programming: 1.1 & 1.2: Functions in Mathematics

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

1.01and1.02.mws

Programming in Maple

Roger Kraft
Department of Mathematics, Computer Science, and Statistics
Purdue University Calumet

roger@calumet.purdue.edu

1.1 Introduction

Functions play a major role in Mathematics so it is important to know how to work with them in Maple. Understanding functions in Maple is also a good starting point for our discussions about Maple programming. There are two distinct ways to represent mathematical functions in Maple. We can represent a mathematical function using either an "expression" or a "Maple function". The distinction that Maple makes between "expressions" and "functions" has its roots in both mathematics and programming. Making this distinction, and learning to understand it and work with it, will help introduce us to several programming concepts, most notably the idea of a "data structure" and a "procedure".

>   

1.2. Functions in Mathematics

We quickly review here the definition of a mathematical function. A function is three things bundled together. It is a set of inputs (the domain), a set of outputs (the codomain), and a rule for associating one of the outputs to each of the inputs. Functions can be defined in several ways, for example by formulas, by tables, and by graphs. Most of the time in mathematics, the sets of inputs and outputs are sets of numbers. For most people, the "rule" part of a function's definition seems the most important, but that is not really a good way to think about functions.  To demonstrate that a mathematical function is really more than just its rule, let us look at an example.

>   

We shall define three different functions named f, g, and h. The rule for each of these functions will be given by a formula. In fact we will use the same formula in all three cases. What will make the three functions different will be their domains.

The function f  has as its domain the set of all real numbers, its codomain is the set of all positive real numbers, and its rule is given by the formula f(x) = x^2 .

The function g  has as its domain the set of all positive real numbers, its codomain is the set of all positive real numbers, and its rule is given by the formula g(x) = x^2 .

The function h  has as its domain the set of all negative real numbers, its codomain is the set of all positive real numbers, and its rule is given by the formula h(x) = x^2 .

Exercise : Draw graphs for each of the functions f, g, and h.

>   

How do we know that these three functions are different? The answer is that they have different properties. For example, the function f is not invertible (why?). The functions g and h are both invertible (why?) but they have different inverses. The inverse of the function g has its rule given by the formula (g^(-1))(x) = sqrt(x) . The inverse of the function h has its rule given by the formula (h^(-1))(x) = -sqrt(x) .

So f, g, and h all have the exact same formula (i.e., rule) but they are not  the same function. The domain (and codomain) really are important parts of the definition of a mathematical function.

Exercise : What is the domain and codomain for each of g^(-1)  and h^(-1) ?

>   

>