Chapter 2 - Maple Basics

2.9 Examples of Functions

Functions can be made out of other intrinsic or user-defined functions. These more complicated functions are often needed by modelers in various fields to better describe different systems. We will see examples in this section.

2.9.1 Point on rim of wheel

Lets consider a point on the rim of a wheel. Its x and y coordinates depend on the angle phi the radius makes with the x-axis as shown in the adjacent graph.

The angle phi is itself a function of time as the wheel turns. In fact, if the wheel speeds up, the angle phi might increase as the square of the time. The constant of proportionality is called the angular acceleration by physicists. Therefore

phi = a t 2

This translates into the following Maple spreadsheet.

Note the use of the  unapply()  command since the expression are Maple generated. Note also that a must be specified numerically for the plot.

This application begs us to graph the trajectory of the point on the wheel and to animate it. This will be adressed in the next section

2.9.2 A Bumpy Ride

Amazing shapes can be reproduced via superpositions of known functions. This is often used in modeling complicated functional dependencies.

Our friendly financial analyst is looking at the price of a service rendered by his firm. The price has had a bumpy ride over the last 5 months. Here is how he represents the data as a superposition of Gaussian functions. 

He first defines  "terms" of Gaussian bell shapes (see Section 2.6) that depends on the time t and on an index k. Note the syntax of the unapply() command

    unapply( expression, variable1, variable2 );

to define a function a two variables. The index k is to take integer values only, i.e., 1, 2, .... The function a(k) defines the width of the bell shape. The center of the bell is shifted by displacing the argument, i.e., t-k; this centers the Gaussian on the value of t = k. This is illustrated in the plot of the individual terms. Note the bells centered at 1, 2, and 3 and with increasingly narrower shapes. The price function is the superposition (sum) of three terms with k=1,2, and 3. 

Note the shape of the price(t) function that results.

2.9.3 The Bumpy Ride made Easier ( sum command )

Maple allows to perform sum of terms automatically via the sum(expression,range) command. In this command the "expression" is the "term" to sum over. The "range" argument specifies the range over which the "index" characterizing the "expression" is to be summed over. The following worksheet exemplifies the sum() command.

 Mathematically, these sums correspond to

The sum() command makes writing the Bumpy Ride function easier to code in Maple. It avoids to spell out the possibly tedious list of terms in the sum.


 
Section 2.8 Chapter 2 Section 2.10       TOC

Any questions or suggestions should be directed to
Michel Vallieres at vallieres@physics.drexel.edu