Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project...

209
Engineering Explorations with MAPLE Robin Carr Murat Tanyel Drexel University Harcourt Brace Custom Publishers Harcourt Brace College Publishers Fort Worth Philadelphia San Diego New York Orlando Austin San Antonio Toronto Montreal London Sydney Tokyo

Transcript of Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project...

Page 1: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

EngineeringExplorations with

MAPLE

Robin CarrMurat Tanyel

Drexel University

Harcourt Brace Custom PublishersHarcourt Brace College Publishers

Fort Worth Philadelphia San Diego New York Orlando Austin San AntonioToronto Montreal London Sydney Tokyo

Page 2: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Assistant Production Manager Tonya MorelandISBN: 0-15-502338-7Copyright ©1994 by Robin Carr and Murat TanyelAll rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical,including photocopy, recording, or any information storage and retieval system, without permission in writing from the publisher.Requests for permission to make copies of any part of the work should be mailed to: Permissions Department, Harcourt Brace & Company, 8thFloor, Orlando, Florida 32887.

Address editorial correspondence to:301 Commerce Street, Suite 3700Fort Worth, TX 76102Address orders to:6277 Sea Harbor DriveOrlando, FL 328871-800-782-4479 outside Florida1-800-433-0001 inside Florida

PRINTED IN THE UNITED STATES OF AMERICA

4567890123 021 987654321

Page 3: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Engineering Explorations with Maple®

AcknowledgmentsWe would like to thank a few special people who have made this book

possible. First and foremost our greatest appreciation goes to our student JohnGianvittorio, who more than anyone else has helped to make this book a reality. Johnhas worked tirelessly, weekday and weekend, day and night, to refine the text, createand enhance the graphics and to help in the design and creation of fresh and excitingproblems. Many of the computer animations and all the morphs were designed andimplemented by John.

We wish to thank Dr. Robert Quinn who has created the opportunity for us todevelop this book and to help in the creation of an engineering curriculum designedaround the engineering student.

We consulted with many of our science and engineering colleagues, but a greatdebt is owed to Don Thomas (MEM). Don has generously provided engineeringexpertise on many problems over the years and has been a terrific source of inspirationand ideas for these explorations. (Don - Thanks for demonstrating the elliptic gearmodel!)

We wish to acknowledge the graphical contributions of Craig Malesic andFrank Szczerba and to thank Giuseppe Sagolla for key production support.

Additional thanks go to Jennifer Atchison, Stuart Harper and Wayne Hill. Wealso want to acknowledge Pat Christie for her help and encouragement with so manythings over the years.

Our experience using Maple began almost five years ago. In those early days,the person who most encouraged us in our efforts to use Maple in the engineeringcurriculum was Tom Moore. At the time he was developing the sophomore Systemscourse and was always showing up at our door with a smile and another neat idea forthe use of Maple in his course. He is dearly missed by all.

We wish to thank Nathalie Cunningham and Alexa Barnes of SaundersCollege Publishing for their support. A very special thanks goes to Jay Ricci for hisunderstanding, encouragement and shared vision of an enhanced and excitingeducational experience designed for the engineering student.

The E4 project was supported in part by The Science and Engineering Education Directorate of the National ScienceFoundation, Grant Number: USE-8854555.

iii

Page 4: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the
Page 5: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the
Page 6: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Maple is a registered trademark of Waterloo Maple Software.

vi

Page 7: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Getting Started Introduction to Maple

In this section, our goal is to introduce the Maple environment and to present somesimple commands. After working through this section, you should be familiar with thefollowing concepts.1. How to communicate with Maple.

- The Maple worksheet.- Maple input, output and text fields- The prompt character.- Terminating a command with a colon or a semicolon.- Enter a command by pressing the enter key, not the eturn key.

2. Working with mathematical expressions.- How to enter mathematicalexpressions.- How to enter Greek letters and pi- Assignment- Grouping Terms with Parentheses.- Built-in Functions- Plots and Animations

Maple is often used in an interactive mode in which you enter short commands and itresponds with the answer. The worksheet you get when you start the Maple applicationis the environment in which this interaction goes on.The Maple worksheet is composed of threefiields.1. Input Fields 2 . Output Fields 3 . Text FieldsInput fiields are where you enter your commands and the output fields are for Maple'sresponses. Text fields are where you can write comments and place graphics. In yourCD ROM version of this text, Maple input is always denoted in blue and the output inred.Double click on the Maple application's icon and wait for the prompt. When youstart Maple you will get a blank worksheet with the prompt displayed andfollowed by the blinking cursor:

Page 8: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Getting Started Introduction to Maple

Enter the following

command: 2/4;

Your worksheet should look something like this:

2

Page 9: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Getting Started Introduction to Maple

Mathematical expressions can be combined by adding, subtracting, multiplying, dividingor exponentiating them. All of these operations can easily be carried out in Maple. Hereare some simple examples all of which yield 20 when entered into Maple. Try them!3*4 + 8; 12 + 2^3; 22 - 2; 100/5;Exponentiation is indicated by the symbol ^Multiplication is indicated by the asteriskDivision is indicated using the symbol /Addition is indicated using the symbol +Subtraction is indicated using the symbol -

Explicit use of the multiplication sign is always required!

Probably the most common error we have seen students make is to forget to write outthe multiplication symbol. If we wish to double the quantity x, only one of thefollowing commands will work. Which one works and which one gives the errormessage?

2x;

2*x;

Page 10: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Getting Started Introduction to MapleNow, can you tell which one is which? The term pi is just a Greek letter, while theterm Pi is equal to the ratio of a circle's circumference to its diameter.Using the student version of Maple you can calculate decimals up to 100 digits inlength. To increase the number of digits, use the Digits command. Enter the followingcommands:

Digits:=50: evalf(Pi);

this yields the value:

3.1415926535897932384626433832795028841971693993751That's a lot of digits of pi!

AssignmentsIn Maple you can assign a name to a quantity or mathematical expression using theassignment operator. This operator is obtained by entering a colon followed by anequalsign (:_). When we assign a value to a name, all subsequent occurances of that namewillcarry that value.For example, after entering the assignments:

x:= 2: y := 3:

the command:

Page 11: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Getting Started Introduction to Maple

Maple knows almost every function you will ever encounter. Here is justa small sampling of the thousands of functions built into Maple.Trigonometric and hyperbolic functions:

sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth

Inverse trigonometric and inverse hyperbolicfunctions:

arcsin, arccos, arctan, arcsec, arccsc, arccot, arctan, arcsinh, arccosh,

arctanh, arcsech, arccsch, arccoth

To find more of these functions, you can use the question mark ? to invoke the on-linehelp. Enter the following command and peruse the great number of initially knownfticntions.? inifcns

This calls up a help window for the initially-known mathematical functionsUsing these built-in functions we can create even morefunctions. Enter the following command:restart:

5

Page 12: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

We can also create way cool animations. Enter the followingcommands:g := exp(-k*t) * sin(Pi*t): with(plots): animate(g, t=0..10,

k = 0..1);

Each time you encounter a new Maple command, you should get to know it a littlebetter by using the on-line help. This is envoked by positioning the command after aquestion mark and entering. Find out more about the animate command by entering thefollowing line.? animate

Select some of the examples given in the animate help window, copy them and pastethem into your Maple worksheet. Now have fun creating animations for the rest of thisintroduction.

Page 13: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve Equations

Many problems in science, engineering and mathematics involve finding the roots ofone or more equations. When these equations are simple, it is best to solve them withpen and paper; but for more complex problems, it is usually best to do the modeling on acomputer. Maple has two commands solve and (solve that are especially suited to the taskof solving the kinds of equations encountered by engineers and scientists. Here is howeach command is used.

solve(equation, variable) - solves an equation exactly forthe unknown variable:

fsolve(equation, variable) - solves an equation approximately for the unknownvariable using floating point arithmetic.

Skills - After working through this exploration, you should be able to:

1 . solve equations using either the solve or fsolve command.2 . solve a quadratic equation and select one root or the other.3 . understand why sometimes the command solve returns no roots.4 . find all the roots of any polynomial using the allvalues command.5 . find numerical approximations to the roots of any equation using fsolve6 . find the solutions of systems of equations.7 . use either the solve or f solve command to investigate applied problems.8 . solve systems of equations and identify intersection points by clicking on the screen.

Using Maple's solve command, find the solutions to each of the following equations.a. 2x = 4 b. ax = b c.ln(1+x) = a

Solutions using Maplea . To solve the equation 2x = 4 enter either of the following commands:

solve(2*x = 4, x); yields the answer 2

Page 14: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve EquationsOr more succinctly,solve(2*x = 4); yields the answer 2

Notice when there is only one unknown (one variable and no symbolicconstants), explicit declaration of the variable to be solved for is optional.

6 . To solve the equation ax = b enter the command:solve(a*x = b, x); gives b/a

The above example reveals the difference between conventional mathematicalsoftware and the symbolic algebra systems. Notice that Maple found thesolutions even though the constants a and b have not been assigned numericalvalues.

c . To solve the equation ln( l+x) = a enter the command:

solve(ln(1+x) = a, x); gives ea – 1

Thus we see that Maple can even solve equations involving logs andexponentials.

Page 15: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Using Maple's solve command, find the solutions to each of the following equations.

a . sin(x) = 0 b . x + 1 = x c .Ox = 0

Solutions using Maple

a. To solve the equation sin(x) = 0 we try entering:

solve(sin(x) = 0); which only gives 0

However, a quick plot of the sine function revealsthat there are many more roots which have notbeen found!plot(sin(x), x=-3*Pi .. 3*Pi);

Exploration 1 How to Solve Equations

As above, the two roots can be referred to separately using the squarebracket notation for the elements of a sequence.

Warning - The solve command does not always find all the roots.b .To solve the equation x + 1 = x we try entering:

solve(x+1 = x, x); but nothing seems to happen!Obviously, the above equation has no roots.How could any number be one more thanitself?When solve is unable to find any solutions, it returns the NULL expression.This may mean that there are no solutions as in this example or that solve wasunable to find the solutions as we will see in a later example.

c .To solve the equation Ox = 0 we try entering:

9

Page 16: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve Equations

solve(0*x = 0); but only get the nasty error message:

Error, (in unknown) improper op or subscript selector

What do you suppose this nasty error message indicates?Does this equation have roots, and if so, identify all theroots.

What's going on? Evariste Galois, a young French mathematician (born Oct. 25, 1811,died May 31, 1832) showed just before he was killed in a duel that it is impossible tosolve general polynomials of degree higher than four by algebraic means alone. Thequintic polynomial in this example has degree five and so even Maple cannot find itsroots exactly. However, there is no obstacle to finding numerical approximations to thesolutions using the allvalues command as follows.

allvalues(y);

-2.038495291 , -.7907343035 , -.2758341933 , 1.150984173 , 1.954079615

The allvalues command will estimate all the roots of apolynomial numerically. In this case there are fivereal roots as can be seen by graphing the quinticpolynomial using the plot command.

plot(x^5 - 5*x^3 + 4*x + 1,

x=-2.25 .. 2.25);

10

Page 17: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve Equations

Use both Maple's solve and f solve commands to find the two roots of the equation:

How do these commands differ in the way in which they find the roots?Solutions using MapleAs you work through this example, focus on the difference between the commands solveand f solve. (The f in f solve is a mnemonic for floating point arithmetic.)

The solve command gives the exact answers, whereas the f solve command only gives floatingpoint approximations to the exact values. We can make the approximations as close as we like byincreasing the value of the global variable Digits. Suppose we would like the value of the roots to50 digits - a task well beyond most pocket calculators. Just enter the following commands:

Digits .= 50:fsolve(x^2 - x - 1 = 0, x);

and voila, Maple finds the roots to 50 digits!

-.61803398874989484820458683436563811772030917980576,

1.6180339887498948482045868343656381177203091798058Unfortunately, our student version of Maple is limited to 100 digits. Theprofessional version can give thousands and thousands of digits!

Historical note:

The positive solution of the above polynomial (- 1.618) is called the golden ratio and isdenoted by the Greek letter Ø. The golden ratio arises in the Fibonacci sequence and is very usefulin numerical analysis. The ancient Greeks thought that the most perfect rectangle aesthetically wasone in which the ratio of its length to its width equaled the golden ratio. Such golden rectanglesappear frequently in Greek and Renaissance art and architecture.

11

Page 18: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve Equations

Why would we ever need to use the f solve command when the solve command gives theexact answer? The following problem gives a very compelling answer to this question.

Maple Solution

First use the restart command to unassign any variables and to reset the Digits to thedefault number.To find the root we first try the solve command:

solve(exp(x)+sin(x)-2 = 0, x);

but this gives either a NULL expression or the nasty messageError, (in solve) STACK OVERFLOW found

Not much help!

Using the solve command, Maple failed tofind any solutions to the above equation.But let us plot the function and see if wecan spot any hidden zeroes. The followinggraph was produced by entering thecommand:plot(exp(x)+sin(x)-2, x = -5..2);

The graph reveals that there is indeed asolution between 0 and 1, but thatMaple's solve command failed to find it!

In such cases one should always try the command fsolve which uses numerical methodsto approximate solutions for which solve cannot find an exact expression. Let's try it.

fsolve(exp(x)+sin(x)-2 = 0, x);

.4486719164

At last! We've found the solution. Although an exact expression for the root could notbe found with =lye , an approximate solution has been ferreted out using the commandfsolve. By increasing the number of digits using the Digits command, we can find theanswer to as many floating point places as we like.

Digits := 20: fsolve(exp(x)+sin(x)-2 = 0, x);

.44867191635127271149

12

Page 19: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve Equations

Although the answer is not exact, it is as close as we could possibly desire. If we arewilling to settle for an answer which is not exact but which is close to the desired value,we will at least get an answer! Thus, being close counts not only in horseshoes but alsoin solving equations.

We can just as easily solve a set of simultaneous equations for one or moreunknowns. The only new thing here is to remember to enclose the set of equationsand the set of unknowns in curly brackets { } as illustrated in the solution to thisexample.Find the point of intersection of the two lines 2x + y = 4 and x + 2y = 5.

SolutionTo solve a set of equations for a set of unknowns, the equations and the unknownsare enclosed in curly brackets. These curly brackets { } are how Maple denotes sets.Entering the commands:

restart: solve({2*x+y = 4, x+2*y =5},{x,y});

returns the solution: (x = 1, y = 2 )We can verify the solution graphically by plotting the two linessimultaneously.

plot( {4-2*x, (5-x)/21, x=-2..3);

A line of slope one through the left focus intersects the ellipse at two points.Find the points where the line intersects the ellipse using the following approach.First graph the ellipse and line simultaneously, and then find the coordinates of theintersection points by clicking on them with the mouse.

Maple Solution

Enter the known information about the ellipse.

E1 := x^2/2500 + y^2/ 900 = 1:

Now enter the known information about the line. Since it has slope one and goes through thepoint (-40,0), its equation is y = x + 40. Enter the equation of the line into the Mapleworksheet.

13

Page 20: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve Equations

E2 := y = x+40:

A simple way to estimate the coordinates of a point of intersection is to create asimultaneous plot of the line and the ellipse. On the Macintosh, a simple click with themouse on a point of intersection will display its coordinates on the computer screen.

with(plots):implicitplot( {E1,E21}, x=-50..50, y=-50..50,

scaling=constrained);

The resulting screen display is shown tothe right. The coordinates of theintersection point P will be displayed onthe screen by positioning the tip of thecursor (arrow) at this point and clickingthe mouse.

Clicking with the mouse on theintersection point P we see from theresulting displaythat its coordinates are about P = (-11,29). The last few digits obtained in this wayare not significant due to the difficulty inexactly positioning the cursor over theintersection point.

Page 21: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve Equations

1. Use Maple's solve command to find exact expressions for the roots of each of thefollowing equations. Plot each function to confirm that you have found all.the

2. Use the solve command and the allvalues command to find the roots of thefollowing two quintic polynomials. Graph each polynomial over an appropriatedomain using the plot command to reveal all the real roots. Can you find a relationbetween the roots of the two polynomials?Hint: Consider the substitution x → 1/x.

4 .Find all real root(s) of the following equations to 30 floating point digits.To increase the number of Digits to 30, use the command:

Digits := 30;

Graph each function to be sure no roots are missed. Use the help facility tolearn how to make the f solve command look for solutions in a given interval.

a. Find the other point by the same method.

b . Now find the exact values of the intersection points using the solve commandand the allvalues command. Compare the exact value to the value you found byclicking on the screen.

Page 22: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve Equations

Please use the restart command before continuing to clear any assigned variables andto reset the number of digits back to the default.

The following exercises are designed to show how the Maple commands solveand fsolve can be used to investigate some applied problems.

Let x denote the mole fraction of water that has dissociated, and let k denote theequilibrium constant for this reaction. If p is the total pressure (in atmospheres)of the mixture then the mole fraction x is given by the equation:

16

Page 23: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 1 How to Solve Equations

Naturally, a cautious engineer would like to monitor the amount of dangerous H2gas formed. Find the mole fraction x if k = 0.045 and the total pressure is p = 2atmospheres.

Note this problem requires solving a cubic equation for x and Maple finds allthree roots of this cubic. However only one of these roots is physicallyreasonable. Which one?

11. Newton's Law of Cooling states that the rate of cooling of an object is proportionalto the temperature difference between it and its surroundings. Although refreshinglysimple to state, few other equations are as important to so many branches ofengineering. Newton's Law of Cooling implies that the temperature of the objectsatisfies:

a. In terms of the constant k, how long does it take for the temperature difference todecrease to one half of the initial difference?

b. How long does it take for the temperature difference to decrease to one quarter of theinitial difference?

12. Structural and Shape Mills In the steel industry, semifinished steel in the form of ingots, billets and blooms is reheated to a temperature of about 1200 °C and is then processed into finished products using a variety of rolling mills. Blooms and billets may be rolled directly on mill rolls that have been shaped and grooved to manufacture specific products - rails, tubing and pipe, and I and H beams.

Rails are rolled from heated blooms that haveto meet very strict quality specifications. Thetemperature of the rails is monitored as theycool. After one hour the temperature hasdecreased to Tl = 600°C, after two hours thetemperature is T2 = 300°C and after three hoursit is T3 = 150°C.

17

Page 24: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

18

Page 25: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 2 Functions

In the story of mathematics, functions are the main characters, sometimes playing thevillain, but usually the hero. Most problems in engineering and science involve findingfunctions which reIate observed variables or predict the behavior of processes. In thisexploration we will show how to define functions in Maple, plot their graphs andexplore some symmetries of functions. After mastering this exploration, you should beable to:

1. define functions using the arrow notation ( -> ).2. convert an expression into a function using the makeproc command.3. define piecewise functions using the if statement.4. map a function onto a set or list of values using the map command.5. Find the even and odd components of a function

In Maple, the arrow → must be entered by typing two separate keys.First type a dash - to represent the tail of the arrow and then create the tip of the arrowby pressing the right angular bracket > which is on the same key as the period. (Holddown the shift key and press the period.)

Open a new Maple worksheet and wait for the prompt to appear. Recallthat the prompt indicates that Maple is ready to do work for you.

Using the arrow operator, we can define the function f with the following command.

19

Page 26: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 2 Functions

We can now evaluate the function f at any point.

f(0); f(1); f(2);

2 6 12

The graph of the function can easily be obtainedusing the plot command. To plot the functionover the interval from x = -10 to x = + 10 enterthe command:

plot( f(x) , x= -10 .. 10);

The graph is clearly a parabola.

In a previous exploration, we showed how to work with expressions inMaple. Often such an expression may represent the value of a function:

A common mistake.There is often a need to convert an expression generated in Maple into a function,and this brings up the tricky point illustrated below. Type the following commandsinto Maple and before you enter them predict what the output will be.

If the expression is not complicated then the easiest way to convert it into a function isto simply retype it. For example:

20

Page 27: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 2 Functions

f := x -> 1 + 2*x + x^2: f(0); yields 1But what if the expression is very complicated so that retyping it is not an attractiveoption? This often happens when we are modeling realistic problems. In the studentlibrary there is a convenient command for this called makeproc which as its namesuggests is useful in making expressions into procedures or functions.The command g := makeproc(y,x) will define a function g of the variable z with outputequal to y where y is any expression involving x.

with(student): g := makeproc(y,x): g(0); yields 1

Often in engineering and science it is important to work with piecewise definedfunctions. A piecewise function is defined by different ruIes on different intervals inits domain. As an example, consider a summer job that normally pays $20 per hour butwhich offers an overtime pay of time and a half for each hour beyond 40 hours. Thepay, expressed as a function f of the number of hours t worked is:

Piecewise functions can be defined in Maple using the if statement asbelow.

f := t -> if t < 40 then 20*t else 30*t-400fi;

In Maple, the word if denotes the beginning of a conditional statement and the endof the statement is denoted by the terminator fi. A common mistake is to forget thisimportant terminator.Now define a sequence giving the pay for three employees who have worked 30 hours,40 hours and 50 hours respectively.

f(30), f(40), f(50); yields 600.800.1100Defining a piecewise function using the if. . .then. . .else. . . fi conditionalconstruct requires that the function can evaluate the condition. Thus when weenter: f (t); we get the error message:

Error, (in f) cannot evaluate boolean

This is because if we don't tell Maple what the variable t is, it is unable to decidewhether t < 40. The condition t < 40 is called a Boolean condition, hence the aboveerror message. This is an important point when it comes to plotting piecewisefunctions. For example, in order to obtain a graph of an employee's pay as a functionof the number of hours worked one might try the command:

plot( f(t), t= 0 .. 80);

21

Page 28: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 2 Functions

but instead of a graph we get the saine nasty error message:

Error, (in f) cannot evaluate boolean

The problem is that Maple tries to evaluate f (t)without knowing the numerical value of t. Toprevent this premature evaluation of theBoolean condition t < 40 used in the functionf, we enclose the function f (t) in single quotesas shown below.

plot( 'f(t)', t= 0 .. 80);The resulting plot is shown to the right.

Often we would like to apply a function to a set of input values. This iseasily done with the map command as illustrated below.

Let us first enter the set of radii and define a function A to compute the area .R := {1, 3, 4, 6}: A := x -> Pi * x^2:

We can now use the moo command to apply the area function to every element in the set of radiias follows.

Every function can be written as the sum of an even and an odd function.

Definition

A real function f(x) is said to be even if it satisfies the equation f(-x) = f (x)for all points x in its domain. Geometrically this means that the graph of thefunction does not change if it is reflected in the y -axis.

22

Page 29: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 2 Functions

A real function f(x) is said to be odd if it satisfiies the equationf (-x) = f (x) for all points x in its domain. Geometrically thismeans that the graph of the function does not change if it is reflectedthrough the origin.

The following equation gives a simple formula for expressing any function as the sumof an even and an odd function.

Maple Solution

Clear any assigned variables with the restart command and enter the polynomial as afunction of x using the arrow operator.

Notice that the even component consists of all the even powers of the polynomial andthat the odd component (- 2x) consists of the only term which is an odd power of x. Thesum of the even and odd functions is indeed f.

23

Page 30: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 2 Functions

24

Page 31: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 2 Functions

Create a simultaneous plot of the functions f (x), g(x), f(x) + g(x) and f x) - g(x).Which of these functions has a linear graph?

3. The radii of four steel ball bearings were measured giving the dataR = (0.5, 0.6, 1.0, 1.2 ). Find the volume V and mass M of each ball bearingby first defining volume and mass functions and then applying these functions tothe set R of radii using the map command. The density of steel is about 7.9 gramsper cubic centimeter.

5. A company pays new employees $15 per hour if the time worked is less than 35hours a week, and double for every hour beyond 35 hours.

a. Define a piecewise function giving the pay as a function of the hours worked.

b. Each Friday the seven junior members on the company's payroll eagerly awaittheir weekly paychecks. (TGIF)! The number of hours worked by each arecollected together in the following set:

Hours = ( 20, 30, 40, 48, 50, 80, 100)Use the map command to find the amount of each worker's weekly paycheck.

6. Highway Design - Highway engineers must often join different portions ofroadways having different slopes. Usually the connecting portion is designedwith a parabolic profile. The parabola is chosen so that the height and slope of theroad remains continuous avoiding jars and shocks.

25

Page 32: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 2 Functions

The resulting profile of the highwaysurface is given by a function definedseparately over three intervals.

a. In Maple, define a piecewise function f giving the highway's profile as a functionof x. When a function is defined in more than two pieces as in this exercise, youwill need to use the if statement in the form:

if ... then ... elif ... then ... else ... fi

If you need more help on the if statement, type ? if

b. Plot the function from x = -100 to 1200.Hint: Avoid premature evaluation of the argument f(x) in the plot command byenclosing it in single quotes as in the "summer pay" example.

8. Find the even and odd components for each of the following functions andshow

26

Page 33: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

27

Page 34: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Our goal in this exploration is to enable the student to calculate derivatives of any orderand of any function no matter how complicated. We then use these derivatives toinvestigate a number of applied problems.

Few problems in engineering and science are solved without taking a derivative or twosomewhere along the way. For simple polynomial or trigonometric functions, thederivative is best worked out by hand. But realistic problems are often so complex thathelp from a computer is sometimes essential. The point we wish to stress, is that usingMaple, you will be able to calculate the derivative of any function you are likely toencounter as an engineer or scientist. The syntax of the differentiation command isillustrated in the highlighted box.

Differentiation using Maplediff(y,x);

Calculates the derivativeof y with respect to x.

Skills - After completing this exploration you should be able to:1. Find the derivative of any explicitly defined function no matter how complicated.2 . Find derivatives of any order and of any explicitly defined function, by repeating

the differentiation variable or by using the sequence operator.3 . Find the derivative of an implicitly defined function.4 . Calculate the velocity, acceleration and jerk of any particle.

28

Page 35: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 3 How to Calculate Derivatives

We now give a number of completely worked out examples which show howderivatives can be calculated using Maple.

Maple Solution The command diff(expr,var) finds the derivative of the expression exprwith respect to the variable var

29

Page 36: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Many problems in mechanics involve finding the velocity, acceleration and jerk of anobject. Since these physical quantities correspond to the first, second and thirdderivatives of the object's position, the d if f command can be used to find all three.

30

Page 37: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 3 How to Calculate Derivatives

Maple Solution

Let's first restart and then plot the object's position x asa function of time.

restart: x .= exp(-t) * sin(2*t):

plot(x, t=0..10);

The graph clearly reveals that the motion of this particleis highly damped.

The velocity is the time derivative of the position.To find the velocity using Maple, enter thefollowing command:

The jerk is the third derivative of the position. Rather than writing out thedifferentiation variable three times, let us use the , sequence operator $.

To obtain a simultaneous graph of theposition, velocity, acceleration and jerk weuse the plot command.

plot({x,v,a,jerk}, t=0..10);

31

Page 38: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 3 How to Calculate Derivatives

Maple Solution

Restart to clear any assigned Maple variables then enter the implicit equation for the circle.

restart: f := x^Z + y(x)^2 - 25 - 0:

Notice how y's dependence on x has been indicated explicitly by writing y (x) .

Next differentiate the function f with respect to x and label the resulting equation Eqn.

32

Page 39: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 3 How to Calculate Derivatives

a. Verify using the limit command that this function is continuous at x = 0.

c . Based on your observations, predict the va1ue of the nth derivative of thisfunction at the origin and then do additional experiments to test yourpredictions.

33

Page 40: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 3 How to Calculate Derivatives

6 .A race car is speeding along a circular track of radius 1 mile.The circular track can be described mathematically by the equation:

Unfortunately at the point (a, b) there is an oil spill on the track which causesour driver's car to lose traction and fly off along the tangent line to the curveat this point. Find the equation of the tangent line.

34

Page 41: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 4 Discover-E

The goal in this computer exploration is to discover the numerical value of Euler'snumber e using a graphical approach. (Later we will show how numerical techniquescan be used to find the value of a with much greater efficiency.) However, our purposehere is to build a graphical intuition about the number e.

Thus the derivative of any exponential function is a constant multiple of itself.

We called k a constant because it does not depend on x - however it does depend on theexponent a. The number a is defined as that exponent which sets k equal to 1. That is,Euler's number a is defined as the unique number satisfying:

As an immediate consequence of this definition we

Using the Intermediate Value Theorem, it can be shown that such a number a doesexist. But what is the numerical value of e? In this discovery, we use a graphicalapproach to discover the value of Euler's number e.

35

Page 42: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 4 Discover-E

After this background, we are ready for some worked out examples.

Maple Solution

In Maple, Euler's number a is denoted with a capital letter E.

Thus we can create the simultaneous plot with thecommand:

plot( { E^x, 1+x }, x=-1..1);

The resulting graph is shown to the right andconfirms that the line is tangent to the exponentialfunction.

Note that Maple is case sensitive so that Euler'snumber a must be input as the capital letter E. (Ifyou use a small letter e, you will get an error.)

36

Page 43: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 4 Discover-E

plot( {2^x, 3^x, 4^x, l+x}, x = 0 .......1/10);

The graph clearly revealsthat the Euler's number emust lie between 2 and 3.

This resulting graph more clearly reveals thatthe value of a lies between 2 and 3.

37

Page 44: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 4 Discover-E

Using the above horizontal test, we canhome in on the value of a to as manydigits as we like, but it can become a littletedious. We have written a little programthat plots several guesses for e at the sametime. Each time we use it, we candiscover another digit of e. The simpleprogram Discover_E is a procedure oftwo variables (c and d).For example:

Discover-E(2, 3);

This command, divides the intervalfrom 2 to 3 into ten equal steps thuscreating all the following guesses:

{2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0}

Enter the following code for Discover_E into a Maple session. All theremarks after the # symbol on a given line are just comments and areignored by Maple.

Discover_E := proc(c,d)

# This procedure generates guesses for Euler's number e

# between the values c and d in ten equal steps.

# For each guess "a" it plots the function y = a^x - (1+x)

# The best guess is the one whose graph appears to be

# the most horizontal.

Title := cat('Testing exponents between ', convert(c,string),

and ', convert(d,string) );

plot({(c + (d-c)*j/10)^x - x - 1 $ j=O..10},

x = 0..(d-c)/1000, xtickmarks = 0, title = Title );

end;

38

Page 45: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

1. The pound sign # is Maple's way to make comments. Everything following thepound sign on any line is ignored. However, it is extremely important to includesuch comments in your code as documentation.

2 . The command proc is used by Maple to define procedures.The end of very procedure must be explicitly declared by typing end.

3 . We have also used the sequence command $. For example:

k^2 $ k = 1 .. 4 ; yields 1, 4, 9, 16

4 . The cat command stands for concatenation and is used to generate the titleappearing on each graph.

Exploration 4 Discover-E

39

Page 46: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 4 Discover-E

1. In the Step by Step example, we saw that Euler's number was somewhere in theinterval 2.7 < e < 2.8 using our Discover -E procedure.

Enter the code for the Discover_E procedure. Then findthe next decimal of a using the command:

Discover-E(2.7, 2.8);

Inspect the resulting graph to identify which guess has the most horizontal graph.

2 . Repeat this process to find the third digit of Euler's number to the right of thedecimal point.

3 . Repeat this process to find the fourth digit of Euler's number a to the right of thedecimal point.

4 . Increase the number of Digits to 30 by entering the command: Digits := 30:Then find the value of a to eight digits to the right of the decimal point by repeatedlyusing the Discover -E procedure and identifying the guess which is the mosthorizontal.

5 . Our technique for finding Euler's number is visually very appealing and createsbeautiful graphs that resemble the spectrum of light formed by a prism. However,there are more efficient ways to find the value of e. Euler's number can also bedefined as the limit of a certain series of numbers.

Increase the number of Digits to 50 and then obtain floating point approximations for eusing N = 10, 20, 30, 40, 50, 60, 70, 80, 90 and 100.

Hint: - To add up these terms, use Maple's sum command to define the function:

Then calculate the desired values using:

Digits := 50: for k from 1 to 10 do evalf(Euler(10*k)) od;

40

Page 47: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 5 Functions Under the Microscope

Key advances in science and technology have often come from carefulexamination of specimens or images with a microscope. Discoveriesmade this (or a similar) way include the cell theory, chromosomes,neurons, the moons of Jupiter, quasars and possibly black holes! Itshould be no surprise then that when we look closely at functions`under the microscope' a number of great discoveries can be made. Inthis sense, mathematics can be viewed as an experimental science.

Placing a mathematical function under the microscope means zoomingin on its graph about some point. By adjusting the scale of the x and yaxes, we can magnify the graph of a function without limit. We nowderive some equations which govern how images change whenmagnified.

Magnification about the origin.

Suppose a function y = f (x) is graphed on a piece of paper or a computer screen and let (x, y) be anypoint on the graph of the function If we now double the size of the image, then the point (x, y)corresponds to the new point (X, Y) = (2x, 2y). The set of all points (X, Y) corresponds to the originalgraph doubled in size. Is the new graph the same function? The answer depends on how we label theaxes. If the numerical value of each tick mark along the axes is divided by 2, then the enlarged image isstrictly just another representation of the original function and this is the usual convention. However, ifwe adopt this convention, we have no way to describe the magnification of graphs. In this explorationwe adopt a different perspective. Most graphs are displayed on a planar surface such as a piece of paperor a computer display. We introduce absolute coordinates (X,Y ) on the display page. These absolutecoordinates could correspond to pixels on a computer display or to the coordinates of a grid drawn onthe paper once and for all. Once we have chosen these coordinates they will never be changed even if afunction is magnified. To describe this situation, we will need expressions for the new function which isdisplayed when a given function is magnified under the microscope. In the case of the doubled imageabove, the new function has the graph (X, Y) = (2x, 2y)

So we see that in absolute coordinates the new graph corresponds to a new function. Similarly, ifwe had enlarged the image by a magnification M instead of 2, the displayed image will correspondto the new function:

When the magnification is M = 1, then we just get the original function back.

41

Page 48: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 5 Functions Under the Microscope

With this equation we will be able to zoom in on the graph of a function about anypoint on its graph.

The Standard PageFor the remainder of this exploration we will define a standard page as a 20 by 20square centered on the origin and extending from -10 to 10 along both the X and Yaxes as illustrated by the shaded region in the example below.

42

Page 49: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 5 Functions Under the Microscope

The resulting plot clearly reveals that the graph of the second function is double the sizeof the first The shaded region shown above corresponds to the standard 20x20 page sizewe have chosen for this exploration. Those points which have spilled off the standardpage will not be seen in subsequent examples.

a. Create a simultaneous plot of the cubicfunction at normal magnification andwhen magnified 2x and lOx aboutthe point x = 0, by entering thefollowing commands.

f := x -> x^3/100 - x;plot({f(x), 2*f(x/2), 10*f(X/10)},

X=-10..10, -10..10,

scaling=constrained);

The resulting graph shows that under increasing magnification, the image rapidlyapproaches a straight line. At IOX, the image seems indistinguishable from a straightline. As we explore more functions you will see that this is fundamental property ofmost functions.

Under high magnification, the graph of many functions approaches a straightline. If it does, the slope of this line is called the derivative of the function atthat point.

b. Estimate the derivative of our function at the origin by finding the slope of the line through the two points indicated on the lOx image..

43

Page 50: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 5 Functions Under the Microscope

The coordinates of the endpoints of the line will bedisplayed on your computer screen if you click onthem with the mouse. Find these coordinates and thenuse the definition of slope.

Clicking with the mouse on the above endpoints we obtained thecoordinates:Upper left endpoint: (-10.04, 9.916 )Lower right endpoint: (10.04, -9.916 )Because of the difficulty of clicking in the same place twice, you mayobtain slightly different values. The slope of the line through theseendpoints is:

slope := (9.916-(-9.916)) / (-10.04-10.04);

slope := -.9876494024

c. Obtain a formula for the image when the above cubic function is magnified Mx about the origin. Use the limit command to show that the limit of thisfunction as M goes to infinity is a straight line. Compare the slope of this lineto the value you estimated in part a.

This shows that under very high magnification, the image of the cubic approaches aline of slope -1. The value -1 is the derivative of the cubic at x= 0.

Notice that the point (xo, yo ) = (2, 4) is translated to the origin (0, 0) of the absolutecoordinate system. When we zoom in on a point, it appears at the center of the field ofview.

What is the corresponding function if we magnify about this point with magnification M?

44

Page 51: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 5 Functions Under the Microscope

Notice that as we increase the magnification, the quadratic term tends to zero leaving usa line of slope 4. Thus 4 is the derivative of the quadratic at the point x = 2. Let uscheck this by taking the limit of the right hand side (rhs) of the above expression.

limit(rhs("), M=infinity); 4 x

Thus, under very high magnification (around the point x = 2, y = 4), the image ofthe quadratic function approaches the line y = 4x, whose slope is 4.

The zoomed image is thus a function F of three variables: x, M and xo.

Treating the magnification factor M as a parameter we can use the animate command inthe plots library to create fascinating Zoomations.

First enter into Maple the initial function y = f (x) and define F to be the equation of themagnified image. (Notice F is a function of three variables.)

f := x -> x^2:F :_ (x,M,xO) -> M *(f(x0+x/M) - f(x0)):

We will now create the animation using the animate command. Below, x = -10. . 10indicates the range of the independent variable x and M= 1. .40 indicates themagnification range. The optional argument frames = 40 specifies that the animation isto contain 40 frames (or cells).

45

Page 52: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 5 Functions Under the Microscope

with(plots):A := animate( F(x,M,1), x = -10..10, M= 1..40, frames = 40):

Be sure to terminate the above line with a colon - do not use a semi-colon or Maplewill print out the entire animation data structure. (This will dump screen after screenof annoying numerical data onto your computer terminal.) We now display ouranimation with various plotting options.

display(A, view = [-10..10, -10..10],scaling = constrained, color =

blue);

Note that the view = [-10. . 10, -10. .10] option displays only that portion of theimage within our standard page. After a little wait, the first frame of the resultinganimation should appear. Clicking on the play icon will then display your movie(see figure).

46

Page 53: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 5 Functions Under the Microscope

Please work through all the Step by Step examples before attempting these exercises. Thisis a challenging exploration and it will save you time in the long run.

1. In the examples, we zoomed in on the graph of several functions and saw that inthe limit of very high magnification, the graph of each function approached astraight line. The slope of this line is called the derivative of the function at thatpoint. Do all functions approach a straight line under sufficiently highmagnification? Let us try to find the answer by an experimental approach. Belowwe give a list of many functions. For which of these functions does the graphabout the origin approach a straight line under high magnification?

Be sure to use the options scaling=constrained and display the results on ourstandard 20x20 page defined by the ranges x=-10..10 and y=-10..10

2. Each of the following functions has a derivative at the indicated point. Find thederivative of each by magnifying the image and then using the limit commandwith the option M=infinity as in the Step by Step examples.

47

Page 54: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 5 Functions Under the Microscope

b. Under increasing magnification, the image rapidly approaches a straight line.Use your plot to estimate the slope of this line by clicking on the endpoints ofthe straightest image.

c. Obtain a formula for the graph when the above quartic function is magnifiied M xabout the origin. Use the limit command to show that the limit of this functionas M goes to infinity is a straight line. What is the slope of this line?

5. Each of the following functions is defined by a formula which breaks down at thepoint x = 0. Thus the definition of the function at the origin must be given as aspecial case. In Maple, these functions can be defined using the if statement.For example, the function in part a can be defined as:

f := x -> if x = 0 then 1 else sin(x)/x fi;

Zoom in on each of the functions about the origin and see whether or not itsgraph approaches a straight line.

6. We have written a somewhat more fancy zooming command and placed it in the"Maple Explorations Folder" on the Drexel Curriculum CD ROM. You canobtain it by reading in the file zoom. m located in this folder. The matchingReadme document tells you what it does. Open this document and go through theguided tour of some more exotic zoomations that we have devised.

48

Page 55: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

49

Exploration 6 Ballistics - The Human Cannonball

An object shot into the air will trace out a parabolic trajectory if we ignore the affectsof air friction, spin and the variation of the gravitational constant with height. Theseassumptions seem appropriate in the case of a human cannonball.

where g is the acceleration of gravity and (xo, yo) denotes the location of thecannon. We will assume throughout this exploration that (xo, yo) = (0, 0).

If T denotes the time of impact, then these equations are valid over the interval 0≤ t ≤ TIn this exploration our goal is to investigate parabolic trajectories. We will return tosuch investigations more than once.

Page 56: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 6 Ballistics - The Human Cannonball

T := fsolve(y(t) = 0); T:= 0 , 2.040816327Maple returns two solutions because there are two times when the height is zero - atthe beginning and at the end. Thus impact occurs at about 2.04 seconds. Since T is thetime of impact, we only want the second solution. This solution can be selected usingthe square bracket notation.

T := T[2] ; T:= 2.040816327

Next obtain a complete parametric graph of the performer's flight using theplot command.

plot([x(t),y(t), t=O..T ], color = blue, scaling=constrained);

The horizontal range R of the human cannonball is defined as the x value at the timeof impact (assuming xo = 0 ). From the above graph it appears to be about 35 meters.To find the precise value we enter:

R := evalf(x(T)); R:= 35.34797568

H := y(T/2); H:= 5.102040815

Thus the maximum height H is a little over 5 meters.

Maple Solution

In this case, it will be useful to consider the parametric coordinates x and y as functionsof time and the initial angle a.

restart: v0 := 20: g := 9.8:

x :=(t,a) -> V0*cos(a)*t:

y :=(t,a) -> vO*sin(a)*t - g*t^2/2:

50

Page 57: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 6 Ballistics - The Human Cannonball

We can use the $ sequence operator to define the set of launch angles.

angles := {(Pi/2)*k/20 $ k=1..20}:

plot({ seq( [x(t,a), y(t,a), t = O..T(a)], a = angles)},

scaling = constrained);

Maple Solution

The following code will create the desired animation. Try it!

a := Pi/4: v0 := 20: g := 9.8:

x := t -> v0*cos(a)*t:

y := t -> v0*sin(a)*t - g*t^2/2:

T := a -> 2*v0*sin(a)/g;

with(plots):.

animate([x(f*t), y(f*t), t=0..T(a)], f = 0..l,

scaling=constrained);

51

Page 58: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 6 Ballistics - The Human Cannonball

Estimate the range of initial anglesthat will lead to a safe landing onthe net. That is, what are theminimum and maximum safeangles? Is there more than one safeinterval?

a. Find the initial angle imparted tothe baseball by the visiting hitter.Then create a plot of the baseball'strajectory from the time it left thebat to the point where it wascaught.

3. Baseball - It was the bottom of the ninth, with the home teamleading by one run. The last hope of the visiting team for acomeback was dashed when their best batter lined out. His batstruck the ball at a height of 1.5 meter above the groundimparting an initial velocity vo of 50 meters per second and aninitial angle a to the baseball. Unfortunately for the visitors, aplayer from the home team snagged the line drive at a height of 2meters, a distance of 30 meters from the plate.

52

Page 59: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 6 Ballistics - The Human Cannonball

b. Assume the visiting batter hit apop fly instead of a line drive. In apop fly the ball goes up at a fairlysteep angle. Now find the initialangle and recreate the plot.

4. Create an animation of the two baseball trajectories from the previous exercise byaltering the code given in example 3.

5. When we think of jet propulsion, rockets and fighter planes pop into our heads butnature offers many more examples of this simple technology. In nature's design,jet propulsion involves imparting momentum to a fluid (usually water) bysqueezing the fluid through an orifice or tube. Our own heart and stomach aretypical examples as is the squid which can propel itself at speeds up to 15-20 mph(pretty quick for an aquatic animal under a foot in length).

a. In an attempt to escape dolphinsand other predators, a squid can jetpropel itself above the ocean'ssurface to a height of 5 meters.With what speed must the squidleave the ocean surface? Assumethat the squid does not expel anywater after it leaves the ocean.

b. A frightened squid was observed to suddenly emerge from the ocean surface, sailthrough the air along a parabolic trajectory and land a distance of 15 metersaway.What is the minimum possible initial speed of the squid? What initial angledetermines this minimum speed?

53

Page 60: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 6 Ballistics - The Human Cannonball

6. Basketball - The code in thefollowing lines defines a procedurecalled "basketball". Rather thanenter this code by hand, you canread it into Maple with thecommand:

read basketball.m;

provided you first obtain a copyof the Maple file "basketball.m"and place it in the same folder asyour Maple application. This fileis available to our students in theMaple Exploration Folder onthe Drexel Curriculum CD ROM.If you do not have the CDROM,send an E-Mail [email protected] asking forthe "Maple Exploration Folder".We will be glad to send it toanyone who wants one - nostrings attached!Once this code has beenentered, the player specifies thespeed and angle at which theball leaves the hand by enteringthe command:

basketball(speed, angle);

Please be aware that the angle entered must be in radians. Thebasketball hoop is represented by a simple polygon.

Give it a try and see if you can get the ball in the hoop by varying vo and a.

basketball := proc( speed, angle)

# The player inputs the initial speed and angle.

# and tries to get the basketball in the hoop.

# Height of player is y0 = 6 feet

y0 := 6: g := 32: v0 := speed: a := angle: wall := 17:

# The hoop is represented by the polygonal path:

hoop := [[15, 10], [15.5,8], [16.5,8], [17,10]];

with(plots): Hoop := polygonplot(hoop, color = red);

# The path of the basketball is:

x .= t -> V0 * t * cos(a):

y .= t -> y0 + v0 * t * cos(a) - g*t^2/2:

T := fsolve( y(t) = 0, t=1/100..10);

54

Page 61: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 6 Ballistics - The Human Cannonball

ball := animate( [x(f*t),y(f*t), t=0..T], f = 0..l,

color=red);

HOOP := display( [seq(Hoop, kk = 1..16)], insequence =

true);

movie := display({ball, HOOP}, scaling = constrained,

view = [0..17, 0..20], axes

boxed);

# The top secret code follows next.

t1 := solve(x(t) = 15,t): t2 := solve(x(t) = 17,t):

y1 := evalf(y(t1)): y2 := evalf(y(t2)):

if ( y1 > 10 and y2 < 10) then message :_ '

CONGRATULATIONS!!'

else message :_ ' Sorry, you missed.' fi;

Hoop := display({Hoop, textplot([8,15,message])}); ball :=

plot([x(t), y(t), t=O..T], color = red);

last := display({ball, Hoop});

display( [movie, last], insequence = true);

end:

What you should be shooting for is this frame of the animation:

55

Page 62: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 7 Water Jets

Many amusement and theme parks offer dramatic water jet shows in which great arcsof water dance in the air, illuminated by flood lights and controlled by sophisticatedcomputers. The water jets often form breath-taking patterns and are especially dramaticwhen enhanced with lively music. The design of a control system for such water jetperformances is simplified by the fact that each water droplet can be assumed to followa parabolic trajectory through the air, ignoring the effects of air friction, water cohesionand wind.

where yo is the height of the nozzle aboveground level and g is the acceleration ofgravity. (We assume xo = 0 throughout.)

where 0 ≤ t≤ T . Of course, only those droplets which have not yet hit the groundare still in the air.

56

Page 63: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 7 Water Jets

57

Page 64: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 7 Water Jets

This wild and untamed graph has a number of interesting features. First note that on theright, some of the water droplets have already hit the ground but are shown continuingdownwards. The actual height of a water droplet is given by the water jet equation onlyuntil it strikes the ground. After this it remains at ground level y = 0. We can guaranteethat this will happen by using the maximum function which in Maple is written max.

y := (t,T) -> max(0, y0 + v0*(T-t)*sin(thetha(t)) - (g*(T-t)^2)/2);

Reenter the above plot command and verify that now, the water jet is not drawnbeneath the surface of the ground.

Using the animate command in the plots library, we can create a fascinating movie ofthe water jet from example 1. Enter the following command.

with(plots):

animate([x(s*T, T), y(s*T, T), s=0..1], T=0..5, color=blue, numpoints =

200);

A six nozzle mechanism rotates once persecond resulting in six water jets! Createan animation of this spectacular water jetshow.

The six nozzles are equally spaced.

58

Page 65: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 7 Water Jets

Maple Solution

First enter the new parameters.

restart: y0 := 50: v0 := 30: g:= 10:

You can create an animation of all six water jets by entering:

with(plots):

animate({ seq([x(s*T,T,n),y(s*T,T,n),s=O..l], n=1..6) },

T=0..3,color= blue);

59

Page 66: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 7 Water Jets

1. In example 1, the graph of the water jet erroneously showed a portion of the jetbeneath the surface of the ground. Create a graph of the water jet at time T = 10for which this does not happen using the max command.

a. Create a plot of the water jet at the later time T = 5 seconds.

b. The water jet appears to be bounded above and below by two parabolas.Find the equations of these parabolas.

c. Create a simultaneous plot of the water jet at time T = 5 and the two parabolas.

60

Page 67: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 7 Water Jets

61

Page 68: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 8 Cycloids

A cycloid is the curve traced out by apoint on the rim of a circle that movesalong a level surface without slipping.Such curves arise frequently inengineering and applied mathematicsproblems. A typical example is the curvetraced by a point on the rim of a bicycle orwheel.

In 1693, Christiaan Huygens designed apendulum clock whose bob traces out acycloid. For such a pendulum, the periodof oscillation does not depend on theamplitude of the swing.

In this mini-exploration we draw and animate cycloids and discover somegeneralized cycloids in the exercises.

If the circle has radius one, then the parametric equations for the resulting cycloid are:

Cycloidx = t - sinty = 1-cost

To obtain a parametric plot of the cycloid, enter the components x and y and then useMaple's plot command.

x .= t - sin (t): y .= 1 - cos(t):plot( [x, y, t = O..6*Pi], color = red, scaling = constrained);

Next we show how to create an exciting animation in which a point on the rim ofa rolling circle traces out the cycloid.

Assume the center of the unit circle is at the point (0,1) at time 0 and that it translates tothe right at a rate of one unit per second. Thus at time t, the center of the circle will beat the point (t,1). Therefore the parametric equations for the circle at time t are:

62

Page 69: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 8 Cycloids

Notice that the parametric variable is a, not t. To create the animation

of the cycloid, enter the following commands.

N := 40: with(plots):circle animate([t+cos(a),1+sin(a), a=O..2*Pi], t=O..6*Pi,

color = blue, frames=N):cycloid:=animate([s*t-sin(s*t), 1-cos(s*t), s=0..1], t=O..6*Pi,

color = red, frames=N):display({circle, cycloid}, scaling = constrained, axes=none);

A typical frame in the resulting animation is show below.

1. The cycloid has a cusp at each point where it intersects the x-axis.What is the distance between the cusps of a cycloid if it is generated by a circle ofradius r?

2. Create an animation of the cycloid using the commands given in example 2.

3. Suppose that the circle is not moving on level terrain but instead rolls down a hillof slope 1 without slipping. Find parametric equations for the generalized cycloidand create a representative plot. Try other slopes.

4. Suppose the circle rolls with slipping.Find parametric equations for this generalized cycloid and create a representativeplot. Try differ rates of slippage.

63

Page 70: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 9 Hypocycloids and Epicycloids

A hypocycloid is the curve generated by a fixed point P on the circumference of acircle of radius r as it rolls around the inside of a circle of radius R. Consider acoordinate system with the origin at the center of the fixed circle ant let t denote theangle from the positive x-axis to the center of the rolling circle. The parametricequations for the resulting hypocycloid are:

These equations can be derived by considering the location of the moving point Pwhen the center C of the rolling circle makes an angle t with the positive x-axis. Sincethe center of the rolling circle traces out another circle of radius (R-r), the coordinatesof C are:

X = (R-r) cos(t) and y = (R-r) sin(t)

An epicycloid is the curve generated by a fixed point P on the circumference of acircle of radius r as it rolls around the outside of a circle of radius R. Using ageometric argument as above, the parametric equations for an epicycloid are:

64

Page 71: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 9 Hypocycloids and Epicycloids

Notice that the equations for an epicycloid can be derived from the equations fora hypocycloid. by changing the sign of r.

Use Maple to create a parametric plot of the hypocycloid in which the fixed circle hasradius R = 40 and the moving circle has radius r = 13.

Maple SolutionFirst open a new Maple worksheet and enter the parametric equations for a generalhypocycloid.

X := t (R-r)*cos(t) + r*cos((R-r)*t/r):

Y := t (R-r)*sin(t) - r*sin((R-r)*t/r):

Next enter the radii for each circle:

R := 40: r := 13:

65

Page 72: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 9 Hypocycloids and Epicycloids

In the above command, we assign the plotstructure to the name "hypo" so that we cancombine this plot with a second plot in a laterexample.

Notice the resulting hypocycloid has 40 cusps(sharp pointy edges). The graph lies inside acircle of radius 40 and outside a circle ofradius R - 2 r = 14. These are called thebounding circles of the hypocycloid.

Use Maple to create a parametric plot of the epicycloid in which the fixed circlehas radius R = 40 and the moving circle has radius r = 13.

Maple SolutionWe assume that you are continuing from the last example. If you have quit, be sure to reenter theexpressions for x and y and to generate the plot hypo given above before continuing.

To obtain the equations for the epicycloid, from the above hypocycloid, we just letthe radius r of the moving circle be negative. Enter the given radii into Maple.

R := 40: r := -13:

Now we can just reenter the same plot command used in the last example, except wewill call the resulting plot "epi" and change the color to blue.

66

Page 73: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 9 Hypocycloids and Epicycloids

Notice the resulting epicycloid alsohas 40 cusps(sharp pointy edges) butthese now appear on the inside. Thegraph lies inside a circle of radius 66and outside a circle of radius 36.These are called the boundingcircles.

We can combine the hypocycloid from theprevious example and the epicycloid byusing the display command after we readit in from the plots library. This results inthe following beautiful graph which looksa lot like a flower. Notice how the cuspsof the hypocycloid and the epicycloid fitperfectly together.

with(plots):display({hypo, epi});

Comment: Curves similar to these will be used in our study of Light Patterns in aCup and the Rotary Wankel Engine.

67

Page 74: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 9 Hypocycloids and Epicycloids

An animation revealing how a hypocycloid can be generated by a circle of radius rrolling inside a circle of radius R can be generated using the following code.

The first line defines the radius of the fixed circle R, the radius of the moving circle r, thenumber of frames in the animation N, the period T of the hypocycloid, and the width of asmall circle which represents the point P on the rim of the moving circle.

You may alter any of these values as you wish. Have fun!

68

Page 75: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 9 Hypocycloids and Epicycloids

References: F. S. Gordon and S. P. Gordon"Mathematical Discovery via Computer Graphics"The College Mathematics Journal, 15 November 1984, pages 440-443

69

Please work through the above examples on your computer before attemptingthe following exercises.

2. For each of the following pairs of numbers, obtain simultaneous graphs of thecorresponding hypocycloid and epicycloid using the display command in theplots library. Be sure to choose the interval for the parameter t so that acomplete graph is obtained. Generate the epicycloid by letting r be negative. Dothe cusps of the hypocycloid and corresponding epicycloid always coincide?

a. R=20, r=3 b. R=20, r=4

c. R = 20, r = 5 d. R = 20,r = 7

3. Consider a moving circle of radius r = 7 and fixed circles of various radii R.Compare the shape of the hypocycloid whenR < r, R > r, R > 2r, R < 2r.

Bonus: Create animations showing how a moving circle traces out anepicycloid or a hypocycloid.

Page 76: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 10 Animations through Morphing

We are all familiar with the movie special effect called morphing in which one imagecontinuously changes into another as in the thrilling science fiction adventureTerminator II. In this example, we show how to morph the graph of one function intothe graph of another. The algorithm we use involves linearly interpolating from eachpoint on the first graph to the corresponding point on the second graph. The Hollywoodeffects are based on similar (although) more complicated techniques.

The Algorithm - Morphing by Linear InterpolationSuppose we wish to continuously change the graph of the functionf(x) into the graphof the function g(x). In the movie industry, the two graphs may correspond to theposition of an arm, leg, or backbone at two different times. To create the effect of asmooth transition from one position to the next, the following mathematical techniquemay be used. Let t denote a time parameter and consider the following function of twovariables:

M(x,t) = (1-t)f(x) + t g(x)

Notice that at time t = 0, M (x, t) reduces to the initial function: M (x, 0 ) ,= f (x )and that at time t = 1, M (x, t) reduces to the final function: M (X' 1 ) = g (x )

Let x be a fixed point. As the time tincreases from 0 to 1, the point M (x,t)continuously changes from f (x) tog(x). Used with finesse, this techniquemay create the illusion of motion.

In this example we show how to create a sequence of images in which the graph ofone function continuously transforms (morphs) into the graph of a second using theabove linear interpolation technique. We also show how to create an animation of thisspecial effect.

70

Page 77: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 10 Animations through Morphing

First enter the functions and then plotthem simultaneously to see what the initialand final graphs will look like.

Enter the morphing function M (x, t)into Maple.

Notice that the arrow operator can also be used to define functions of more thanone variable as above. The variables must be enclosed by parentheses!

Now verify that M (x, 0 ) = f (x ) and M (x, 1 ) = g (x ).

We see that the first term is indeed f (x ) and the second term is g (x ).

To confirm the morphing property, we plot M(x, t) for fixed values of t increasing from 0 to1 in steps of 1/20 using the sequencecommand seq to generate the list of functions.

Notice how the first parabolagradually transforms into the second.

Using the animation command in the plots libraryyou can actually create a special effects movieto dramatically show the morphing of f to g.Here is the command. Try it!

71

Page 78: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 10 Animations through Morphing

For applications to animation, morphing one function to another is actually quite limited.In the movie industry, one is more likely to represent an object as a set of polygons andto morph each polygon from some initial position to a final position. In this example, wepresent a simple version of polygon morphing which can be used to create some veryinteresting special effects.

A point in the plane is represented as a list of two elements. For example, the origin isrepresented by the list [0, 01. Notice that points are enclosed by square brackets.

A polygon is simply a list of points. Thus for example, the unit square can berepresented as the list:

square1 := [[0,0], [1,0], [1,1],[0,1]]:

We can plot the square using the polygonplot command inthe plots library.

with(plots):

opts := (color = red, scaling =

constrained, axes=none): p

olygonplot(square1, opts);

Two polygons having the same number of vertices can easily be morphed into each otherusing the following procedure. The procedure morph will transform the polygon poly1into the polygon poly2 provided they both have the same number of vertices.

To see how this works, define a second square:

square2 := [[1,0], [1,1],[0,1],[0,0]]:

We can now morph the first square into the second square using the command:

display([seq(polygonplot(morph(squarel,square2,t/10)),t=O..10)],

insequence=true);

72

Page 79: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 10 Animations through Morphing

In this example, we create an animation showing the evolution of an Australopithecus intoModern Man. We represent the profile of the Australopithecus and the modern man bypolygons each having twenty five vertices.

The Australopithecus is represented by the polygon:

Australopithecus :=

[[75, 25], [97, 30], [93, 40], [93, 45], [83, 50],

[80, 55], [79, 60], [81, 73], [74, 76], [68, 81],

[60, 82], [50, 83], [40, 80], [30, 71], [25, 60],

[24, 50], [25, 37], [15, 33], [10, 30], [45, 10],

[55, 16], [65, 10], [80, 8], [93, 14], [96, 24]]:

To show this early ancestor of ours, we plotted him using the polygonplot command in theplots library.

with(plots): polygonplot(Australopithecus, color = brown,

scaling = constrained, axes=none);

73

Page 80: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 10 Animations through Morphing

The modern man is represented by the polygon:

man := [[95, 39], [113, 40], [111, 47], [118, 53], [113, 62],

[109, 72], [112, 88], [112, 95], [107, 112], [99, 117],

[85, 122], [72, 122], [49, 117], [36, 104], [31, 78],

[39, 52], [43, 43], [44, 34], [39, 16], [73, 3],

[81, 17], [98, 14], [105, 17], [104, 26], [111, 33]]:

To create an animation showing the evolution of Modern Man we just use ourmorph command.

morph := proc(poly1, poly2, t)

74

Page 81: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 10 Animations through Morphing

Here we show the first and the last frames of a number of animations we createdusing the morphing idea. These are included to suggest the broad array of objects thatcan be morphed. These and other morphs, in full animated detail, can be found on theDrexel Curriculum CD-ROM.

In this example, the initial and final position of the hand in the Vulcan Sign arerepresented as polygons. As corresponding points on the two polygons are morphed,a complete animation of the greeting is created.

75

Page 82: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

76

Exploration 10 Animations through Morphing

Morphing can be used to transform more than one polygon on the screen at once. Thisallows for scenes that require a little more detail. Here we show a face composed ofseveral polygons. In the resulting animation, the face smiles and winks.

In this example, the dinosaur was represented using several polygons. As thecorresponding points on the various polygons are combined according to themorphing formula, the dinosaur appears to walk.

Page 83: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 10 Animations through Morphing

1.

2.

Experiment with different initial and final functions to create an interestingmorphing effect. You might also try saving your animation and playing it withthe Quicklime MoviePlayer. This way you will be able to loop the movie backand forth.

The above morphing technique was based on linear interpolation. Experimentwith other techniques that will transform one graph into a second in acontinuous fashion. You may discover your own techniques which speed up thetransformation or which do not follow a linear path.

Morphing in polar coordinates.Suppose the initial and final curves are described in polarcoordinates. For example, consider the two cardioids:

3.

4.

5.

77

Page 84: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 10 Animations through Morphing

with(plots):

animate([M(theta,t),theta,theta = 0..2*Pi],t = 0..i,

coords=polar);

8.

transforms from the initial curve at time T = 0 to the final curve at time T = 1.Create some interesting animations using this principle.

9. Polygon MorphingUse the morph command introduced in this section to create an animationshowing the gradual transformation of the square [[-1,-1],[1,-1],[1,1],[-l,l]]into the square [[-1,0],[0,-1],[1,0],[0,1]].

10. Create an interesting animation using the polygon morphing techniquesintroduced in this exploration. Try to be creative!

78

Page 85: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Explorations11 Metamorphosis: From Chrysalis to Butterfly

A very beautiful polar curve is presented by T. H. Fay in the article the "The ButterflyCurve" referenced at the end of this exploration. This graceful curve is the graph ofthe polar equation:

To avoid spelling out the angular variable "theta" many times, we will let a denotethe angular variable for the remainder of this example. In this new notation:

Open a new Maple worksheet and enter the polar equation for the butterfly curve.

To obtain a polar plot of this function enter the command:

plot( [ r, a, a=0..24*Pi], color = red, coords=polar);

(One could also use the polarplot command in the ,lots library.)

79

Page 86: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Explorations11 Metamorphosis: From Chrysalis to Butterfly

The Butterfly Curve

p1 := plot([ r, a, a=0..6*Pi], color = red,

coords=polar):

p2 := plot([ r, a, a=6*Pi.12*Pi],color = blue,

coords=polar):

p3 := plot([ r, a, a=12*Pi..18*Pi],color = green,

coords=polar):

p4 := plot([ r, a, a=18*Pi..24*Pi],color = magenta,

coords=polar):

with(plots):

display( {p1, p2, p3, p4}, scaling = constrained, axes = none);

2. Each wing of the butterfly consists of a number of loops. Find the exact numberof loops in each wing. Be careful. Some of the loops overlap so that you willprobably not be able to determine the correct number from a graph of the

80

Page 87: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration11 Metamorphosis: From Chrysalis to Butterfly

a. Alter the equation for Fay's butterfly slightly so that the butterfly appears tobe flying upwards instead of to the right. (Show the resulting graph.)

b. Alter the equation so that the butterfly flies to the left. (Show the resulting graph.)

4. The previous butterfly curve may appear a littlecomplicated because of the exponential term andthe term involving the fifth power of the sinefunction. In addition, unlike a real butterfly, theresulting graph is not bilaterally symmetric. Thuswe tried to find some simpler butterfly curves.Our starting point will be the simple curve:

a. Show that the single-looped butterfly curve is an even function.Hence its graph is bilaterally symmetric.

81

Page 88: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Explorations11 Metamorphosis: From Chrysalis to Butterfly

6. Experiment with the parameters in the butterfly equation to see if you can designan improved butterfly. Hand in a graph of your best design and indicate theequation you used and the period of the function.

7. There are over 100,000 species of butterflies and mothswhich together form the second largest order of insects -the lepidoptera. The life cycle of butterflies is an exampleof complete metamorphosis, and consists of the followingfour stages: egg, (larva or caterpillar), (pupa or chrysalis)and adult. Each chrysalis illustrated in the figureresembles an elongated oval. The goal of this exercise isto create a movie of a butterfly emerging from itschrysalis by using the morphing technique introduced inan earlier exploration.

To represent the chrysalis, we choose the oval:

To represent the adult butterfly we choose the new butterfly curve:

You can construct an animation of the emerging butterfly using the morphing

Here's how! First enter f and g as functions of theta using the arrownotation. Then enter the morphing function M and create the animation.

Im

It will take the computer a little time to complete the metamorphosis.

Optional Assignment If you wish, you can obtain a more colorful animation byusing different colors over different intervals as illustrated in the following code.

82

Page 89: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Explorations11 Metamorphosis: From Chrysalis to Butterfly

Notice we had to glue the animations together two at a time. For some strangereason, Maple's display command would not take all three at once.

Reference: T. H. Fay: "The Butterfly Curve"American Mathematical Monthly, 96, (May 1989) Pages 442-443

83

Page 90: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 12 Applied Maxima and Minima Problems

Many engineering problems involve finding the maximum or minimum of a function.Companies are very interested in maximizing profits and minimizing costs. A chemicalengineer might want to maximize production but minimize consumption of rawmaterials. An electrical engineer may want to maximize power or minimizetransmission loss. Maxima and minima are collectively referred to as extrema.

Definition - ExtremumA point in the domain of a function iscalled an extremum if it is either amaximum or a minimum of the function.

It is important to distinguish between localextrema and global extrema. In the adjacentfigure, A is a local minimum, B is a localmaximum, C is the global minimum and D is theglobal maximum. There is no simple test to findglobal extrema, but all the local extrema can befound using the following theorem.

Fermat's TheoremIf a function f(x) possesses a local maximum or a local minimum at a point x then it must

Notice that the derivative is zero at points A, B and C in the above diagram but thederivative does not exist at the global maximum D. To reflect the importance of Fermat'stheorem one defines a critical point of a function as any point where its derivative iszero or does not exist. Thus the local maxima and minima of a function can only occurat critical points. (Note one must also check endpoints for possible global extrema.)

In this exploration we show how to identify the critical points of a function and hencefind its local extrema using Maple. The global extrema can also be found bycombining this information with graphical exploration.

Maple Solution Always approach a max/min problem by first graphing thefunction to eyeball the approximate location of its extrema.

84

Page 91: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 12 Applied Maxima and Minima Problems

f := x -> x^2 * exp(-x^2):

plot(f(x), x=-2..2);

The resulting graph reveals that thefunction has three local extrema. Since thederivative is defined everywhere, we canfind all the local extrema by finding thosepoints where the derivative is zero(Fermat's Theorem).

Enter the following command to find the critical points.

critical := solve(diff(f(x),x) = 0,x);

critical:=0, 1, - 1

To evaluate the function at these critical points we can enter:

A uniform beam of length L is bent under theweight of a heavy distributed load. The weightsupported by the beam is not uniformlydistributed but increases linearly from left toright. This kind of loading frequently arises whenramps join structures at different heights and insloping structures like stadiums. The adjacentfigure illustrates the linear loading of the beam.The right end of the beam is rigidly constrainedwhile the left end is free to slide or rotate.

The displacement y of the beam is typically too small to be seen at the scale of ourillustration but is nonetheless very significant in the design of such structures. Fromthe theory of elasticity, it is known that the vertical height y as a function of thedistance x from the left support is given by the quintic polynomial:

Find the maximum displacement of the beam.

85

Page 92: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 12 Applied Maxima and Minima Problems

Maple SolutionFirst enter the known constants and the vertical height y of the beam as a function of x.

Before we attempt to find the maximum deflection, let us plot this equation to getsome graphical insight into the nature of the problem.

plot(y(x), x = 0.:1);

Of course the actual beam would not deform as much as the graph suggests - thevertical scale has been greatly exaggerated by Maple's automatic scaling defaults. Tosee the actual extent of bending, one could choose the option "scaling = constrained."The resulting graph is indistinguishable from a straight line.

A ParadoxThe graph reveals that the point of maximum deflection is not located at the center. Infact, even though three times as much weight is loaded on the right side of the beam,the point of greatest deflection seems to lie on the left side of the beam! To verify thisamazing paradox, let us now find the precise value where this maximum deflectionoccurs using Fermat's test.

Wow! Why are there four solutions? Since the function y is a quintic polynomial, itsderivative is a quartic polynomial and Maple returns all four roots. Only one of theseroots corresponds to the point of maximum deflection. Which one?

evalf(critical);1. , -1. , .4472135956 , -.4472135956

86

Page 93: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 12 Applied Maxima and Minima Problems

Prepare an environmental impact report which identifies the minimum oxygenconcentration downstream of the sewage plant and discusses the impact on the troutpopulation.

Maple Solution Enter the oxygen concentration as a function of x and plot it over aninterval extending from the sewage plant located at x = 0 to a point 50 kilometers

plot(c(x), x=0..50, c=0..10,color=red);

The resulting graph reveals that there is adramatic drop in oxygen concentration about fourkilometers downstream from the plant. It isclearly evident that the level falls well below 4milligrams per liter and that many trout will die.

The derivative of the concentration c (x) willbe zero at the minimum by Fermat's Theorem.

87

Page 94: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 12 Applied Maxima and Minima Problems

Wow! Maple has found a total of four roots. Recalling that Maple uses the letter I todenote the square root of negative one, we see that only the first of the roots is real.To obtain a numerical approximation to the critical point, we apply the eval fcommand to the real root.

evalf(xmin[1]); which gives 4.023594781Thus the minimum oxygen concentration occurs just over four kilometers downstreamof the sewage plant! The actual minimum oxygen concentration is:

or about

evalf("); 2.650077559

which is well below the fatal value of 4 mg/liter.

The limiting oxygen concentration far downstream can be found using the limit command.

limit(c(x), x = infinity); which yields 8

Notice that the oxygen concentration far downstream returns to the normal level inthe stream of 8 mg/literComment - Many students are surprised that the minimum oxygen concentration occursso far downstream instead of at the source of the pollution. The depression in oxygenlevels is due to bacteria metabolizing the biodegradable organic carbon - a process thatconsumes oxygen. Downstream from the plant, the bacteria continue to multiply andhence continue to reduce the oxygen concentration still further.

If the oxygen concentration in the air were reduced by as little as 50%, humans couldno longer survive on our planet. Unfortunately, our thoughtless activities often causeeven greater stresses on fish and other wildlife.

88

Page 95: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 12 Applied Maxima and Minima Problems

1. Find the local and global extrema for each of the following functionsInvestigate each function graphically before attempting an analytic

2. A uniform beam of length L is bent underthe weight of a heavy distributed load.The weight supported by the beamincreases linearly from left to right. Bothends of the beam are supported in such away that they are free to slide or rotate.Because the support is different from thatin the worked out example, the verticalheight y of the beam is also different:

89

Page 96: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 12 Applied Maxima and Minima Problems

a. Using Maple, prove the Maximum Power Transfer Theorem, which states that themaximum power will be delivered to the load resistance when it equals theinternal resistance. That is, show that the maximum power occurs when r = R.

b. To verify the theorem graphically, consider the case of a six volt battery with aninternal resistance of r = 1/4 Ohm. Plot the power P against the external load Rand graphically verify that the maximum power is delivered when r = R.

Comment - A battery's internal resistance is an important design parameter whenthe battery is to be used to power high currents for a short time such as inphotographic flashes and flame ignition applications. If the internal resistance istoo high, the voltage across the terminals will drop below the required level. Thesolution is to use a larger battery, thus reducing the internal current density.

5. The extrema of many interesting functions can be found exactly with the help ofthe Omega function y = W (x ).

90

Page 97: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 13 The Whispering Gallery

In a whispering gallery, two peoplestanding at marked spots on the floorcan easily hear each other whispereven if there are many other peopletalking in the gallery. If one listenermoves even a few feet from thesespecial spots, the other can no longerbe heard. An example of a whisperinggallery is Statuary Hall in the U. S.Capitol Building. Many a politician inWashington has inadvertently hadconfidential remarks overheard whiletalking in Statuary Hall too close toone of its foci.

Whispering galleries are designed in an elliptic or ellipsoidal shape. Theircurious property is based on certain geometric properties of the ellipse.

In this exploration of whispering galleries we will need theclassical formula for the acute angle between two intersecting lines.Consider two intersecting non-perpendicular lines of slope ml andm2.Let a denote the acute angle between the lines. Then:

tan α = l m2 – m1l1 + m1m2

The acute angle is the smaller of the two possible angles at the point of intersection.

91

Page 98: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 13 The Whispering Gallery

Let us start with a simple example which finds the acute angle between two

Using Maple, find the acute angle a between the two lines y = 2x + 3 and y = 3x + 2 .

By inspection, the two slopes are ml = 2 and m2 = 3. Since m2 > ml we can drop theabsolute value functionTo find the acute angle we merely enter:

We can express the angle in radians

evalf(alpha);

.1418970546

or in degrees

evalf(convert(alpha, degrees));8.130102352 degrees

Among its many uses, the convert command can also be used to change radians intodegrees as above. In summary, the acute angle between the two lines is a little morethan 8 degrees.

Then differentiate with respect to x and solve the resulting equation for thedesired derivative.

92

Page 99: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 13 The Whispering Gallery

M := solve(diff(Eqn,x), diff(y(x),x) );

We now come to the essential principleunderlying how whispering galleries are designed- the reflection property of ellipses.

That is, show that the angle of incidence a is equal to the angle of reflection β.

Use the restart command to clear any assigned variables and enter the expression for f

restart: f := sqrt(a^2 - b^2):

93

Page 100: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 13 The Whispering Gallery

Recall that α is the acute angle between the normal line and the line from the left focus.Similarly, β is the acute angle between the normal line and the line to the right focus. Toverify the reflection property we must show that the tangents of the angles α and β areequal. (See illustration at the beginning of this example.) The tangents of these anglescan be computed with the formula given in Example 1. Consider the case where m2 ispositive. Thus m2 ≥ N ≥ ml . Using these inequalities to evaluate the sign of thenumerator, we see that the tangents of the angles of incidence and reflection are:

To show that these two expressions are equal, we show that their difference is zero.

simplify(tan(alpha) - tan(beta));

0

Thus we have verified the reflection property for ellipses. The angle of incidence doesequal the angle of reflection. The case of negative y is very similar.

Now that we have proven the reflection property, we can model the reflection ofacoustical waves emitted from either focus just by connecting the dots as it were. Atthis stage, it will be convenient to convert to polar coordinates. Recall that the polarequation for an ellipse with the left focus translated to the origin is given by the

Use the restart command to clear any assigned variables, and then enter the polarequation for the ellipse into your Maple worksheet. We arbitrarily select an ellipsefor which a = 50 and b = 30.

94

Page 101: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 13 The Whispering Gallery

In these new coordinates, the location of the left and right foci are: _

Left Focus: (0,0) Right Focus: (2 f, 0)

Now imagine a sound (or light wave) which leaves the left focus at an angle of tradians above the horizontal. This ray bounces off the ellipse at the point:

(x(t), y(t)) = (r(t) cost, r(t) sint)

and reconverges at the second focus as we proved in the last example. Thus the path ofthe ray from one focus to the other is given by the function:

The resulting image clearly reveals all the sound rays leaving the left focus andarriving at the right focus.

95

Page 102: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 13 The Whispering Gallery

1. Using Maple, find the acute angle a between the two linesy = R + I and y = x + 3.

a. Find the eccentricity and coordinates of the two foci of the ellipse.b. Create a parametric plot of the ellipse.c. Describe the ellipse in polar coordinates with the origin chosen at the left focus.

Then create a polar lot of the ellipse. Use the polarplot command in the plots library.

5. Some interesting animations can be found in the Maple Exploration Folder.You may enjoy viewing some of these.

96

Page 103: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

If two circular gears of the same radiusare connected as shown, then the angularspeed of the output shaft will have thesame magnitude as that of the input shaft,(albeit in the opposite direction). However,there are many applications in machinesand production processes where one wouldlike the angular speed of the output shaftto vary. For example, quick returnmechanisms require that the shaft rotatewith great speed for a portion of eachrevolution but dwell or rotate very slowlyfor another portion. An elegant mechanismfor varying the rotational speed of theoutput shaft can be constructed from a pairof elliptic gears.

Our goal in this exploration is to model the performance of an elliptic gear set andto create an animation of a pair of rotating elliptic gears.

We begin by reviewing a few elementary properties of theellipse. An ellipse may be represented by the parametric

If we use the above parametric representation, then the center of the ellipse lies at theorigin. However, in an elliptic gear set, each ellipse rotates about one of its foci, notabout its center so we will need to change this representation somewhat. Consider thetwo elliptic gears shown in the illustration below. If we place the origin at the leftfocus of the left ellipse, then the parametric equations of the two ellipses are:

97

Page 104: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

These equations are obtained from theprevious formula by shifting the graphsalong the x-axis. The center of the leftellipse has been moved a distance f to theright while the center of the right ellipsehas been moved a distance (2a + f).

Maple Solution

Open a new Maple session and enter the values of a, b and the expressions for the foci andthe eccentricity.

a : =5: b : = 3: f := sqrt( a^2 - b^2);a := f/a;

f .= 4

Thus the eccentricity is 4/5 and the focal constant is f = 4.

Next enter the parametric expressions for the left and right ellipses.

X1 := f + a * cos(t)s y1 := b * sin(t); #Left ellipse

x2 := 2*a + f + a * cos(t)s y2 := b * sin(t); #Right ellipse

x1 := 4 + 5 cos(t) y1 := 3 sin(t) x2 := 14 + 5 cos(t) y2 := 3 sin( t)

Notice how the pound sign # was used to add comments in Maple. Everythingappearing on an input line after a pound sign is ignored by Maple.

To create a plot of the two ellipses we use the plot command in parametric form.plot({[x1, y1 t=O..2*Pi], [x2, y2, t=O..2*Pi]}, scaling =

constrained );

98

Page 105: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

The resulting graph shows the initial configuration of the elliptic gears.

Assume that the left axis and gear are rotated at a constant angular velocity and drivethe right gear. In this example, we demonstrate how to model the rotation of the drivergear using polar coordinates and how to create an animation showing this rotation.Rotation is easier to describe in polar coordinates. The equation of the left ellipse(driver gear) in polar coordinates is:

Project: Create an animation of the driver gear rotating about the axis through its focus.

Maple Solution (Continue from the previous example.)

Enter the polar equation into your Maple worksheet.

Notice that although the symbols a and a appear in the above expression, their valuesare known to Maple as we see by evaluating the radius at a given angle.

99

Page 106: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

To verify that this is the same ellipse as above we cangraph it in polar coordinates. The polarplot commandmust first be read in from the plots library.

with(plots):

polarplot( r(theta), theta=0..2*Pi, scaling

= constrained);

This formula is analogous to the formula for translating the Cartesian graph of thefunction y = f (x) to the right by an amount a. The translated graph corresponds to thefunction y = f (x - a).

polorplot(r(theta-Pi/2), theta=0..2*Pi, scaling = constrained);

The resulting graph is shown to the right and confirms that thegear has rotated by 90 degrees.

AnimationBy letting the rotation angle a increase from 0 to 2pi in smallsteps, we can create an animation of the rotating driver gear. Wewill consider the second gear soon.

with(plots): animate([r(theta-alpho), theta, theta = 0.

.2*Pi], alpha=0..2*Pi, coords = polar);

Try it and confirm that the resulting movie shows the driver gear rotatingcounter-clockwise about the focus located at the origin.

Alternatively we can generate the animation using the displav command.

100

Page 107: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

display([seq(polarplot(r(theta - 2*Pi*(k/20)), theta = 0..2*Pi), k = 0..20)],

insequence = true);

We will frequently use the display command with the option inse guence = true as thisgives more control over the animations than the animate command.

Express the angle rotated by the follower gear as a function of the angle rotated bythe driver gear.

Discussion - When the driver gear has rotated counterclockwise by the angle α thefollower gear must rotate by an angle ß so that the distance 2a between the two shaftsremains constant. (Note that the angle ß is opposite in sign to α.) This conditionenables us to find an equation for the angle ß as a function of the angle a α.

Since the cosine is an even function, the above equation tells us nothing about the signof ß or α. This can be seen even more clearly by using the imlpicitplot command in theplots library to display the solutions to the above equation.

101

Page 108: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

implicitplot(Eqn, alpha = -Pi..Pi, beta = -Pi..Pi, numpoints =

200, scaling = constrained);

To implement this little trick in Maple, we enter the command:

beta := solve(Eqn, beta) * signum(sin(-alpha));

Note that the signum command gives the sign of its argument. It returns +1 if theargument is positive and -1 if the argument is negative.

plot(beta, alpha=-Pi..Pi,

scaling=constrained,

color=red);

The graph shows the angle ß rotated by thefollower gear as a function of the angle α rotated by thedriver gear. Note that the function as defined hasdiscontinuities at odd multiples of Π, which may appearas vertical lines on your screen.

As an example, find the angle rotated by the followergear when the driver gear has rotated 90° and show aplot of both gears at this moment.

102

Page 109: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

We can obtain a simultaneous plot of both gears in this configuration usingthe commands:

103

Page 110: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

Now we can animate the elliptic gears in action by plotting the gears for a sequence ofangles from 0 to 2π. We will animate the driver and follower gears separately and thenglue the two animations together using the display command. First it will be convenientif we convert beta into a fuinction of alpha using the makeproc command in the studentlibrary.

You may wish to increase the number of frames to obtain a smoother animation during thequick return phase of the motion. You can also display the foci by defining:

foci := display(seq(textplot({[0,0,’o’],[2*a,0,’0’]}),k=1..16)],insequence = true):

Then combine the foci with the movie.

display({movie, foci});

If you increased the number of frames, be sure to also increase the number 16 inthe definition of foci.

104

Page 111: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

Before attempting the exercises, carefully work through the "Step by Step Examples".Use the help facility to learn more about any commands you do not feel comfortablewith. This is a challenging exploration and there are lots of interesting things todiscover if you invest some time. Be sure to create the animation in example five.Repeat the animation using 30 or 40 frames to smooth out the motion.

Now consider the following modification of theproblem. The semi-major and semi-minor axes ofeach ellipse in an elliptic gear set are measured tobe a = 5 and b = 4.Let the gears initially be placed as shown in the figure, and let α and ß denote thecounter-clockwise rotation of each gear at a later instant.

1. Find the corresponding value for the focal constant f and the eccentricity e.

2. Obtain a simultaneous plot of both ellipses when neither has rotated (α = 0).Your graph should look like the above figure.

3. Solve for the angle ß as a function of the angle a. Use the signum trick discussedin the examples.

4. Obtain a simultaneous plot of both gears when α = π/3. What is thecorresponding value of ß?

5. Assume the driver gear rotates with a constant angular velocity of one radian persecond. Create an animation showing the elliptic gear set in rotation.

6. Find the minimum and maximum angular speeds of the follower gear. (A carefulgraphical exploration is sufficient.)

7. Find the minimum and maximum angular speeds of the follower gear for ellipticalgears having eccentricity e. (Do not assume any numerical value for the constantsa and b.)

105

Page 112: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

Most cars sold in the United States today are powered byconventional reciprocating engines. In this design, pistons movelinearly (reciprocate) in cylinders within the engine block. Thelinear motion of the pistons is translated into a circular motionthrough the crank and crankshaft. The design of reciprocatingengines can vary considerably. All conventional automobileengines have more than one cylinder to smooth out the motion.For example, in a two cylinder design, while one of the pistonsmoves upward (compressing the fuel-air mixture) the other pistonmoves downward driven by the force of expanding gases. Carshaving the least number of cylinders include the Fiat 126 and theCitroen 2CV each with two cylinders, and the Geo Metro withthree cylinders. Other cylinder configurations include 4-in line,6-in line, the V6, V8 and V 12. In all these engines, however,

the essential principle is the same - linear motion of the pistons is converted intocircular motion via the crank.

On the other hand, this conversion is notnecessary in rotary piston engines since thepiston itself rotates. Hence the piston isreferred to as the rotor. The Wankel engine,illustrated in the adjacent figure, is the bestknown of these engines. This engine wasinitially developed as an air compressor in the1920's by Felix Wankel. During the 1950's,Wankel teamed up with the German motorcompany NSU to develop the concept into acommercial combustion engine. Perhaps thecompany most identified with the Wankelengine in the United States is the Japaneseauto manufacturer Mazda because of theirintroducuction of the Wankel powered RX-7in the 1970's. Although the first automobilerotary engines were plagued by problemswith their sealings, this problem has sincebeen solved.

The goal of this exploration is to understand the workings of the Wankel engine and atthe same time, to highlight the elegant mathematics underlying its design. The rotor ofthe engine is an equilateral triangle with curved sides and the bore is a curve known asan epitrochoid. The bore must be carefully designed to allow smooth rotation of thetriangular rotor. Before we begin the Step by Step Examples, we first derive theequations of an epitrochoid.

106

Page 113: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

The metal bore of a Wankel engine is anepitrochoid, which is defined as the curve tracedby a point P on a circle of radius r as it rollsaround a fixed circle of radius R. The point Pneed not lie on the center C of the rolling circlebut in general is located a distance of h units fromthe center.

The adjacent figure illustrates the epitrochoidformed by tracing a point P, located 1/2 unit fromthe center of a circle of radius 1 as it rolls arounda circle of radius 2.

To simplify the derivation of the parametricequations for an epitrochoid, we assume that theorigin is located at the center of the fixed circleand that the point P is initally located on thex-axis between the centers of the two circles asshown in the figure.

Note that the center of the moving circle traces out a larger circle of radius m = R + r.Thus, when the line joining the centers of the two circles makes an angle t with respectto the positive x-axis, the center C of the moving circle is: C = (m cost, msint)

107

Page 114: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

In this example, our goal is to explore how the shape of an epitrochoid depends on theradii r and R of the two circles used to construct it and on the distance h of the point Pfrom the center of the moving circle. Open a new Maple worksheet and enter theparametric equations for an epitrochoid derived in the background section.

Suppose the radii for the two circles used to generate the epitrochoid are r = 1 and R = 2.

Enter these values into your Maple worksheet.

r :a 1: R .= 2:

Recall that h is the distance from the center of the moving circle to the point P.To investigate the effect of the parameter h, we plot five epitrochoids, with h values equalto 0, 1/4, 1/2. 3/4 and 1.

h := 0: epi0 := plot([x(t), y(t), t=O..2*Pi], color = red):

h := 1/4: epi1 := plot([x(t), y(t), t=0. .2*Pi], color = yellow):

h := 1/2: epi2 := plot([x(t), y(t), t=0..2*Pi], color = green):

h := 3/4: epi3 := plot([x(t), y(t), t=0..2*Pi3, color = blue):

h :s 1: epi4 := plot([x(t), y(t), t=0..2*Pi], color = black):

with(plots):

display({epi0, epi1, epi2, epi3, epi4}, scaling =

constrained);

The resulting graph is shown to the right. Eachepitrochoid ras r = 1 and R = 2. Only the h values change.As h approaches 0, the epitrochoids approach a circle ofradius R + r = 3.

108

Page 115: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

Wankel designed the rotor of his engine in such a way that itsvertices form an equilateral triangle. The three vertices dividethe engine bore into three chambers. Suppose that one vertexof the rotor is at the point on the epitrochoid corresponding tothe polar angle t. If the engine is to function properly, the nextvertex must also lie on the epitrochoid at the pointcorresponding to t +2 π/3. If it did not, the chambers of theengine could not be properly sealed. Thus the distancebetween any two points on the epitrochoid which areseparated by 2 π /3 radians must be a constant. In thisexample, we show that this geometric property is true for anyepitrochoid satisfying R = 2r.

To reduce the equation, we must expand out the squares and then make any trig simplifications.This can be done with either of the commands:

combine(Eqn, trig); or simplify(expand(Eqn));

The actual length is the positive solution. The fact that this length does not depend on the angle tensures the perfect fit of the rotor to the bore throughout its rotation. Notice also that this lengthdoes not depend on the parameter h.

109

Page 116: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

In this example, we show how to create an animation of the triangular rotor turninginside the epitrochoidal bore. The resulting movie is truly fascinating!

r := 1: R .= 2: h := 1/2: a := 2*Pi/3:

Each frame of the movie must show the engine's bore and the triangularrotor. The following command creates a plot structure for the bore of theengine.

bore :9 plot([x(t), y(t), t=0..2*Pi], color=blue):

A list of the three vertices of the rotor, when the first is located at the angle t can befound using the function:

rotor := t -> [[x(t), y(t)], [x(t+a), y(t+a)], [x(t+2*a), y(t+2*a)]]:

To gain more control over our animation we will not use the animation command butinstead use the display command as shown below. First let us define a function which

ill ll "f " h d h b f h i d h i l h

110

Page 117: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 13 The Whispering Gallery

In these new coordinates, the location of the left and right foci are: _

Left Focus: (0,0) Right Focus: (2 f, 0)

Now imagine a sound (or light wave) which leaves the left focus at an angle of tradians above the horizontal. This ray bounces off the ellipse at the point:

(x(t), y(t)) = (r(t) cost, r(t) sint)

and reconverges at the second focus as we proved in the last example. Thus the path ofthe ray from one focus to the other is given by the function:

The resulting image clearly reveals all the sound rays leaving the left focus andarriving at the right focus.

95

Page 118: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 13 The Whispering Gallery

1. Using Maple, find the acute angle a between the two linesy = R + I and y = x + 3.

a. Find the eccentricity and coordinates of the two foci of the ellipse.b. Create a parametric plot of the ellipse.c. Describe the ellipse in polar coordinates with the origin chosen at the left focus.

Then create a polar lot of the ellipse. Use the polarplot command in the plots library.

5. Some interesting animations can be found in the Maple Exploration Folder.You may enjoy viewing some of these.

96

Page 119: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

If two circular gears of the same radiusare connected as shown, then the angularspeed of the output shaft will have thesame magnitude as that of the input shaft,(albeit in the opposite direction). However,there are many applications in machinesand production processes where one wouldlike the angular speed of the output shaftto vary. For example, quick returnmechanisms require that the shaft rotatewith great speed for a portion of eachrevolution but dwell or rotate very slowlyfor another portion. An elegant mechanismfor varying the rotational speed of theoutput shaft can be constructed from a pairof elliptic gears.

Our goal in this exploration is to model the performance of an elliptic gear set andto create an animation of a pair of rotating elliptic gears.

We begin by reviewing a few elementary properties of theellipse. An ellipse may be represented by the parametric

If we use the above parametric representation, then the center of the ellipse lies at theorigin. However, in an elliptic gear set, each ellipse rotates about one of its foci, notabout its center so we will need to change this representation somewhat. Consider thetwo elliptic gears shown in the illustration below. If we place the origin at the leftfocus of the left ellipse, then the parametric equations of the two ellipses are:

97

Page 120: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

These equations are obtained from theprevious formula by shifting the graphsalong the x-axis. The center of the leftellipse has been moved a distance f to theright while the center of the right ellipsehas been moved a distance (2a + f).

Maple Solution

Open a new Maple session and enter the values of a, b and the expressions for the foci andthe eccentricity.

a : =5: b : = 3: f := sqrt( a^2 - b^2);a := f/a;

f .= 4

Thus the eccentricity is 4/5 and the focal constant is f = 4.

Next enter the parametric expressions for the left and right ellipses.

X1 := f + a * cos(t)s y1 := b * sin(t); #Left ellipse

x2 := 2*a + f + a * cos(t)s y2 := b * sin(t); #Right ellipse

x1 := 4 + 5 cos(t) y1 := 3 sin(t) x2 := 14 + 5 cos(t) y2 := 3 sin( t)

Notice how the pound sign # was used to add comments in Maple. Everythingappearing on an input line after a pound sign is ignored by Maple.

To create a plot of the two ellipses we use the plot command in parametric form.plot({[x1, y1 t=O..2*Pi], [x2, y2, t=O..2*Pi]}, scaling =

constrained );

98

Page 121: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

The resulting graph shows the initial configuration of the elliptic gears.

Assume that the left axis and gear are rotated at a constant angular velocity and drivethe right gear. In this example, we demonstrate how to model the rotation of the drivergear using polar coordinates and how to create an animation showing this rotation.Rotation is easier to describe in polar coordinates. The equation of the left ellipse(driver gear) in polar coordinates is:

Project: Create an animation of the driver gear rotating about the axis through its focus.

Maple Solution (Continue from the previous example.)

Enter the polar equation into your Maple worksheet.

Notice that although the symbols a and a appear in the above expression, their valuesare known to Maple as we see by evaluating the radius at a given angle.

99

Page 122: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

To verify that this is the same ellipse as above we cangraph it in polar coordinates. The polarplot commandmust first be read in from the plots library.

with(plots):

polarplot( r(theta), theta=0..2*Pi, scaling

= constrained);

This formula is analogous to the formula for translating the Cartesian graph of thefunction y = f (x) to the right by an amount a. The translated graph corresponds to thefunction y = f (x - a).

polorplot(r(theta-Pi/2), theta=0..2*Pi, scaling = constrained);

The resulting graph is shown to the right and confirms that thegear has rotated by 90 degrees.

AnimationBy letting the rotation angle a increase from 0 to 2pi in smallsteps, we can create an animation of the rotating driver gear. Wewill consider the second gear soon.

with(plots): animate([r(theta-alpho), theta, theta = 0.

.2*Pi], alpha=0..2*Pi, coords = polar);

Try it and confirm that the resulting movie shows the driver gear rotatingcounter-clockwise about the focus located at the origin.

Alternatively we can generate the animation using the displav command.

100

Page 123: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

display([seq(polarplot(r(theta - 2*Pi*(k/20)), theta = 0..2*Pi), k = 0..20)],

insequence = true);

We will frequently use the display command with the option inse guence = true as thisgives more control over the animations than the animate command.

Express the angle rotated by the follower gear as a function of the angle rotated bythe driver gear.

Discussion - When the driver gear has rotated counterclockwise by the angle α thefollower gear must rotate by an angle ß so that the distance 2a between the two shaftsremains constant. (Note that the angle ß is opposite in sign to α.) This conditionenables us to find an equation for the angle ß as a function of the angle a α.

Since the cosine is an even function, the above equation tells us nothing about the signof ß or α. This can be seen even more clearly by using the imlpicitplot command in theplots library to display the solutions to the above equation.

101

Page 124: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

implicitplot(Eqn, alpha = -Pi..Pi, beta = -Pi..Pi, numpoints =

200, scaling = constrained);

To implement this little trick in Maple, we enter the command:

beta := solve(Eqn, beta) * signum(sin(-alpha));

Note that the signum command gives the sign of its argument. It returns +1 if theargument is positive and -1 if the argument is negative.

plot(beta, alpha=-Pi..Pi,

scaling=constrained,

color=red);

The graph shows the angle ß rotated by thefollower gear as a function of the angle α rotated by thedriver gear. Note that the function as defined hasdiscontinuities at odd multiples of Π, which may appearas vertical lines on your screen.

As an example, find the angle rotated by the followergear when the driver gear has rotated 90° and show aplot of both gears at this moment.

102

Page 125: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

We can obtain a simultaneous plot of both gears in this configuration usingthe commands:

103

Page 126: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

Now we can animate the elliptic gears in action by plotting the gears for a sequence ofangles from 0 to 2π. We will animate the driver and follower gears separately and thenglue the two animations together using the display command. First it will be convenientif we convert beta into a fuinction of alpha using the makeproc command in the studentlibrary.

You may wish to increase the number of frames to obtain a smoother animation during thequick return phase of the motion. You can also display the foci by defining:

foci := display(seq(textplot({[0,0,’o’],[2*a,0,’0’]}),k=1..16)],insequence = true):

Then combine the foci with the movie.

display({movie, foci});

If you increased the number of frames, be sure to also increase the number 16 inthe definition of foci.

104

Page 127: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 14 Elliptic Gears

Before attempting the exercises, carefully work through the "Step by Step Examples".Use the help facility to learn more about any commands you do not feel comfortablewith. This is a challenging exploration and there are lots of interesting things todiscover if you invest some time. Be sure to create the animation in example five.Repeat the animation using 30 or 40 frames to smooth out the motion.

Now consider the following modification of theproblem. The semi-major and semi-minor axes ofeach ellipse in an elliptic gear set are measured tobe a = 5 and b = 4.Let the gears initially be placed as shown in the figure, and let α and ß denote thecounter-clockwise rotation of each gear at a later instant.

1. Find the corresponding value for the focal constant f and the eccentricity e.

2. Obtain a simultaneous plot of both ellipses when neither has rotated (α = 0).Your graph should look like the above figure.

3. Solve for the angle ß as a function of the angle a. Use the signum trick discussedin the examples.

4. Obtain a simultaneous plot of both gears when α = π/3. What is thecorresponding value of ß?

5. Assume the driver gear rotates with a constant angular velocity of one radian persecond. Create an animation showing the elliptic gear set in rotation.

6. Find the minimum and maximum angular speeds of the follower gear. (A carefulgraphical exploration is sufficient.)

7. Find the minimum and maximum angular speeds of the follower gear for ellipticalgears having eccentricity e. (Do not assume any numerical value for the constantsa and b.)

105

Page 128: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

Most cars sold in the United States today are powered byconventional reciprocating engines. In this design, pistons movelinearly (reciprocate) in cylinders within the engine block. Thelinear motion of the pistons is translated into a circular motionthrough the crank and crankshaft. The design of reciprocatingengines can vary considerably. All conventional automobileengines have more than one cylinder to smooth out the motion.For example, in a two cylinder design, while one of the pistonsmoves upward (compressing the fuel-air mixture) the other pistonmoves downward driven by the force of expanding gases. Carshaving the least number of cylinders include the Fiat 126 and theCitroen 2CV each with two cylinders, and the Geo Metro withthree cylinders. Other cylinder configurations include 4-in line,6-in line, the V6, V8 and V 12. In all these engines, however,

the essential principle is the same - linear motion of the pistons is converted intocircular motion via the crank.

On the other hand, this conversion is notnecessary in rotary piston engines since thepiston itself rotates. Hence the piston isreferred to as the rotor. The Wankel engine,illustrated in the adjacent figure, is the bestknown of these engines. This engine wasinitially developed as an air compressor in the1920's by Felix Wankel. During the 1950's,Wankel teamed up with the German motorcompany NSU to develop the concept into acommercial combustion engine. Perhaps thecompany most identified with the Wankelengine in the United States is the Japaneseauto manufacturer Mazda because of theirintroducuction of the Wankel powered RX-7in the 1970's. Although the first automobilerotary engines were plagued by problemswith their sealings, this problem has sincebeen solved.

The goal of this exploration is to understand the workings of the Wankel engine and atthe same time, to highlight the elegant mathematics underlying its design. The rotor ofthe engine is an equilateral triangle with curved sides and the bore is a curve known asan epitrochoid. The bore must be carefully designed to allow smooth rotation of thetriangular rotor. Before we begin the Step by Step Examples, we first derive theequations of an epitrochoid.

106

Page 129: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

The metal bore of a Wankel engine is anepitrochoid, which is defined as the curve tracedby a point P on a circle of radius r as it rollsaround a fixed circle of radius R. The point Pneed not lie on the center C of the rolling circlebut in general is located a distance of h units fromthe center.

The adjacent figure illustrates the epitrochoidformed by tracing a point P, located 1/2 unit fromthe center of a circle of radius 1 as it rolls arounda circle of radius 2.

To simplify the derivation of the parametricequations for an epitrochoid, we assume that theorigin is located at the center of the fixed circleand that the point P is initally located on thex-axis between the centers of the two circles asshown in the figure.

Note that the center of the moving circle traces out a larger circle of radius m = R + r.Thus, when the line joining the centers of the two circles makes an angle t with respectto the positive x-axis, the center C of the moving circle is: C = (m cost, msint)

107

Page 130: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

In this example, our goal is to explore how the shape of an epitrochoid depends on theradii r and R of the two circles used to construct it and on the distance h of the point Pfrom the center of the moving circle. Open a new Maple worksheet and enter theparametric equations for an epitrochoid derived in the background section.

Suppose the radii for the two circles used to generate the epitrochoid are r = 1 and R = 2.

Enter these values into your Maple worksheet.

r :a 1: R .= 2:

Recall that h is the distance from the center of the moving circle to the point P.To investigate the effect of the parameter h, we plot five epitrochoids, with h values equalto 0, 1/4, 1/2. 3/4 and 1.

h := 0: epi0 := plot([x(t), y(t), t=O..2*Pi], color = red):

h := 1/4: epi1 := plot([x(t), y(t), t=0. .2*Pi], color = yellow):

h := 1/2: epi2 := plot([x(t), y(t), t=0..2*Pi], color = green):

h := 3/4: epi3 := plot([x(t), y(t), t=0..2*Pi3, color = blue):

h :s 1: epi4 := plot([x(t), y(t), t=0..2*Pi], color = black):

with(plots):

display({epi0, epi1, epi2, epi3, epi4}, scaling =

constrained);

The resulting graph is shown to the right. Eachepitrochoid ras r = 1 and R = 2. Only the h values change.As h approaches 0, the epitrochoids approach a circle ofradius R + r = 3.

108

Page 131: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

Wankel designed the rotor of his engine in such a way that itsvertices form an equilateral triangle. The three vertices dividethe engine bore into three chambers. Suppose that one vertexof the rotor is at the point on the epitrochoid corresponding tothe polar angle t. If the engine is to function properly, the nextvertex must also lie on the epitrochoid at the pointcorresponding to t +2 π/3. If it did not, the chambers of theengine could not be properly sealed. Thus the distancebetween any two points on the epitrochoid which areseparated by 2 π /3 radians must be a constant. In thisexample, we show that this geometric property is true for anyepitrochoid satisfying R = 2r.

To reduce the equation, we must expand out the squares and then make any trig simplifications.This can be done with either of the commands:

combine(Eqn, trig); or simplify(expand(Eqn));

The actual length is the positive solution. The fact that this length does not depend on the angle tensures the perfect fit of the rotor to the bore throughout its rotation. Notice also that this lengthdoes not depend on the parameter h.

109

Page 132: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

In this example, we show how to create an animation of the triangular rotor turninginside the epitrochoidal bore. The resulting movie is truly fascinating!

r := 1: R .= 2: h := 1/2: a := 2*Pi/3:

Each frame of the movie must show the engine's bore and the triangularrotor. The following command creates a plot structure for the bore of theengine.

bore :9 plot([x(t), y(t), t=0..2*Pi], color=blue):

A list of the three vertices of the rotor, when the first is located at the angle t can befound using the function:

rotor := t -> [[x(t), y(t)], [x(t+a), y(t+a)], [x(t+2*a), y(t+2*a)]]:

To gain more control over our animation we will not use the animation command butinstead use the display command as shown below. First let us define a function which

ill ll "f " h d h b f h i d h i l h

110

Page 133: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

We can create a fascinating animation of the Wankel engine by displaying a sequence of suchframes. We chose 40 frames but you might like to decrease this number if you are running lowon memory.

N : = 40:

display([seq(frame(t), t=[2*Pi*k/N $ k=O..N])], insequence=true);

111

Page 134: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

1. Why would it not be useful to design a Wankel rotor for which h = 0?

2 . Explore some epitrochoids for which the parameter h is larger than r.Do such curves differ in any substantial way from those for which h < r ?Could an engine be designed using these shapes for a bore?

3 . Explore some epitrochoids for which the parameter h is negative.Do such curves differ in any substantial way from those for which h is positive?Could an engine be designed using these shapes for a bore?

4. Show that a square rotor will not rotate inside the bore of a Wankel enginesatisfying R = 2r.

5 . The usual Wankel engine has an epitrochoidal bore for which R = 2r.Show that if instead we design the bore so that R = 3r, then a square rotor willrevolve nicely inside the bore.

6 . Conjecture what relation between R and r will allow a hexagonal rotor to revolveinside the bore. Then verify your conjecture by a graphical and symbolic argument.

7 . Create an animation of a triangular rotor inside an epitrochoidal bore for whichr = 1,R = 2,h = 1/4.

8 . Create an animation of a hexagonal rotor inside an appropriate bore.

9 . Try to invent your own bore and rotor combination in which the rotor is a regularpolygon not discussed above. Prove your design concept by creating an animationof the engine as your rotor rotates.

112

Page 135: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

A key performance factor of any engine is its compression ratio CR. As the rotor of aWankel engine rotates, each chamber formed in the space between the rotor and the borechanges in volume. The ratio of the maximum volume to the minimum volume is called

We outline the steps for finding the compressionratio for a Wankel Engine. We first treat thesomewhat unrealistic case in which the edges ofthe rotor are treated as line segments. (Inactuality, the edges are circular arcs.)

Consider the chamber which has been shaded in theadjacent diagram. The volume of the chamber is equalto its cross-sectional area times the depth of thechamber. Thus the compression ration can be found bytaking the ratio of the maximum area to the minimum

Thus the area of the chamber is A(t)= A1(t)-A2(t).

a . Plot the area of the chamber as a function of the angle t and find the maximum andminimum area. Find the compression ration for a Wankel engine with a perfectlytriangular rotor. Use the parameters r = 1, R = 2 and h = 1/4.

b . Rotors with straight edges are seldom used because of wear problems and becausethey give too small of a compression ratio. In real rotors, the edges are usually

113

Page 136: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

circular arcs. Each circular arc is a portion of a circle of radius p. Explore howthe compression ratio depends on the parameter p.

1. Lawrence, J. D., "A Catalog of Special Plane Curves", p. 161, Dover Publications,Inc., New York 1972

2 . The Wankel RC Engine - Design and PerformanceR. F. Ansdale, Iliffe Books Limited, 1968

114

Page 137: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 15 Epitrochoids and the Wankel Engine

Student Exploration

Now that we have gotten more than half way through the book, we would like you to design yourown exploration using Maple.

Your exploration should consist of three sections.

1. First write a background section that gives the necessary physical and geometricinformation.

2 . Create an example in which you solve some aspect of your problem using Maple.You should show the complete solution in a "Step by Step" manner.

3 Create an exercise that builds on the material in your background section and that couldusefully be explored in Maple. You will be graded on the clarity and appropriateness of theproblems.

Please write three ideas for your exploration in the space provided.

115

Page 138: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

In our previous explorations involving parabolic trajectories, the projectile was alwaysfired over an even or level terrain. In this example, we consider a projectile which isfired into the air over an uneven terrain and ask how the range of the projectile isaffected by the region's terrain. This kind of question is extremely important in ballisticproblems and also in problems involving reflection of signals from uneven terrains suchas mapping the ocean floor. Our simple change of the projectile problem, opens up anenormous range of interesting questions and challenges that are nicely explored usingcomputer algebra.

How does the range of a projectile fired above anuneven terrain depend on the surface topography?

Our example of an uneven terrain,is a desert region consisting of sanddunes. The sand dunes formsinusoidal waves whose undulatingsurface we will model by theequation:

y = cosx -1

a. Express y as a function of x by eliminating time.b. Find the range R of the projectile.c. Plot the trajectory of the projectile over the dunes.

Maple Solution a. If the initial angle of the projectile is a, then the trajectory of theprojectile is given by the parametric equations:

116

Page 139: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

b. Let us now find the range R. The projectile will strike the ground at a point with xcoordinate satisfying the equation y (x) = cos(x) - 1. This x-coordinate is calledthe range R of the projectile. Maple's solve command cannot find this point, butthe fsolve command can, provided we ask it to look for solutions other than theinitial point x = 0.

R := fsolve(y(x) = cos(x)-1, x = 1..infinity);

R:= 10.95242480Thus the range R is just under 11 units.

c. We plot the dunes and the path of the trajectory separately, and then use thedisplay command in the plots library to show the resulting graphssimultaneously.

dunes := plot(cos(x)-l, x=0..4*Pi, color = brown): path := plot(y(x),

x=O..R, color = red): with(plots): display({path, dunes}, scaling =

onstrained);

Notice that the range R is larger than the corresponding range over a levelterrain y = 0. Over the level terrain the maximum range would have been onlyR = 10 as can be seen from the above graph. But the important point to note ishow we had to fundamentally change our approach to this problem due to thesimple modification of the terrain.

117

Page 140: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

Notice that we plotted the maximum of the two values y (x) and cosx -1 using the =command which finds the maximum of a sequence of values. This just keeps eachtrajectory above the level of the dunes. (Otherwise the graphs would descend beneaththe surface of the ground.) The resulting simultaneous plot of the sand dunes and thetrajectories at the selected launch angles reveals several interesting features.

118

Page 141: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

(This example continues from the previous example.)

Use Maple's implicitplot command to investigate how the range depends on the launchangle a of the projectile. What is the maximum range of the projectile considered in theprevious example and does this occur at the launch angle a = π/4?

Maple SolutionAnother way to visualize this is to use the implicitplot command in the plots library.At any given launch angle a, the range R is defined implicitly by the equation: y (x) =cos x - 1. (Note y depends on the parameter a.) Since we cannot solve thisequation exactly, we will have to settle for numerical and graphical solutions. Letus first see what this implicit equation for the range looks like, after freeing thevariable a from its last numerical assignment.

For a given launch angle a, the range is the smallest positive value of x which solvesthis equation. Unfortunately, we cannot solve this equation exactly with functions youare familiar with. However, we can easily obtain an implicit plot of the solutions usingthe implicitpiot command. To test whether or not the maximum range occurs when a = π/4, we also drew a vertical line at this value.

with(plots): p1 := implicitplot( Eqn, a = 0..Pi/2,x=O..12):

p2:=plot([[Pi/4,0],[Pi/4,12]]):

display([pl,p2]);

119

Page 142: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

The resulting curve of range versuslaunch angle is shown to the rightand reveals a number of startlingfacts. Notice the looping backphenomenon between the two dots.Also notice the vertical line wehave drawn using the plotcommand at the point a = π/4seems to lie a little to the right ofthe maximum range. Is this real orjust numerical error of theimplicitplot routine?

Because of the looping back, the abovecurve is not the graph of a function - itdoes not pass the vertical line test. Theactual range is determined from the firstpoint where the projectile strikes thedunes. This always corresponds to thelowest point on the above curve, and sothe actual range R of the projectile is givenby the adjacent graph. We see that therange is a discontinuous function of theangle! The discontinuity is created at thatangle where the projectile just clears themiddle sand dune.

It is very informative to compare the graph of the range with the more familiar graphwe would have obtained if the terrain were level. In the case of level terrain, it is knownthat the range is given by the formula:

120

Page 143: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

Let's obtain a plot of the range for a levelterrain and display it simultaneouslywith the above graph.

By zooming in about the maximum withthe implicitplot command we obtain theadjacent graph. The graph reveals thatthe maximum range is about 10.9 andoccurs at an angle about 0.74 radians orabout 42 degrees. It seems that themaximum range does not occur at the

Suggestion - Zoom in on the implicit plot and create this graph.implicitplot(y(x) =cos(x)-l, o=0.6.. 0.8, x=10..12);

121

Page 144: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

This shows that the maximum range x occurs at an angle a for which x = 10 cot a If we substitute this expression for x into the equation y (x) = cosx -1 we obtain asingle equation for that initial angle a which gives the maximum range.

This is clearly a very messy equation for the angle that gives the maximum range.Nevertheless, the f solve command has no problem finding the root.

a-max :=fsolve( Eqn, a, a =0.6.. 0.8);

a-max := .7389900518

To express this critical angle in degrees instead of radians we enter:evalf(a-max*180/Pi);

42.34101105

The maximum range is then given by the expression:10*cot(a-max);

10.97406619

Thus the maximum range has been found and agrees with the estimate we obtained bylooking at the graph of many trajectories.

122

Page 145: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

When the launch angle lies between about 15° and 20° the graphs of the projectilestrikes the sand dunes at three places instead of just once. For exactly which intervaldoes this happen? The endpoints of this interval correspond to those launch angleswhere: 1) the projectile intersects the sand dunes, 2) the slope of the trajectory isparallel to the slope of the sand dunes. These two conditions correspond to the twoequations:

These complicated transcendental equations cannot be solved in closed form usingthe solve command. (Try it.) However, using Maple's fsolve command, we can alwayssolve any equation numerically to any desired degree of accuracy. The third optionalargument to the fsolve command provides an ability to specify the range in which tolook for a numerical solution. Notice that one of the two solutions for x lies between6 and 8 and that the second solution lies between 8 and 10.

ans1 := fsolve( {E1, E2}, {a,x}, { x = 6..8, a = 0..Pi/6});

ans1 := (a = .3521537562, x = 6.685261073 )

ans2 := fsolve( {E1, E2}, {a,x}, { x = 8..10, a = 0..Pi/6} );

ans2 := { x = 8.695973756'a = .2585032730 }

To show that we have the correct angles, let us substitute these angles into yand simultaneously plot the corresponding trajectories and the sand dunes.

yl := subs(a = 0.2585032730, y(x)):

y2 := subs(a = 0.3521537562, y(x)):

plot( {y1, y2, cos(x) - 1} , x=O..4*Pi);

123

Page 146: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

For all initial angles between these two values, the corresponding trajectory willintersect the sand dunes in three places. Of course, the actual range must be the smallestof these three values. That is, the range is the x coordinate of the first point where thetrajectory strikes the sand dune.

124

Page 147: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

1. Work through the Step by Step examples and make sure you understand all thecommands used. If you are uncertain about any of the commands, use the on-linehelp facility. Make the following change while you are going through theexercises:

2. We will now repeat the analysis given in the Step by Step Examples but increasethe initial speed to vo = 15 m /sec. You should note that this will change some ofthe steps.

a. Obtain a simultaneous plot of the projectile's trajectories for angles from 0 to 85°and the profile of the sand dunes. Over how many dunes does the trajectory of themaximum range travel? Use this simultaneous plot to estimate any angles wherethe trajectory intersects the sand dunes in more than one place. Also estimate thatangle which gives the maximum range and the maximum range.

b. Use the fsolve command to find to 10 significant digits those angles where thetrajectory intersects the sand dunes in more than one place. You should note thatthis problem calls for more than one interval to be identified. The fiirst interval isa special case where the smallest possible angle a is 0°. However, one of thepoints that matches the interval end-point criteria results from a negative angle.Consequently for the first interval, find the second end point only.

c. Use the implicitplot command to show the range as a function of the launch angle a.

d. Find the maximum range and the corresponding angle to ten significant figures.

125

Page 148: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 16 Ballistics on Uneven Terrain

3. The first two examples deal with a projectile that is fired from elevation = 0. Thisimplies that the minimum angle it can be fired at is 0°. With this setup, we mustlaunch the projectile at very steep angles to hit targets in the first valley. In orderto avoid this difficulty, we raise the elevation of the launcher by 0.2 m. Keepingeverything else the same, what is the new equation that describes they-componentof the trajectory? What is the minimum angle at which the projectile will barelyclear the dune it was launched from (remember we can now have negative

4. What is the maximum range if the projectile is fired over the terrain y = 1- cos xinstead of the previous terrain? Note the launch point now lies at the bottom of avalley instead of on top of a hill.

126

Page 149: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

Many problems in science and engineering require the calculation of integrals. Thekinds of problems that involve integration include the calculation of areas, volumes,moments of inertia, centroids, root mean square voltages, pressure behind a dam, andthe solution of differential equations. Maple's symbolic integration command int canfind most of the integrals that can be put in closed form. However, it has been proventhat no finite program can find all the integrals that can be calculated. The heart of thematter is that an infinite variety of substitutions can be made in a solvable integral. Tobe able to integrate the resulting function, the program would have to be able torecognize which substitution was made. Thus, no finite program, including Maple, willever be able to find all the integrals that we may need to calculate.

Our goal in this exploration is more than just showing how to calculate integrals usingMaple. By combining Maple's ability to solve difficult computational problems withyour ability to recognize patterns, you will be able to find many more integrals thanMaple could by itself.

The command for calculating integrals in Maple is the intcommand. Let y be an expression in x.

In the following examples, we show how to calculate integrals using Maple and inaddition, how to calculate some integrals that even Maple cannot do without a little help.

Maple can calculate the indefinite integral of many elementary functions as illustrated inour first example.

127

Page 150: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

Maple Solution To find these indefinite integrals, just use the int command.

128

Page 151: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

129

Page 152: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

The first two examples are all you need to know to calculate most of the integrals thatcan be put in closed form. In the next examples, we reveal some tricks that will giveyou additional mileage when calculating integrals.

An integral is called improper if either of the endpoints is infinite or if the integrandbecomes infinite anywhere in the domain of integration. In this example, we show howto calculate some typical improper integrals.

This integral arises in aerodynamic applications.

Maple Solution

Method 1

The improper integral can be evaluated in two steps by first evaluating the integral over thefimite interval [0, b] and then taking the limit as b tends to infinity.

130

Page 153: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

A simple application of integration is to find the area between two

Maple Solution

First, plot the two curves to visualize the desired

The curves appear to intersect at the points -1 and +1. To verify this, solve for theexact values of the intersection points.

solve(y1 = y2, x); this yields -1,1

Area := int(y1-y2, x = -l............. l); which yields Area := 4

The area between the two parabolas is 4 square units.

131

Page 154: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

Maple may not always be able to find the integral without a little help from you.This is illustrated in the next example.

Maple Solution

Unfortunately, entering the commands:

However, with a little help from you, the integral can be found. In this example, atrick that works is to convert the integral into a simpler one using integration byparts.

Integration by Parts

To convert our integral into a simpler one, let f be as above and introduce the functiong = x. Using integration by parts, and noting that g' = 1, our desired integral can berewritten as:

We have seen that Maple cannot calculate the left hand side of this equation but itmay be able to find the equivalent form on the right if we are lucky. With this hope inmind, we enter the following commands.

g := x: Answer := f * g - int(diff(f,x)*g, x);

This example illustrates that even though computer algebra can find most integrals forus, it is still important to be familiar with the various integration techniques.

132

Page 155: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

133

Page 156: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

1. Evaluate each of the following indefiinite integrals using

2 . Evaluate each of the following definite integrals using Maple.

134

Page 157: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

Hint: First plot the two curves simultaneously. Then find the limits ofintegration by using the solve command to see where the two curves intersect.Finally, calculate the area between the curves using the int command.

Nevertheless this integral can be evaluated with a little help from you. Thetrick is to convert the integral into another form using integation by parts.

Now evaluate the integral of h as follows.

Step 1: Enter f and g'. (You will have to use a suitable name for g')Then integrate g' to find g.

Step 2: Integrate h using the above integration by parts formula .

Step 3: Finish off the problem by applying the expand command.

135

Page 158: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 17 How to Calculate Integrals

10. Total Force on Sailboat Mast

In the accompanying diagram of asailboat, the force of the windexerted on the sail varies with theheight z of the mast. This is anexample of a distributed force. Thesail extends from a height of z = 0at its bottom to z = 30 at its top.

b . Your answer will be expressed in terms of a function that may be unfamiliar toyou. Use the help facility to find the definition of the exponential integralfunction Ei and then plot it to see how its graph looks. This new function Ei isimportant in many engineering and scientific problems.

c. What is the derivative of Ei (x). Why does this make sense given its definition?

136

Page 159: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 18 Solids of Revolution and Tubeplots

Many objects can be described as volumes or surfaces of revolution. When aceramic artist creates a vase on the potter's wheel or when a woodworker ormachinist creates an object on a lathe, the resulting shape is a solid of revolution.

In this exploration we will calculate the volume and surface area of some solids ofrevolution and show how these objects can be drawn using the tubeplot commandcontained in Maple's plots library.

137

Page 160: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 18 Solids of Revolution and Tubeplots

This gives the desired result:The sphere and any other solid of revolution can be plottedusing the tubeplot command in the plots library. We first mustgive a numerical value for the radius, say R = 1.

with(plots): R := 1:opts:=scaling=constrained,numpoints=

20, tubepoints = 20:tubeplot([x,0,0], radius = y(x),

x=-R..R, opts);

Inert Commands

Often we want to represent a function without actually applying the function, and thisis done using the inert form of the command. The inert form is usually indicated bycapitalizing the first letter of the command.

For example, the inert integration command is lift instead of int. These two commandsbehave in quite different fashions. The ink command always attempts to evaluate therequested integral exactly. If it cannot, it may try for a very long time before it realizesthe attempt is useless and just returns the unevaluated integral. On the other hand, theinert form Int wastes no time - it directly returns the unevaluated integral. Thisunevaluated form may later be approximated numerically, wasting no time.

The use of this inert form of integration is demonstrated in the next problem.

a. Find the volume of wood used in each railing.b. If the railing was lathed from a cylinder of wood having radius R = 3, what

fraction of the wood was wasted?

138

Page 161: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 18 Solids of Revolution and Tubeplots

The railings can be plotted using thetubeplot command in the plots library.Note that the tubeplot command onlydraws the surface of the solid of

Notice how our choice of options can be specified before using the tubeplotcommand. This can be particularly useful if these options are to be used more thanonce. Let us now TRY to find the volume of wood in each railing by invokingMaple's symbolic integration routine.Enter the following command.

V := Pi*int(f(x)^2, x=0..7*Pi);

Instead of giving us the volume, Maple snaps out the following retort:Error, (in int) index out of range: function takes only 0 arguments

Whoops! The trouble is that Maple's symbolic integrator cannot handle thisproblem because it uses the maximum function We can, however, obtain anumerical approximation to the volume by first using the inert form Int of theintegration command and then obtaining a floating point approximation using theevalf command.

v := evalf(V); V := 396.6190970

Thus each railing uses a little less than 400 cubic units of

b. What fraction of word is wasted?

More than one third of the wood was wasted just to create this elegant

139

Page 162: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 18 Solids of Revolution and Tubeplots

Even more stunning graphics can be created using the tubeplot command. Tubeplots can bedrawn about any curve in three-dimensional space, not just an axis. Here are a few interestingthree-dimensional graphics that you can create using tubeplot.

TorusCreate a torus using the following command. Then experimentwith as many of the plot options as you can to see their effect.Try different color and lighting schemes.

Tubeplot([cosCt),sinCt),01,t=0..2*P,radius=0.5, scaling =constrained);

SnailCreate a snail-like organism using the following command. Thenexplore as many plot options as you can to see their effect.

tubeplot([t*cos(2*Pi*t)/3,t*sin(2*Pi*t)/3,t], t=0..4,radius=t/6, scaling=constrained);

Although most cooling towers are extremely massive, a newultra-light weight design has been introduced at some power plants.The new cooling towers have the shape of a hyperboloid and arefabricated by covering a network of taut cables with thin, contouredsheet aluminum. The cables are connected to two rigid circular rims,one at the top and one at the bottom. In this exploration weuncover some of the beautiful and perhaps surprising mathematicswhich underlies the design of these graceful towers. The exterior ofthe cooling tower is the surface generated by

Use the tubeplot command to create a graph of the surface of the cooling tower and then find itssurface area S. This calculation is useful in determining the amount of sheet aluminum needed forits fabrication.

140

Page 163: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 18 Solids of Revolution and Tubeplots

Maple Solution

First enter the equation for the radius of the cooling tower as a function of the zcoordinate. Notice that z = 0 at the slimmest point of the tower - not at ground level.

Next create a graph of the cooling tower using the tubeplotcommand.

with(plots):tubeplot([0,0,z], z.-100..75, radius =

r(z), scaling=constrained,b i )

The amount of aluminum sheeting needed for the tower's exteriorsurface can be found using the surface area formula. We willenter it in the inert form Int to avoid a messy looking expression.

A floating point approximation for the surface area S can now be found.

evalf(S); 51624.25460Thus about 52000 square units of aluminum sheeting are required to form theexterior sheath of the hyperbolic cooling tower.

Paradox - How can straight lines be curved?

An extremely curious aspect of the hyperbolic cooling towers istheir fabrication from taut cables. How is it possible to create thecurved exterior surface using only straight lines?

The adjacent graph was created with the following code.First the two circles at the top and bottom are created.

Each point on the base circle is connected to a similar point onthe top circle but rotated by the angle b. Notice how the straightlines form the hyperboloid. The function "cable" draws a linefrom the base circle to the top circle. The function "cables"draws 40 cables which flesh out the construction.

with(plots):circle1 := spacecurve([cos(t), sin(t), 0], t=0. .2*Pi,

color = black):

141

Page 164: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 18 Solids of Revolution and Tubeplots

By treating the rotation angle b as the animation parameter, one can create ananimation which clearly reveals how the curvature of the hyperboloid depends on b. Asb increases from 0 to π radians, the resulting surface evolves from a cylinder to ahyperboloid to a double cone. Try it using the following code. Please note, it will take a

Volumes of revolution. Use the scaling=constrained option for all the following exercises.

142

Page 165: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 18 Solids of Revolution and Tubeplots

b. Find its surface area S.

c. Find the volume V of the tower's

143

Page 166: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 19 Impedance and Complex Numbers

Impedance is a fundamental property of electical circuit components. The impedance Zof a circuit component is represented by a complex number. Thus, it should be nosurprise that the algebra of complex numbers can be very useful in calculating the netimpedance when these components are connected in electrical circuits. The backgroundneeded for this exploration is given by the following two results.

Impedances Connected in SeriesWhen n impedances Z1, Z2, . . . , Z„ are connected inseries, the net impedance Z is given by the relation:

Z = Z1+Z2+….+Zn

In this exploration, we demonstrate how Maple's complex algebra routines can dramaticallysimplify the analysis of steady state ac circuits composed of linear passive elements.

Inductive and Capacitive ImpedancesA net impedance Z = R + j X is called inductive if the imaginary component X is positiveand capacitive if X is negative.

144

Page 167: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 19 Impedance and Complex Numbers

Note - Since electrical engineers universally prefer to denote the square root of -1 byj instead of Maple's default notation I, we have used the alias command to reflectthis convention. alias(j = sqrt(-1) , I = I);

alias( j = sqrt(-1) , I = I):

Since the impedances are connected in series, their net impedance is given by Z = Z1 +Z2 Simply enter the impedances into your Maple worksheet and add.

Z1 := 5 + 8*j: Z2 := 4 + 6*j: 2:= Z1 + Z2;

Voila! The net impedance is found to be: Z:= 9 + 14 j

145

Page 168: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 19 Impedance and Complex Numbers

The two coils from example 1 are reconnected in parallel. Recallthat the first coil has an impedance of Z1 = S +8j and that thesecond coil has an impedance of Z2 = 4 + 6j .

Find the total impedance Z of this parallel combination.

Use the solve command to find the total impedance Z .

If a floating point form is desired, use the evalf command.

evalf ("); which yields 2.223826715 + 3.429602888]

146

Page 169: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 19 Impedance and Complex Numbers

a. Find the total impedance if the coils are combined in series.b . Find the total impedance if the coils are combined in parallel.

2. Three impedances in series.Two coils and a capacitor are connected in series in a circuit operating at afrequency of 100 radians/second. The first coil has a resistance of 20 ohms and areactance of 50 ohms. The second coil has a resistance of 15 ohms and a reactanceof 35 ohms.

Since the components are connected in series, the total impedance is Z = Z1 + Z2 + Z3 where Z1 and Z2 are the coil impedances and Z3 isthe impedance of the capacitor.

147

Page 170: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 19 Impedance and Complex Numbers

148

Page 171: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 20 Patterns of Light in a Cup

Have you ever looked into a cup of soda or coffee and examined the patterns of lightthat can be seen on the surface? Provided the light is from a distant point source such asthe sun or an incandescent lightbulb, you will be able to see a luminescent heart-shapedpattern playing on the liquid surface. In this exploration, our goal is to elucidate theorigin of these delightful patterns.

The figure shows a view of the cup from above. An incoming light ray is reflected fromthe cup at the point P1. Assume the rim of the cup is a circle of radius 1 and that thevertical coordinate of the incoming ray of light is y. The coordinate y is called the impactparameter. Let t denote the angle between the positive x-axis and the line segmentconnecting the center of the circle (cup) to the point Pi. By Snell's Law, when the light

149

Page 172: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 20 Patterns of Light in a Cup

Consider a light ray approaching the cup from the left as shown. The distance h betweenthe light ray and the center of the cup is called the pact parameter of that particular ray.Since the cup has radius one, only those rays satisfying the inequality -1 <_ h <_ 1 willbe involved. For each such value of the impact parameter h, we would like to draw thecorresponding light rays.

Open a new session in Maple. First define a set of impact parameters (using thesequence command seq ) at which to plot the light rays.

impacts := {v/50 $ v=-50..50}:

This defines a set of impact parameters ranging from -1 to +1 separated by 1/50. If youare short on memory, you may want to reduce the number 50 to a smaller number.

For each such value we will plot the corresponding light ray from the pointP1 = (cost, sint) to the point P2 = (-cos(3t), -sin(3t)).

We must first convert the impact parameters into the corresponding angles t.Since we have seen that t = arcsin h , this is easily achieved with the command:

angles := map(arcsin, impacts):

Next we generate a sequence of line segments, one for each angle. The sequence ofline segments is called rays l since they correspond to the light rays resulting fromthe first reflection of the incoming parallel rays.

rays1 := seq([[cos(t), sin(t)], [-cos(3*t), -sin(3*t)]],t = angles):

Next we obtain a plot of this set of light rays.

plot({rays1}, color=yellow,scaling =

Notice the cusp clearly visible on the right side.

150

Page 173: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 20 Patterns of Light in a Cup

Earlier we showed that if the point of reflection makes an angle t with respect tothe center of the circle, then the reflected ray is a line segment connecting thepoints P1 = (cost, sint) and P2 = (-cos(3t), -sin(3t)). After checking that the slopeof the line through PI and P2 is tan 2t, its equation is found to be:

By expanding the tangent and cross-multiplying, this can be rewritten in the form:

(y - sin t) cos 2t - (x - cos t) sin 2t = 0

Let us label this equation E 1 and enter it into a Maple document.

E1 :_ (y - sin(t))*cos(2*t) - (x - cos(t))*sin(2*t) = 0;

E1 :_ (y - sin(t)) cos(2 t) - (x- cos(t)) sin(2 t) = 0

We can simplify this equation by combining all the trig terms together using Maple'scombine command.

E1 := combine(E1, trig);

El := cos( 2 t) y + sin( t) - sin( 2 t) x = 0

For more information on the combine command, use the on-linehelp. For each value of the angle t, equation E 1 determines a line. E 1 is anequation of the form:

F (x, y, t) = 0

The envelope of this family of lines is found by setting the partial derivative with respect to theparameter t equal to zero. That is, we must solve both the equations:

Equations for the envelope

F (x, y, t) = 0 Eqn 1

Ft (x, y, t) = 0 Eqn 2

E2 := diff(E1, t);

E2 :_ -2 sin(2 t) y + cost) - 2 cos(2 t) x = 0We now have two equations, E1 and E2, for the envelope of this family of line segments. Whenthe line segments are light rays as in our example, it is common to refer to the envelope as thecaustic. To find the equation of the envelope we solve these two

151

Page 174: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 20 Patterns of Light in a Cup

equations simultaneously for x and y. This gives us a parametric description of thecaustic. (Trying to explicitly solve for y as a function of x results in a very ugly mess.)

envelope := solve({E1, E2}, {x, y});

We can see that the above parametric equations for x and y are not as simple as theyshould be. For example both denominators can be simplifiied to 1 by the Pythagoreanidentity. In order to compare the caustic to known families of curves we will combineall the trigonometric terms together using the combine command.

combine(envelope,trig);

Having found the equations for the caustic let us assign to x and y the above values.Recall that in Maple the character " denotes the last computed result.

assign(");

To see that this has indeed assigned appropriate values for x and y we can ask Maple toprint out their values.

x; y;

In summary, we have shown that the first-order caustic is given by theparametric equations:

Recall that an i cl id is the curve generated by a fixed point P on the circumference ofa circle of radius r as it rolls around the outside of a circle of radius R. Using ageometric argument, the parametric equations for an epicycloid can be shown to be:

152

Page 175: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 20 Patterns of Light in a Cup

Let us now create a parametric plot of the first-order caustic. We also plot a circle of

radius one which represents the cup.

caustics := plot( [x,y, t=-Pi/2..Pi/2], color=yellow):

cup := plot( [cos(t),sin(t),t=-Pi..Pi], color=blue):

with(plots):display({cup, caustic1},scaling=constrained);

The resulting caustic appears identicalto the curve we saw in example 1.

153

Page 176: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 20 Patterns of Light in a Cup

Part A - Discovering the Patterns of the Caustics

1. Work through the step-by-step examples.Then create a simultaneous plot of the first-order caustic and the first set ofreflected light rays. The graph will look even beer if you also display the rim ofthe cup. The cup can be drawn using the command:

cup := plot([cos(t),sin(t),t=-Pi..Pi],color=blue, scaling=constrained):

2. The Second-Order CausticIf the surface of the cup is particularly reflective, light may reflect from the rimmore than once revealing a second caustic. If you look very carefully you maybe able to detect the second-order caustic in a cup of coffee. (It works better withcream in the coffee.)

a. Create a graph showing a set of second order reflections for various impactparameters. Show just that portion of the light path between the points P2 and P3.The following code will help you.

restart:N := 50: impacts := {v/N $ v=-N..N}:angles := map( arcsin, impacts):rays2 := seq([C-cos(3*t),-sin(3*t)],Ccos(5*t),sin(5*t)]],t=angles):plot( {rays2}, color=yellow, scaling=constrained, axes=none);

b. Describe the shape of the second order caustic noting any differences between itand the first order caustic.

3. The Third-Order CausticCreate a graph showing a set of third order reflections for various impactparameters. Show only that portion of the light path between the points P3 andP4. Unfortunately, this graceful pattern can rarely be seen by the unaided eye.The coordinates of the points P3 and P4 are:

P3 = (cos5t, sin5t ) and P4 = (-cos7t, -sin7t )

154

Page 177: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 20 Patterns of Light in a Cup

b. Describe the shape of the third-order caustic noting any differences between itand the first and second order caustics.

4. Fourth-Order Caustica. Based on the patterns observed in the first second and third order caustics,

predict the appearance of the fourth-order caustic. What side of the cup do youexpect the cusp to be on. Where do you think the cusp will cross the x-axis? Howmany turns will the caustic make about the origin?

b. Now test your predictions. Plot a sequence of line segments from P4 to PS for aset of impact parameters. (You will need a large number to see the pattern.)The coordinates of the points P4 and PS are:

'P4 = (-cos7t, -sin7t ) and P5 = (cos9t, sin9t )

Part B - Equations for the Caustics

Now that we have discovered some of the beautiful patterns of light that can form in acup due to multiple reflections, it's time to find the equations that describe them.

5. Equation for the Second CausticA light ray strikes the cup at a point that makes an angle t with respect to thecenter of the circle, is reflected once and then a second time. The equation for thisfamily of second order rays is:

(y + sin3t) cos 4t - (x + cost) sin 4t = 0

a. Label this equation E l and enter it into a Maple worksheet after using therestart command to clear any assigned variables. Simplify the resultingequation using the combine command with the Ida option and redefine E1 as thesimplified form.

b. A second equation for the envelope of this family of light rays is found by takingthe partial derivative with respect to the parameter t . Differentiate the firstequation with respect to t and denote the result by E2.

c. Find the equation of the envelope (second order caustic) by using the solvecommand. Solve the set of equations { E 1, E21 for the set of unknowns { x,y } .Simplify the equation by using the combine command with the trig option.Label the simplified set of equations caustic2.

6. Create a simultaneous plot of the second-order caustic and the corresponding setof reflected light rays. The graph will look even better if you also display the rimof the cup.

7. Compare the equations for the second order caustic found in the last exercise withthe standard parametric equations for an epicycloid:

155

Page 178: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 20 Patterns of Light in a Cup

The equations are different. Is it possible to redefine the parameter t andto choose values for R and r so that the resulting epicycloid is identical tothe equation of the second order caustic?

8. Equation for the Third CausticDerive the equation for the family of third order rays.Recall that the coordinates of the points P3 and P4

You need only find the equation of the line through these two points.

a. Label this equation E 1 and then enter it into a Maple worksheet after using therestart command to clear any assigned variables. Simplify the resulting equationusing the combine command with the trig option and redefiine E 1 as the simplifiedform.

b. A second equation for the envelope of this family of light rays is found by takingthe partial derivative with respect to the parameter t . Differentiate the firstequation with respect to t and denote the result by E2.

c. Find the equation of the envelope (third order caustic) by using the solvecommand. Solve the set of equations { E 1, E21 for the set of unknowns { x,y } .Simplify the equation by using the combine command with the " option. Label thesimplified set of equations caustic3.

9. Create a simultaneous p-lot of the third-order caustic and the corresponding setof reflected light rays. The graph will look even better if you also display the rimof the cup.

BonusIn all the above explorations, the source of light was assumed to be an infinite distancefrom the cup. Investigate how the patterns and equations change if the point light sourceis located a finite distance R from the center of the cup.

156

Page 179: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 21 Theory of the Rainbow

In the words of Descartes, "The rainbow is such a remarkable marvel of nature ... that Icould hardly choose a more suitable example for the application of my method. "Today, quantitative modeling of the rainbow is also a splendid example for theapplication of computer algebra. In this exploration we will show how the graphical,numerical and symbolic capabilities of computer mathematics can enhance ourunderstanding of the rainbow.

Every rainbow is actually a complete circle - the full circle cannot always be seen fromthe ground but may be observed from an airplane. The center of the circle is always at apoint in the sky opposite from the Sun. The single bright arc visible after a rain storm iscalled the primary rainbow. The colors of the rainbow always follow the samesequence. Violet is the innermost arc, followed by arcs of blue, green, yellow, orangeand finally red. Higher in the sky, one sometimes is treated to a secondary rainbow inwhich the colors appear in reverse order. The region of sky between the two rainbows isconsiderably darker than the surrounding sky. This dark region between the tworainbows is called Alexander's Dark Band after the Greek philosopher Alexander ofAphrodisias who first described the phenomenon around 200 AD. The angle betweenthe primary rainbow rays and the incident sunlight is about 42° and was first measuredby Roger Bacon in 1266. The secondary bow is higher in the sky at about 50°.

The fundamental principles that determine the nature of the rainbow are those thatgovern the interaction of light with transparent media - reflection and refraction.Although the speed of light in a vacuum is a universal invariant, (denoted by the letterc), light travels through a transparent material such as water at a reduced speed v. Theratio of the speed of light in vacuum to the speed in a given material is called the indexof refraction n. Since light travels only slightly slower in air than in vacuum, the indexfor air is only slightly greater than 1. However, light travels considerably slower in

t Th i d

157

Page 180: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 21 Theory of the Rainbow

It was shown by Theodoric of Freiberg in 1304. (and laterrediscovered by Descartes) that the primary rainbow ismade up of light rays that enter a water droplet and reflectonce from the inner surface before exiting the droplet. Thesecondary rainbow consists of rays that undergo twointernal reflections. Consider a spherical water dropletcentered on the origin O and having a radius of one unit. Aray of sunshine is illustrated entering the water droplet atthe point P1. Let a denote the angle of incidence at thispoint. The coordinates of the point of entrance are:

158

Page 181: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 21 Theory of the Rainbow

Using the point-slope formula, the equation of this secondary emitted ray is:

(y - sin (4b - a )) cos (6b - 2a) - (x - cos (4b - a )) sin (6b - 2a) = 0

We now have enough physical and geometric background to explore all the phenomenamentioned above including the primary and secondary rainbows and Alexander's darkband.

Consider a ray of sunlight entering our water droplet at the point PI, internally reflectingat the point P2 and exiting at the point P3. Denote the angle of incidence by a and let bdenote the angle of refraction. Although the index of refraction for water has a smallwavelength dependence, during the first portion of this exploration we will approximate

159

Page 182: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 21 Theory of the Rainbow

plot({a, b(a)}, a = 0..Pi/2,scaling = constrained);

The resulting graph is shown to the right.Notice that the angle of refraction issmaller than the angle of incidence.

160

Page 183: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 21 Theory of the Rainbow

Obtain expressions for the scattering angle in the case of primary rays (oneinternal reflection) and secondary rays (two internal reflections).

Scatter(1,a); Scatter(2,a);

Create a simultaneous plot of the primary and secondary angle of scatter as a functionof the angle of incidence.

plot( {Scatter(1,a), Scatter(2,a)}, a=-Pi/2..Pi/2);

The resulting plot clearly revealsthat both scattering angles have asingle maximum and minimum.

Notice also that there is a gapbetween the maximum primaryscattering angle and the minimumsecondary scattering angle.

We will find the extrema for theprimary rays leaving the secondaryravs as an exercise.By Fermat's Theorem, the extrema can be found by setting the derivative with respectto a equal to zero.

Eqn1 := diff(Scatter(l,a), a) = 0;

Although we have obtained an exact answer, we will also show how to solve forthe critical points using the fsolve command. This will be useful when the indexof refraction is entered as a floating point number. The minimum scattering anglefor primary rays occurs when the angle of incidence is:

amin := fsolve(Eqn1, a, a = 0 .. Pi/2);

amin := 1.036570282 Substituting thisvalue into the formula for the primary scattering angle gives:

161

Page 184: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 21 Theory of the Rainbow

evalf( Scatter(1,amin)); evalf( convert(", degrees));

2.408036724 137.9703412 degrees

Thus the minimum scattering angle for the primary rays is about 138 degrees agreeing withthe angle originally recorded by Roger Bacon.

In the following plot of the primary and secondary scattering angles, why is it OK tosubtract 2pi from the secondary angle?

plot( {Scatter(1,a), Scatter(2,a) - 2*Pi}, a=-Pi/2 .. Pi/2, 0 ..Pi);

Alexander's Dark Band

Notice that no light is scattered into theshaded region shown in the resulting plot.Thus the band between the primary andsecondary rainbows is darker than the restof the sky because none of the raysundergoing either one or two internalreflections are scattered into this region.

We would now like to simplify the equations for the family of primary rays.The primary rays were described by the family of lines:

(y+ sin(4b-a ))cos(4b-2a) - (x+cos(4b-a ))sin(4b-2a) = 0Enter this equation into Maple.

(y+sin(4*b-a)) * cos(4*b-2*a) - (x+cos(4*b-a)) * sin(4*b-2*a) = 0: The

simplest way to cleanup this equation is to combine together the trio terms.

E1 := combine( ", trig);

El := cos(-4 b +2 a)y+sin(a)+sin(-4b +2 a)x=0

In this form, the equation appears very much simpler.

162

Page 185: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 21 Theory of the Rainbow

In this example we would like to trace the light rays as they interact with our raindrop.To describe each light path we will need to compute five points as shown in thediagram. We arbitrarily choose two vertical lines to the left of the raindrop. The firstpoint "In" is where the incoming ray strikes the first line. The next three points are P 1,P2 and P3 introduced earlier. Finally, to represent the outgoing rays, we choose a point"Out" where the primary ray strikes the second line. By plotting these five points wetrace out the path of each light ray! We already have the equations for the points P1, P2 and P3 as functions of the angle ofincidence.

P1 = (-cosa, sina),

P2 = (cos(2b-a), sin (2b-a))

P3 = (-cos(4b - 2a ), - sin (4b - 2a) )

Enter each point as a vector function of the incidenceangle a and be sure to explicitly write b as a function of a.

Warning'. - You must write b(a) instead of just b. Inaddition, if you have recently quit, be sureto reenter n and b(a) as in example 1.

Light path represented as asequence of five points.

To define the point In(a), we arbitrarily select the line x = - 4, and enter:

To define the point Out(a), we arbitrarily select the line x = - 3, and select that pointwhere the corresponding primary ray (called E 1 earlier) intersects this line. Solvingfor the y coordinate we find: x := -3: solve(E1, y);

163

Page 186: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 21 Theory of the Rainbow

We can now define the path through all five points by entering the command:

[In(a), P1(a), P2(a), P3(a), Out(a)]:

Here is a sample output.

ray(0);

[ [-4, 01, [-1, 01, [ 1, 01, [ -1, 01, [-3, 0]]

In addition to the light rays, we would also like to represent the raindrop on our plot.The cross-section of our raindrop is a unit circle which can be representedparametrically by the equations:

Using the plot command for parametric functions we obtain a graph of the raindrop byentering:

raindrop := plot([cos(t), sin(t), t=0..2*Pi] , color = blue,scaling = constrained, axes = none):

raindrop;

rays := plot( {seq( ray(Pi*k/40), k = -10..10)},

scaling = constrained, color = yellow):

with(plots): display([rays, raindrop]);

164

Page 187: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

165

Exploration 21 Theory of the Rainbow

The resulting plot is shown to the right. Notice the twoforbidden regions on the right of the raindrop where noneof the primary rays enter. Also notice that all of the light isreflected back towards the sun forming a cone-shapedregion of illumination. The outer boundary of the lightcone is defined by the minimum scattering angle.

Page 188: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 21 Theory of the Rainbow

1. This is a rather challenging computer algebra exploration but one with manyrewards. You must first carefully read the background section before proceeding.Then carefully work through the "Step by Step" examples and use the on-line helpto investigate any commands with which you do not feel comfortable.

2. Although we explained many of the features of the rainbow in the "Step by Step"examples, we did not explain the most obvious feature of rainbows - their greatarcs of color. Above we stated that the index of refraction of water is aboutn = 4/3. However, this is not exactly true. In fact the index of refraction ofwater is dependent on the wavelength of light. Red light has a longer wavelengththan violet so it has a different index of refraction as well. The index of refractionfor red light is n = 1.332 while the index is n = 1.344 for violet lightAlthough both of these values are near the value of 4/3 we used earlier, they areslightly different. This small dependence of the index of refraction on the color oflight is called dispersion and is responsible for the colors of the rainbow.

a. Find the primary rainbow angle for red light and for violet light.

b. Find the secondary rainbow angle for red light and for violet light.

c. State to at least four significant digits the portion of the sky into which no primaryor secondary rays of red light are scattered. (Alexander's Dark Band for red light)

d. State to at least four significant digits the portion of the sky into which no primaryor secondary rays of violet light are scattered. (Alexander's Dark Band for violetlight)

3. Create a plot of a set of secondary rays leaving a water droplet.

166

Page 189: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

167

Exploration 21 Theory of the Rainbow

References:

1. The Rainbow: From Myth to MathematicsCarl B. Boyer, 1987

2. The Rainbow BookF. Lanier Graham, 1979

3. Rainbows: Halos and GloriesRobert Greenler, 1980, repr. 1990

4. The Theory of the RainbowH. Moyses Nussenzveig, Scientific American, Pages 116-127, April 1977

Page 190: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 22 How to Solve Differential Equations

Many systems of interest to scientists and engineers are modeled by differential equations.Students often find their first encounter with differential equations a bit frustrating because ofthe great number of techniques required to find their solutions. However, using Maple,solutions are readily uncovered, enabling the student to explore the applications of differentialequations in a vigorous and lively fashion. A greater range of equations becomes accessible,plots and graphs can be generated and the effect of varying the model and its parameters can beexplored.

Differential equations are solved in Maple using the dsolve command.

dsolve(DE, var, option);

This command solves the differential equation DE for thevariable var using certain options.

In the examples which follow we show how to use the command dsolve to solve many of theordinary differential equations that an engineer or scientist is likely to encounter. Note that thecommand is called dsolve because it is used to solve differential equations.

Maple Solution

Step 1- First enter the differential equation being careful to write y(x) instead of just y.

DE := diff(y(x),x) = 2*x + 3*y(x);

Warning 1 - The dependence of the unknown y on the independent variable x must bedeclared explicitly by entering y (x) instead of just y. Failure to do this will result in anerror message.

Step 2 - Use the dsolve command to solve for that solution satisfying y(0) = 0.

dsolve({DE,y(0)=0}, y(x));

168

Page 191: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 22 How to Solve Differential Equations

Notice how above we enclosed both the initial condition and the differential equation insideparentheses.

Next we find the general solution with no initial condition. Enter the following command.

Maple Solution

The system to be solved consists of the differential equation and the two initial conditions.How do we specify these two conditions to Maple? What's new here is that we need a wayto specify the initial velocity, but our unknown is the position - not the velocity. Of course,the velocity is the derivative of the position and this motivates the following notation forentering the initial conditions.

DE := diff(x(t), t$2) _ - g: sys := {DE, x(0)=xo, D(x)(0) = vo}:

Notice how the initial velocity was indicated using the derivative operator D.

Using the dsolve command to solve the system;dsolve(sys, x(t));

yields the classical result

169

Page 192: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

170

Exploration 22 How to Solve Differential Equations

In some cases, the solve command returns an answer in an implicit form instead ofreturning an explicit expression for the unknown. This problem can often be avoidedusing the explicit option as in the next example.

Maple Solution First enter the differential equation and then apply thedsolve command.

DE := diff(y(x), x) = - x/y: dsolve(DE, y(x));

To force an answer in explicit form, one can use the explicit option as follows.

dsolve(DE, y(x), explicit);

which yields two explicit expressions for y(x):

These explicit solutions correspond to the upper andlower parts of a circle. To find the solution whichsatisfies the initial condition y (3) = 4 enter thecommand:

dsolve({DE, y(3) = 4}, y(x));

Geometrically, only the positive square root correspondsto the desired solution. Did Maple make a mistake?

Warning - You must be very careful using square roots with Maple!

Page 193: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 22 How to Solve Differential Equations

Let N (t ) denote the number of bacteria at time t in an unlimited growth medium.Under such ideal conditions, the number of new bacteria produced in a time interval isproportional to the present number of bacteria. Thus the bacterial growth can bemodeled by the differential equation:

Find an expression for N as a function of time if the initial number is Ni.

Maple Solution

This is a one liner. Just enter the following command and out pops the answer.dsolve({diff(N(t), t) = k*N(t), N(0) = Ni}, N(t));

Lascaux Cave, near Monignac in DordogneFrance is one of the most spectacular examples ofprehistoric art ever discovered. Its superbpaintings of polychrome animals were discoveredby four youths in 1940 while looking for their lostdog. This sketch of one of the prehistoricpaintings from Lascaux Cave, depicts a woundedbison attacking a hunter and features a small birdin the lower right. The art of Lascaux dates to theearly Magdalenian phases of the UpperPaleolithic period. How were archaeologists ableto date the cave?

The answer involves solving a differential equation! The living tissues of both plants andanimals contain carbon, derived ultimately from the carbon dioxide in the atmosphere.Most of this carbon consists of the stable isotope C12, but a small proportion consists ofthe radioactive isotope C 14. Metabolic processes do not discriminate between theseisotopes to any great degree, so that the C 14/C 12 ratio for any organism is essentiallythe same as that in the atmosphere At the time of death however, metabolic processescease, and the percentage of the original C14 decreases steadily due to radioactive decay.

171

Page 194: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

172

Exploration 22 How to Solve Differential Equations

Let x (t) denote the percentage of the original C 14 remaining at a time t afterdeath. This percentage decreases at a rate proportional to itself, that is:

where k is called the decay constant. The decay constant can be found using the fact thatthe half-life of C14 is 5500 years.

Inside this cave, scientists found several pieces of charcoal containing approximately 15%of the original C14. The charcoal pieces were left over from fires which were used forcooking and warmth.Solve the above differential equation, and use the given data to estimate the age of thecharcoal pieces.Maple Solution The initial percentage of C14 in the charcoalpieces is 100%.

Using the dsolve command, we can find the percentage x as a function of t .

DE := diff(x(t), t) _ -k*x(t):E1 := dsolve({DE, x(0)=1001, x(t));

Notice that the new value of k is automatically substituted into equation E 1.Finally, we can determine the age of the charcoal pieces. Since the charcoal pieces contain 15%of the original C14, we need only solve for that value of t when x(t) = 15.

evalf(solve(op(2, E1) = 15, t));

Entering this equation yields 15053.31077

Thus, the burnt pieces are about 15 thousand years old.

Next, solve for the decay constant k given that the half-life of C14 is 5500years. That is, when t = 5500 the percentage of the original C14 has decreased

Page 195: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 22 How to Solve Differential Equations

Then find that solution satisfying the initial condition y(0) = 1.

(Be sure to enter the variable y in the form y (t) which explicitly shows the timedependence as required.)

a . Using the dsolve command, obtain an implicit expression for the unknown y (t).Then apply the solve command to the solution to obtain an explicit expressionfor the unknown.

b . Obtain the explicit expression for y (t) in one step by using the dsolve commandwith the explicit option. Comparing these two approaches, how do you thinkthe explicit option to the dolve command works?

4. Damped OscillationsThe accompanying diagram shows a mass msuspended from a spring and connected to adashpot. The force of viscous damping isproportional to the mass's velocity. Denoting thespring constant by k, and the damping constant byc, the equation of motion for the system is foundfrom Newton's second law to be:

where y (t) is the displacement of the mass fromits equilibrium position. Assume that the mass,damping constant and spring constant have thevalues m = 1, k = 2 and c = 1/2. At time zero,the mass passes through the equilibrium positiony (0) = 0 with a speed y'(0) = 1.

a . Enter the differential equation, and then enter the three constants m, k and c.

b . Solve the differential equation for that solution satisfying the initialconditions: { y(0) = 0, y'(0) = 1 ) using the dsolve command.

173

Page 196: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

174

Exploration 22 How to Solve Differential Equations

c . Use the assign command to define the solutions and then create a graph of the object'smotion. Choose a sufficiently large interval to reveal the damping of the oscillations.This type of motion is called underdamped motion.

d . Show, using the limit command, that the oscillations die out for large time.

5. PendulumWhen solving differential equations, it isnot always possible to obtain the answer interms of the elementary functions you maybe familiar with. A classical case is that ofthe pendulum whose exact solutioninvolves elliptic integrals of the first kind.For a pendulum of length L and mass mthe angle of displacement satisfies:

Solve the reduced pendulum equation for that solution which at time 0moves through the lowest point with angular speed equal to one radian persecond.

6 . Archaeology - During the construction of a hydroelectric dam, an engineeringfirm has discovered some curious bone artifacts showing a high degree ofworkmanship. The company suspects that the bones may have archaeologicalsignifiicance and has hired a scientific team to date the artifacts. The oldest knownsuch objects in North America are only a few thousand years old. If the boneartifacts are even older, they would represent a find of amazing archaeologicalsignificance, potentialIy rewriting our understanding of the human settlement ofNorth America. Tests show that the bones contain only 5% of their original C14.

a. Estimate the age and importance of the bones.

b. Stopping the project so that an archaeological team could study the area andpreserve additional artifacts would cost the engineering firm millions of dollars. Asthe project director, what policy would you recommend to the firm after such afind?

Page 197: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

175

Exploration 22 How to Solve Differential Equations

7 . Humpty Dumpty - In a tragic accident, Humpty Dumpty sat on a wall, lost hisbalance and had a great fall. Neglecting air resistance, his fall is described by thedifferential equation:

where v (t) is his velocity at time t and g is the acceleration of gravity.

In the soon to be reIeased rewrite for young children, that lovable egg is back, andpredictably falls again, but this time he has a large umbrella which he uses to safelyreach the ground. Assuming that the slowing force of the umbrella is proportionalto the square of the velocity, his fall is described by the equation:

where k is the coefficient of air resistance divided by hismass. In both cases, his initial velocity is zero.

a . Use the dsolve command to find his velocity as afunction of time, in both versions of the fairy tale.

6 . In the version with the umbrella, his speed dependson the value of k. Find the limit of v as k approacheszero. What does this mean physically?

c . Create plots of his speed for various values of k.What effect does increasing k have?

d . Humpty is unlikely to survive a fall if he hits theground with a speed greater than 1 meter persecond. If the wall is 10 meters high, what is theminimum value of k so that his speed does notexceed 1 meter per second?

Page 198: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 23 Systems of Differential Equations

Many physical and engineering problems are described by systems of differentialequations -the word system just means that there may be more than one differentialequation. A solution to a system of differential equations must satisfy each differentialequation in the system. Finding these solutions is often a very messy problem, and forthose who have done many by hand, the ease of solution using computer algebra isalmost miraculous. In this exploration, we show how to solve systems of differentialequations using Maple and investigate the solution of a number of interestingmechanical and electrical problems.

Consider the system of first order differential equations:

178

Page 199: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 23 Systems of Differential Equations

Assigning and Graphing the Solutions To plot these solutions, we first assign the

above answers using the assign command.

assign(ans);

This assigns to the left hand side of each equation in the set ans, the expressionsappearing on the right hand side. Thus, if we ask for the value of theexpressions x (t) and y (t) we get the solutions.

The solutions can be represented by several different graphical techniques.

1. We can create a simultaneous plot 2. We can create a parametricplotof the two unknowns: of the two unknowns.

plot({x(t), y(t)}, t = 0. .2*Pi); plot([x(t), y(t), t - 0..2*Pi]);

Warning - When we assigned the solutions using the assign command this did not definethem as functions of t. Thus for example, we cannot find the value of x when t = 0 byentering x(0) as we would if x were defined as a function. Indeed if we try this,

x(0) ; all we get back is x( 0 )

This is because the assign command defined x(t) as just an ordinary name - it is not afunction. To convert it into a function, we use the makeproc command in the studentlibrary.

with(student):

x := makeproc(x(t), t); y := makeproc(y(t), t);

Now x and y are functions of time and can be evaluated at any point as shown below:

x(0); y(0); gives 0, 1

After assigning the solution to one problem, you may want to solve another problem. It isimportant that you unassign any of the assigned variables before starting the new problemor you will get an error message. This is easily done by entering the restart command.

179

Page 200: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 23 Systems of Differential Equations

Consider the system of three differential equations:

Find the solution satisfying the initial conditions { r(0) = 1 , q (0) = 2 , z (0) = 3 }.

Maple Solution Step 1- Declare the set of dependent variables - these are the three

unknown functions. Be sure to enter the restart command first to clear the worksheet or

you may get an error.

restart:

var :_ {r(t), q(t),z(t)}:

Step 2 - Enter the set of differential equations and initial conditions.

DE1 := diff(r(t), t) = r(t);

DE2 := diff(q(t), t) = r(t) + q(t);

DE3 := diff(z(t), t) = r(t) + q(t) + z(t);

sys :_ {DE1, DE2, DE3,r(0)=1 , q(0)=2 , z(O).3};

Step 3 - Solve the system using the dsolve command with the laplace option.

ans := dsolve(sys, var, laplace);

After entering the commands in the above three steps - out pops our answer.

Maple has returned explicit expressions for all three of the unknown functions

Graphing the solutions

To assign and then plot the solutions, enter thecommands:

assign(ans);

plot({r(t), q(t), z(t)}, t=-2 .. L4);

180

Page 201: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 23 Systems of Differential Equations

Solve the following system of three differential equations

subject to the initial conditions:

{ x(0) = 1 , x'(0) = 1 , y(0) = 2 , y'(0) = 0 , z(0) = 2 , z'(0) = -2Maple Solution

Step 1 - Declare the set of dependent variables - these are the unknown functions. Be

sure to enter the restart command first to clear the worksheet or you will get an error.

restart: var := {x(t),y(t), z(t)}:

Step 2 - Enter the set of differential equations and initial conditions.

DE1 := diff(x(t),t, t) - y(t) + 2*z(t) = 3*exp(-t):DE2 :_ -2*diff(x(t), t) + 2*diff(y(t), t) + z(t) = 0:DE3 := 2*diff(x(t), t) - 2*y(t) + diff(z(t), t) + 2*diff(z(t),t,t)=0:

sys :_ {DE1, DE2, DE3, x(0) = 1, D(x)(0) = 1, y(0) = 2,D(y)(0) = 0, z(O) = 2, D(z)(0) = -2}:

Step 3 - Solve the system using the dsolve command with the laplace option.

ans := dsolve(sys, var, laplace);

After entering the commands in the above three steps - out pops our answer.

To plot the solutions, we first assign the above answer andthen create a simultaneous plot of all three dependentfunctions.

assign(ans);plot( {x(t), y(t), z(t)}, t=-3..3,0 6)

Alternatively, the solution may be represented as a curve in three dimensional spaceusing the spacecurve command in the plots library. Try it!

181

Page 202: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 23 Systems of Differential Equations

Find the current in each loop as a functionof time given that all charges and currentsare zero when the switch is closed.

Derivation of the Differential EquationsLet i t (t) and i2(t) be the currents flowing inthe left loop and the right loop respectively.Let Q2(t) be the charge on the capacitor.

We will now solve this system of differential equations using Maple.

Maple Solution

Step I - Declare the set of dependent variables.Note that the second variable is Q2(t) not i2(t).

restart: var :_ {i1(t), Q2(t)}:

Step 2 - Enter the differential equations and the initial conditions.

DE1 := diff(i1(t),t) + 400*i1(t) - 400*diff(QZ(t),t) = 100:

DE2 :_ -Z*i1(t) + 5*diffCQ2(t),t) + 200*Q2(t) = 0:

sys :_ {DE1, DE2, i1(O) = 0, Q2(0) = 0}:

Step 3 - Solve the system using the dsolve command with the laplace . option.

ans := dsolve(sys, var, laplace);

After entering the commands in the above three steps - out pops our answer.

182

Page 203: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 23 Systems of Differential Equations

Step 4 - But we're not done! The problem asked for the currents. To find i2, wewill need to differentiate Q2. Assign the above answers.

assign(ans):

Now we can calculate the current in the second loop as follows:

i2(t) := diff(Q2(t),t); which yields

Graphing the solutions

Create a simultaneous plot of thecurrent in each of the two loops.

plot({i1(t),i2(t)}, t=0..1/10);

The above command yields a plot ofthe two currents during the first tenth ofa second after the switch is closed.

The graph reveals that both currents quickly approach a steady state value. Althoughwe can see the limiting values by inspection of it and i2, they can also be calculated onthe computer. Indeed:

limit(i1(t), t = infinity); yields

limit(i2(t), t = infinity); yields

183

Page 204: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 23 Systems of Differential Equations

194

Page 205: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

185

Exploration 23 Systems of Differential Equations

Find that solution satisfying the initial conditions:

{x (0) = 1, x' (0) = 0, y (0) = 0, y'(0) = 1 }, and

then create a graph of the solution.

Find that solution satisfying the initial conditions:

x (0) = 0, x' (0) = 0, y (0) = 1, y'(0) = 0 }, and then

create a graph of the solution.

Page 206: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

Exploration 23 Systems of Differential Equations

8. Application of a Second Order System of Two Equations

Consider two masses connected by springs as shown. The masses areml = m2 = 1 kilograms and the spring constants are k1 = 3 and k2 = 2newtons per meter.

If y1(t) and y2(t) denote the displacement of each mass below itsequilibrium position, then the motion of the system is governed by thesecond order differential equations:

a. Solve for that solution satisfying thesymmetric initial conditions:

Y1(O) = 0, Y2(0) = 0Y1'(0) = 1,Y2'(0) = 1

b. Solve for that solution satisfying the anti-symmetric initial conditions:

YI(O) = 0, Y2(0) = 0Y 1'(0) = 1,Y2'(0) = -1

Project Create two animations of the springs, one for the symmetric solution andone for the anti-symmetric solution.

186

Page 207: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

187

Page 208: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

188

Page 209: Engineering Explorations with MAPLE - … · Engineering Explorations with Maple ... The E4 project was supported in part by The Science and Engineering Education Directorate of the

189