Experiments in Undergraduate Mathematics - a Mathematica-Based Approach 9781860940279, 1860940277

All students need to master a variety of mathematical tools and concepts at the start of their university career. This d

352 33 43MB

English Pages 343 Year 1996

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

Experiments in Undergraduate Mathematics - a Mathematica-Based Approach
 9781860940279, 1860940277

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

Experiments in Undergraduate Mathematics

zyxwv

A Mathematica-Based Approach

-

hxperiments in Undergraduate Mathematics A Matbematica-Based Approach

Phillip Kent Phil Ramsden John Wood

z

z

Department of Ma thema tics Imperial College

Imperial College Press I

z

zyxwvutsrq zyxwvuts zyxw zyxwvu zyxwvutsr zyxwvuts zyxwvu

Published by

Imperial College Press 516 Sherfield Building Imperial College London SW7 2AZ Distributed by

World Scientific Publishing Co. Pte. Ltd.

P 0 Box 128, Farrer Road, Singapore 912805

USA rffice: Suite IB, 1060 Main Street, River Edge, NJ 07661

UK @ce: 57 Shelton Street, Covent Garden, London WC2H 9HE

British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library.

All trademarks are acknowledged as the property of their respective owners.

EXPERIMENTS IN UNDERGRADUATE MATHEMATICS A Mathematica-Based Approach Copyright 0 1996 Imperial College of Science, Technology and Medicine First Published 1996 Reprinted 1997

All rights reserved. This book, or parts thereoJ may not be reproduced in any form or by any means, electronic or mechanical, includingphotocopying, recording or any information storage and retrieval system now known or to be invented, without written permission from the copyright owner.

ISBN 1-86094-027-7 1-86094-028-5 (pbk)

Printed in UK by J. W. Arrowsmith Ltd.

zy zyx

Acknowledgements

The development of the contents of this book was funded (1993-95) by the Teaching and Learning Technology Programme (TLTP), a special funding initiative of the United Kingdom higher education funding councils. Information on TLTP can be found on the World-Wide-Web at the U l U http://www.icbl.hw.ac.uk/tltp/. We are especially grateful to Richard Noss of the University of London Institute of Education, who made key contributions, both formal and informal, to the process by which the contents of this book evolved. Professor Noss’ formal evaluative role was made logistically possible, and its quality and value enhanced, by the dedication and skill of his fieldworker, Rachel Shapton. Jack Abramsky, and the staff and students of Kingston College, made willing experimental subjects and, when invited, trenchant (though always polite) critics; without their timely contributions our educational ideas could easily have developed in directions unrelated to, and unconstrained by, reality.

zyx

David Klug, Richard Templer and Ian Gould, lecturers in the Chemistry Department at Imperial College, made the bold decision to introduce Muthemuticu into their first-year course on mathematics. They provided us with our most important testing ground for evaluating prototype versions of the mathematical experiments in this book. We thank them, and the many undergraduate students, in the Chemistry department and elsewhere, who worked on the experiments and provided us with invaluable information and insights. Finally, we wish to thank Dan Moore for all the detailed discussions about Chapter 11.

Preface

zy

This book takes its place amongst a growing number about using a computer mathematics system* (CMS) as an environment for learning mathematics. These systems are already changing both the way mathematics is done and the way mathematics is used. We can be sure, then, that they will have a role in the way mathematics is learnt and taught. But they have been around for a relatively short time, and the pace of curricular change is slow; in any case, there is still a lively debate among educators about what the scale and nature of their role will be, or ought to be.

zyx

We believe that a CMS allows us to present mathematics to students as an experimental subject. The term “experiment” that we use in this book is not used casually or rhetorically. In a laboratory experiment, in clear contrast to lectures or tutorials, the student, though perhaps guided by a lab assignment script, can exert a measure of control over the process. Experiments, too, are often collaborative, in the sense that students can pool their ideas and energies; such interactions are less common in traditional mathematics learning. Finally, and most importantly, an approach based in part upon experiment encourages the student to formulate mathematical conjectures. This conjecturing process is central to mathematics and to mathematical problem-solving, but has traditionally played only a minor role in the mathematical activity of students.

zyxwvu

Our approach is related to the doctrine of constructivism: the idea that conceptual learning involves the learner building, bit-by-bit, his or her own understanding of mathematical knowledge. A consequence of this idea is that, in mathematics at least, mere instruction is unlikely to be effective: at any rate, not on its own. Contructivism emphasises the importance of cognitively challenging mathematical activiv.

* We prefer this term to the more traditional “Computer Algebra System”, which fails to convey the power and scope of modern mathematical software.

...

Vlll

zyxwvut

zyxwvutsrqpon Preface

The topics covered in this book roughly correspond to those traditionally studied in the A-level school syllabus in England and Wales, though recent and continuing curriculum changes mean that several topics are now studied for the first time at university. The first year undergraduate with mathematics ‘A’ level will find this book most useful for revision: for strengthening his or her understanding of topics first met at school. In North American terms, this book is suitable for freshman calculus. We welcome your comments and thoughts on the contents of this book. Send them along to: The METRIC Project Mathematics Department, Imperial College London SW7 2BZ England.

zyxwvu

Electronic mail: metric-grojeic.ac .uk World-Wide-Web: httg: //metric.ma. ic. ac .uk/Message.html

Phillip Kent, Phil Ramsden and John Wood - May 1996.

Table of contents

zyxw zyxwvu zy

Chapter 0: Getting Started with Mathematica

1

Chapter 1: Foundations

19

Functions & Graphs

Functions;functions in Mathematica; composing functions; graphing functions; graphing experimental data.

35

Trigonometry About trigonometry; degrees and radians; trig functions from 0 to nl2; special angles; trig functions from 0 to 2nn; amplitude, frequency and phase; reciprocalfunctions (sec, cosec and cot); trig identities; small angles.

53

Series 1 (Sequences) Sequences; converging and diverging; arithmetic and geometric progressions (APs and GPs); series; summing APs; summing GPs; summing to infinity; recurrence sequences; Fibonacci numbers; non-linearity and chaos.

Chapter 2: Calculus Differentiation 1

zyxwv

Gradients of straight lines; chords and tangents; limits and derivatives; differentiation of x n ;trigonometric functions; exponentialfunctions; derivatives of inverses.

71

X

zyxwvutsrqp zyxw Contents

Differentiation 2

93

Product rule; quotient rule; composite functions (chain rule); maxima and minima; stationary points; implicitly defined functions.

zyxwvu zyxwv zyxw zyx zyxwvu

Integration 1

109

Areas under curves; the Riemann approximation and the trapezium rule; indefinite integrals; integration and differentiation; integration of x n ;integrals of common functions; simple rules and patterns.

Integration 2

125

Definite integrals; the trapezium rule; parabolic segments; Simpson’s rule.

Integration 3

145

Manipulating the integrand; substitutions; change of variable methods; integration by parts; areas in the plane; volumes of revolution.

Series 2 (Series)

165

Binomial expansions; polynomial approximations; Maclaurin series.

Chapter 3: Vectors and Matrices Vectors 1 Introduction to vectors; negative and equal vectors; scalar multiplication; vector addition; components; the i-j basis; modulus.

185

Contents

zyxw zy zy xi

zyxw 21 1

Vectors 2

The scalar (or dot) product; angles between vectors; threedimensional vectors; the i-j-k basis; the vector (or cross) product.

Vectors 3

235

Vector and Cartesian equations of a line; parallel, intersecting and skew lines; vector and Cartesian equations of a plane; the angle between two planes.

255

Matrices Introduction to matrices; transformations of the plane; matrix multiplication; addition and subtraction; combining transformations; matrix equations as transformations; equations as lines; equations as algebra; inverses; determinants.

Chapter 4: Complex Numbers Complex Numbers 1

28 1

Square roots of negative numbers; complex roots of quadratics; arithmetic of complex numbers; complex conjugate.

zyxwv

Complex Numbers 2

295

The Argand diagram; geometrical interpretations of complex arithmetic; modulus and argument; mod-arg arithmetic.

Complex Numbers 3

De Moivre 's theorem; nth roots; exponential form; loci.

309

zy zyxwvut zyxwvu To the learner

This is a book about doing mathematics. Mathematics is not a subject you can learn just by reading about it - though that can sometimes make you think you’ve learned it. Learning mathematics means getting your hands dirty: getting to grips with the subject directly. What’s different about this book is that you’re invited to do mathematics armed with Mathematica. When you see what Mathematica can do for you, you’ll understand what an important difference that is.

Most of the “doing” in this book happens in the mathematical experiments. Though these sometimes take up less space on the page than what we’ve called the Reading, they are not less important. On the contrary: they’re what this book is really all about.

The structure of this book The book is divided into five chapters. The first (Getting Started) is a quick introduction to the Mathematica software. Then comes Foundations, basic topics on which the following ones rest. The three main chapters, Calculus, Vectors & Matrices and Complex Numbers, can then be studied independently of one another. Each topic is broken down into a number of modules (one, two or three), each containing material for approximately one hour of study at the computer (Differentiation,for example, has two modules). The title page of each chapter lists the contents of all its modules. Each module contains about a half dozen experiments, indicated by a shaded background, which consist of a set of activities to be carried out at the computer. Almost every experiment has a section of Preparatory Reading, to be read before you start, and some have Post-experimentReading, to be read when you have finished.

xiv

zyxwvutsr zyxwv zyxw To the learner

Practice questions

Placed at appropriate points in each module you’ll find practice questions. These are an electronic version of those you find in ordinary mathematics textbooks. There is a difference, though. In a textbook, the questions are fixed. But the practice questions, and their answers, are generated by the computer. Each time you set yourself a question, it will be slightly different from the last time. The system makes no judgements and it does not keep scores.

Mathematics and Mathematica This book is for learning or revising mathematics, not for becoming a Mathematica expert. Of course, you will end up learning quite a bit about Mathemutica, and that skill will always be useful to you. And doing Mathematica counts as doing mathematics, because Mathematica is that kind of program. Actually, you may well become unsure where Mathematica ends and mathematics begins; most Mathematica users get like that eventually.

zyxwvu zy

By the way: if you find yourself getting interested in more advanced uses of the program, we have devised some Additional Activities. These can be found on our World-Wide-Web site (httg://metric.ma. ic .ac .uk/). Finally, we’ll quote a passage from the “advice to the learner” section of another book* which we like very much and which we think goes well here:

“If I am asked to solve a problem, or do something on the computer, and I am not told how to do it, what should 1do?’ The answer is very simple. Make s o m guesses (better yet, conjectures) and try them out on the computer. Ask

* Learning Abstract Algebra with ISETL, Ed Dubinsky and Uri Leron, Springer-Verlag, 1994. Page xii.

zyxw zy zyxwvu To the learner

xv

yourself if it worked - or what part of your guess worked and what part did not. Try to explain why. Then refine your guess and try again. And again. Keep repeating this cycle until you understand what is going on. The most important thing for you to remember is not to think of these explorations in terms of success and failure. Whenever the computer result is different from what you expected, think of this as an opportunity for you to improve your understanding. Remember: instead of just being stuck, not knowing what to do next, you now have an opportunity to experiment, to make conjectures and try them out, and to gradually refine your conjectures until you are satisfied with your understanding of the topic at hand.

zy zyxwvuts To the lecturer

We envisage three ways in which this book might be used:

as an integral part of a course based around computer laboratory sessions, with or without lectures. as a supplement to either a conventional lecture course, or a lab course using another set of Mathernatica-based materials. as revision material for mathematics required for a course that you are teaching.

The book does not assume any previous experience with Mathernatica or similar software on the part of learners. Neither does it set out to teach Mathernatica explicitly. However, the authors’ experience in piloting the contents of this book suggests that learners can, and do, become very skilled Mathernatica users quite quickly.

The METRIC software We have provided special Mathernatica functions for tasks where working from scratch would be too cumbersome, or too intricate for a novice user. These functions work with the standard Mathernatica syntax; we have not attempted to implement a simplified, novice version. The standard syntax, though not transparent, is inherently well designed and naturally mathematical in structure, and supports students’ mathematical thinking. We have also provided computer-generated, randomised practice questions. Students can set themselves such questions at any time, but are invited to do so at specific points in the text. Our software contains a logging mechanism that allows students’ sessions with Mathernatica, or selected parts of those sessions, to be automatically recorded. Full directions for activating this mechanism are to be found in the text file LOGGING. TXT in the METRIC package.

xviii

zyxwvutsr zyxw zyxw To the lecturer

Computer labs and orientation sessions

In our experience, even students completely new to Mathemutica can become quite proficient users provided they are given two or three hours of “orientation” in a computer lab with teacherhnstructor support. The module Getting Started is designed particularly for such sessions, with Functions & Graphs a natural second module to follow.

Adapting the materials You will, of course, be able to adapt the curricular materials in this book for your own purposes, for example by selecting particular experiments, or parts of experiments. We hope, too, that you will feel free to modify the special functions for your own uses, and perhaps improve them.

zyx

You are also invited to make free use of the Practice Question code, and to author your own questions. This is easier than it sounds; the design of the practice questions has been deliberately kept simple for this very purpose. Instructions on how to write practice questions are to be found in the text file PRACTICE.TXT in the METRIC package. We would be pleased to hear about any modifications that you do carry out. Please contact us at the addresses given in the Preface.

Additional resources Please check our World-Wide-Web site (http://metric.ma. ic .ac.uk/) for additional materials that we will be making available from time to time.

z zyxw

The software for this book

To perform the experiments in this book you will need Mathernatica version 2.0 or later with the notebook front end, together with the METRIC software package. The METRIC package consists of Mathernatica custom functions that are used throughout the experiments; practice questions, and the Mathernatica code for running them; code for logging students’ Mathernatica sessions; text files containing detailed technical instructions, including directions for installation.

Disk access The hardcover edition of this book includes a floppy disk (DOS format) with the complete set of programs.

You can also get the floppy disk by mail by writing to: The METRIC Project (EUM Disk) Mathematics Department Imperial College London SW7 2BZ England. The cost is El5 sterling. Please send a cheque payable to “Imperial College” and drawn on a British bank.

Internet access The METRIC package is freely available on the World-Wide Web, at the URL httg://metric.ma.ic.ac.uk/

zy

xx

zyxwvutsr zyxw zyxw zyxw zyxwvu zyxw The software for this book

You may also use anonymous FTP or Gopher to metric .ma. ic. ac .uk (IP address 155.198.192.26). The programs are available at the MathSource archive in the USA: http://www.wolfram.com/mathsource/

Platforms and formats

The floppy disk contains three archive files for DOS, Macintosh and Unix: mathetic. exe, mathetic. sea and mathetic. tar,respectively. There is also a directory, source,containing the files in normal form. Installation instructions are given in the file INSTALL.TXT.

Updates and on-line information

For the latest updates to the software and learning modules, please visit our WWW site at: http://metric.ma.ic.ac.uk/

. .

or use anonymous FTP or Gopher to metric .ma. ic ac uk (IP address 155.198.192.26).

Mathernatica version 3.0 As we go to press, Mathematica version 3.0 has not yet been released. It seems likely that the directory structure will change somewhat, and therefore that installation instructions will have to be modified slightly. We shall post information on this at the above WWW site.

Getting started with Mathematica

zy

2

zyxwvutsr

zyxwv Getting Started with Mathernatica

About this module Aims 0

0

zyxwvutsrqponm To help you start using Mathernatica;

To provide an idea about what Mathernatica is and what it can do.

Prerequisites You need to be able to use a keyboard and mouse-windows computer userinterface (e.g. Microsofi Windows or the MacOS). If you have not used this sort of computer system before there are tutorial programs available, or you might like to start working with someone who is more familiar.

zyx

There is no special mathematics knowledge required for this work but you should: try to understand the Mathernatica statements, and

try out your own ideas rather than just “do what you are told”

What is this thing called Mathernatica?

Mathernatica is a computer program created by Wolfram Research Inc. and is a type of system usually known as a “computer algebra system” or a “computer mathematics system”. It helps you do lots of different mathematical tasks. Such programs are now essential tools for scientists, engineers and mathematicians and you need to become familiar with them. Mathernatica has two parts: the Kernel and the Front End. The Kernel is the main part of the system, which accepts Mathernatica commands, processes them and sends back results. This is called evaluating the command. The Front End is the part of the system that handles such things as screen display, printing and the creation of Mathernatica documents.

zyxwvuts zyxwv zyxw zy Getting Started with Mathematica

3

Mathematica documents are called Notebooks. A Notebook is a bit like a wordprocessor document; you can type and edit commands, send them to the Kernel for evaluation, display the results and save your work.

You send commands to be evaluated by holding down the “shift” key and pressing the “return” key (which may be marked “enter” or ‘‘A ” on some keyboards).

In [1]:= zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA ~~

2 + 2 out [1]=

4

Kernel

Notebook When you start Mathematica you actually start just the Front End; the Kernel only starts when it is needed. It’s fine to have more than one Notebook open at a time, but don’t start more than one copy of Mathematica. During this module you will work within a Notebook to try out some of Mathematica’s capabilities.

Notebook management A Mathematica Notebook is, as we’ve said, a bit like a word-processor document; you can scroll up and down, and edit things in the usual “mousey” way. But Mathematica Notebooks have certain special features you don’t find in other types of document.

4

zyxw zyxwvutsrq zyxwvutsr zyxwv zyxwvuts zyxwvuts Getting Started with Mathematica

A Notebook can contain different types of things: Mathernatica commands, their outputs, error messages, pictures, and just plain text. Mathernatica needs, and so do you, to know what is what and to keep different types of things separate. The Notebook is divided into cells and these are identified by “square brackets” on the right of the window.

Mathernatica shows the relation between an input to the kernel and its output into the Notebook by grouping the cells. This is shown below, where the graphical and textual output are shown grouped with the input command by an extra bracket further to the right; in this case the whole group has been selected. You can use groups to organise your own Notebooks. r‘2aralkerm!.I /nlS.=

Plot[Sin[xl.

(I.

-Pi. Pi)]

tiara? kerm!.l Uutl5l= -Graphics-

Operations on whole (groups of) cells can be accomplished by selecting their brackets using the mouse, and then doing the operation. You can also cut, copy, and paste entire cells, and selections of text between cells: this can save you having to retype the whole of a long Mathematica command. But you can also reevaluate a previous command, in any input cell, by clicking inside it or selecting its cell bracket, and pressing “shift-return”to evaluate.

zyx zy zyxwv zy zyxwvut zyxw zyx Getting Started with Mathernatica

5

Using outputs

Each output from Mathernatica has a number. If you want to use the contents of output number 35, say, you can include it in a Mathernatica command using %35. The symbol % by itself means “the most recent output”.

Mathernatica syntax

Mathernatica is a computer language with its own grammar and spelling rules, which in computerese are collectively called its syntax. The Kernel is necessarily strict about these rules and you will need to be careful with them. You’ll pick up a lot of it as you proceed through this work but here are some key points: Mathernatica commands start with a CAPITAL letter, e.g. Sin [XI.If the command is really several words in English joined together then each one starts with a capital but WithNoSgacesInBetween Letter case matters: the word Fun is different from the word fun which is different from the word fuN. Mathernatica uses a lot of brackets and all the different sorts of them, ( [ { It matters which type of bracket you use in a command:

} ] ).

Most Mathematica functions need inputs (“arguments” in computerese) and these must be put inside square brackets, for example: Sin [XI.Two or more inputs are separated by commas, for example: P l o t [Sin[xl, {x, 0 , 2 Pi), F

Curly brackets, called “braces”, I...) are used to make a list, usually to allow several objects to be treated as one. Parentheses, or “ordinary” brackets, (like these), are used to group terms together just as we do in algebra: it’s a good idea to use them in complicated expressions to make sure the meaning is clear.

Arithmetical operations The common arithmetical operations are carried out using the symbols:

+, -, *, / and

A

(forpowers).

6

zyxw zyxwvuts zyxwvut zyxw zyxw Getting Started with Mathernatica

Multiplication can also be signified by a space (or spaces), e.g. 3 x means the same as 3 *x. For the rest of the time, spaces have no significance except for clarifying commands. For example, it’s usual to put a space after a comma (like x I , though you can if you like. It is above), but not usual to write, say, S i n sometimes better to indicate all the multiplications in a complicated command with *‘s so that you don’t get the two meanings of the space character confused.

Variable names

Mathernatica variable names can be long, but they must not begin with a number, because Mathernatica interprets, say, a d i m e n s i o n a s 2 * d i m e n s i o n Names can end with a number, though: xl is a useful way of writing in Mathematica a subscripted variable like x i . Note also that combinations of letters without spaces are interpreted as new variables: ax does not mean a*x.

Getting help You are certain to get stuck, and we all know how often computers seem to go wrong. Here are some ways to recover. Use the Help system, which is especially useful for finding out about Mathernatica functions.

Ask people, other students, the course demonstrators, anybody. If a command doesn’t work properly check the error messages (usually in red or blue text). If your input is simply returned unchanged, with no error messages to help, check that you have spelt the command corrxtly, that the number of inputs is correct, that you haven’t left out any commas, and that the types of the inputs are appropriate (for example, you may have typed a number when a list is required). If Mathernatica seems to have stopped, Abort the calculation or (more drastically) Quit the Kernel, using the Action menu.

zyxw

Getting Started with Mathernatica

7

If everything seems to have gone wrong Quit from Mathernatica (via the File menu) and start again. Learn to Save your work so that you can recover from these situations.

Printing, saving and opening Notebooks

zyxw

Mathernatica Notebooks can be printed and saved in standard ways, using the appropriate commands on the File menu. If you wish to save a Notebook to a new location, such as a floppy disk, use Save As. Use Open to load a Notebook from disk.

...

It is particularly useful to use Print Selection (of cells) to get just the cells you want.

8

zyxwvutsr zyxw Getting Started with Mathernatica

Experiment 1: Arithmetic

Getting Started with Mathernatica

zyxw 9

10

zyxwvuts zyxwvu zyxw Getting Started with Mathematica

Experiment 2: Numbers

zyx z zyxwvu zyxwv zyxwvu zyxwvu Getting Started with Mathernatica

23/29 + 12/5 23/29 + 11/55

You can use N to get them

Another example of

Sin [Pi/3 1 cos CPi/51

Tan [Pi/&1

can use N here too to

Sin[ NtPi/31

Experiment 3: Algebra 1) Mathematica works with (x

+ 3)"2 +

told what to do

note about how

x

+ 3

11

12

zyxwvutsr zyxwvu Getting Started with Mathernatica

zyxwvu zyxw

Getting Started with Mathernatica

Experiment 4: Equations

13

14

zyxwvuts Getting Started with Mathernatica

Getting Started with Mathernatica

Experiment 5: Plotting graphs

zyx zy 15

16

zyxwvutsr Getting Started with Mathernatica

Experiment 6: Some built-in functions

Getting Started with Mathernatica

zyxw 17

z

z -+

Functions and Graphs

-20 -1

zyxwvutsrq

-2 Pi

-Pi

Pi

2 Pi

20

zyxwvutsr Foundations

zyxwv zyxw zy 21

Functions & Graphs

Introduction Definitions

Functions are a very important idea in mathematics. A function is a rule that takes one object and converts it to another. The “object” going in may be a number, a variable or a coordinate pair (or triple in three dimensions). The important thing is that, for any given input, there is only one output. The set of all possible “objects”, or arguments, for which a function’s behaviour is defined is called the function’s domain. The corresponding set of values which the function yields is called its range.

zyx

Graphs are pictures of functions made by plotting the input against the output using a coordinate system: most familiar is the Cartesian (x,y) system.

Notation

There are several different notations for functions. For example, the function that takes a number, squares it, takes its sine and multiplies the square and the sine together can be written: y = x 2 sinx, or y ( x ) = x 2 sinx, or ‘ f ( x ) = x 2 smx, or ‘ f:x-+x 2 smx.

22

zyxwvutsr zyxw zyxwvut zyxw Foundations

Mathernatica issues Functions

Mathernatica uses square brackets to enclose function inputs, where we might usually use round ones. For example: Sin[Pi] Exgl2l

Mathernatica has many functions built in, and you can easily define your own functions in Mathernatica as we’ll see shortly.

Graphs

zy zyxwv zyxw zyxw

Computer-generated graphs in Mathernatica are built by making a table of x and y coordinate pairs across a range of x. Mathernatica chooses they ranges on graphs so that it shows “the most interesting part” of the graph corresponding to the xrange you chose. You can force it to use a certain y-range if you use an option, like this: Plot[xA2, Ex, -7, 71, PlotRange -> { - 5 , 2511

Experiment 1: Functions Preparatory reading

Mathernatica has all the common functions built in, and some fairly uncommon ones too. You may have seen some of them in the Getting Started module. In this experiment you will be creating your own functions in Mathernatica.

zyxw zyxw zyxw

Functions & Graphs

23

zzz zyxwvut zy zyxw

xauppo 103 0 = 3 = v put? ‘ssauuaha 103 0 = q 8uglas dq ‘paieu!m!Ia aq 01 aheq suuai%u~puajjo ayi uop3unj ppo JO uaha ue oiu! :,ywpenb It!iaua%ayi aqvm o~ .(uuai x ayi) auo ppo auo put? ‘(iueisuo:, ayi pue miai zx ayi) smiai uaaa OM^ sey uoyi3unj :,yipenb p a u a %a y ~

zyxwzy zyxwvut zyx zyx zyxw Functions & Graphs

25

Experiment 2: Composing functions Preparatory reading

Composing means applying one function after another. In traditional notation, there is a possible confusion about the order of application when applying functions one after the other: g(x> fg(x) = f ( g ( x ) )

means "apply function g to x".

means "apply functionfto g ( x ) " .

The functionfg (sometimes written f . g or f 0 g) is called the composite off and g. Notice thatfg means "apply the function g$first, then applyfto the output". It is easy to get confused, because the function to be applied last is written first.

zyxwvu zyxwv zyx zyxwvu zyxw zyxwv

saq ivy1 anIen ayi asooy3 01 sf uopualzuo3 ay1 pue suoyin~os30 iaqurnu alyyuy ue seq 5.0 = x uys uoynba ay1 ‘aldurexa iod ’asioM ualza sy u o ~ p u nauys j ayL

.Pau!PP LlanbIun IOU sr ‘Uayi ‘6 30 ,,a.mnbs asJaAu!,, ayL ‘E- pue E LIaureu ‘6 ale saienbs asoyM siaqurnu ow a n aiayi ‘aldurexa 103 ‘in8 .indlno auo amy LIUO isnur uop3unj e 1eyl a3uals!su! mo 30 asne3aq ‘3yxuaIqoid aq ue3 suoy1~unjasialzul

zyxwv zyxw zyxw zyxwvut zyxwvuts zy zyxw Functions & Graphs

27

between -d2and d 2 . With this restriction, the inverse of the sine function is written:

arcsinx, or sin-lx .

The other inverse trigonometric functions are written similarly. These functions are discussed more fully in the Trigonometry module. Note that the sin-’ x notation is extremely ambiguous: it does not mean (sinx)-l = l/sin x, it simply means “the angle whose sine is x”.

Inverses

For simpler functions there is a way to find the inverse, based on trying to solve (or rearrange) the function definition to get x in terms of y. For example:

y=4x+2 y - 2 ~ 4 ~

We can now write down the inverse function, switching the roles of x and y:

y=- x - 2 4 It’s a convention that x be the independent (input) variable and y the dependent (output) variable. There are some trivial self-inverting functions like “add zero” or “multiply by 1”. The reciprocal function, y = l/x, is a simple, non-trivial one. There are others.

Experiment 3: Graphing functions Preparatory reading A graph is just a picture of a function. Mathematically the graph of a functionfis the (infinite) set of points (x,y) such that y =Ax).

28

zyxw zyx zyxwvuts zyxwvu Foundations

When we draw graphs we usually choose some values of x,calculatefix) and plot each of the points (x,y) until there are enough to be able to draw a curve through the points.

Muthernatica has a similar approach, and like us it knows to fill in more points at places where the function is changing rapidly. In x-y graphs there is an implicit distinction between the two axes. The x-axis is usually used for the independent variable (independent in the sense that we can usually choose any number to put into the function). The y-axis represents the dependent variable (that is, dependent on x).

zyxwv zyxw zyxw

Functions & Graphs

29

30

zyxw zyxwvuts

Post-experiment reading

Foundations

zyxwvu zyxwv zyx

The Plot command, though very useful and important, has a major flaw: it always assumes that the functions it is plotting are continuous. So when an input function isn’t continuous, such as l l ( x - 2) (discontinuous at x = 2), or tan x (discontinuous at x = M 2 , f3d2,. . .), or sin( l/x) (discontinuous at x = 0) then spurious lines connecting large positive and large negative function values will appear. The failure in the case of sin( llx) is even more drastic because the period of the function goes to zero at x = 0. The moral of this story is: always think twice about computer output!

.

The graphs of a function and its inverse function are simply reflections of each other in the line y = x. Self-inverse functions are symmetrical about this line.

Experiment 4: Graphing data

zyxw

Preparatory reading

We can use the coordinate system of a graph to represent sets of pairs of numbers, with or without knowing a function that links them. A typical example would be the results of an experiment where, say, the temperature T of a system is measured at different times t, leading to a set of coordinate pairs (l, T>. We’ve ordered them in this way because we tend to put the independent variable on the horizontal axis, and with this experimental data it seems natural to treat time as the independent variable.

We don’t know if there’s a functional relationship between the two measurements. Graphing the data is part of our attempt to find out. The simplest case to look for is a linear relationship: we try and fit a straight line through the points.

zyxw zyxw

All straight lines have an equation like this:

y=mx+c

where m is the gradient of the line (= tan O), and c is the intercept on the y-axis.

zy zyxwv zyxw zyxw zyxwvutsrqp 31

Functions & Graphs

JC 0

X

zyxwvu zyxwv zyxwvu

for later use:

dataGragh=Li

commands define

a=$; c= 45; fitLine = PlotCm * x Show [ { dataGragh, f i t

32

zyxwvutsr zyxw

Post-experiment reading

Foundations

zyxw

Fit works by choosing the curve that minimises the (vertical) distances of the data points from that curve. It performs a least squares fit: it minimises the sum of the squares of the distances from the data points to the curve (a straight line in this case):

zyxw zyxw zyxw zy

zyxw Functions & Graphs

Experiment 5: Functions from graphs Preparatory reading

This final Experiment is intended to help you see the relationships between common functions and their graphs.

33

34

zyxwvutsr zyxw zyxwvu zyxwv zyxwvuts zyxwv zyxwvu zyxwvu Foundations

GiveQuestion [

LsstAnswear t

to check your answer. Y are randomly generated,

For questions on trigonome

GiveQuest ion [ "trig gr stlhcswer [ "trig g

veQueastion [ "grag

is section uses this ing hack to the Inst

Trigonometry

36

zyxwvuts Foundations

Trigonometry

Introduction

zyxw 37

This module covers: the definitions of the trigonometric functions sine, cosine and tangent; some of their mathematical properties as functions; the inverse trig functions: secant, cosecant and cotangent.

zyxw zyxw zy

You will need to be familiar with the following:

right-angled triangles and Pythagoras’ Theorem;

some coordinate geometry: plotting points and curves on a graph.

Mathernatica notation

zy zy zyxwvutsr

z(= 3.1415926 ...) is written as P i . Muthemuticualways keeps values as accurately as possible, so will show the number 7c as P i , not as a numerical approximation. To force it to show you a numerical value you need to use the N function. For infinity, use the capitalised word Infinity in place of the usual symbol

w

.

Mathernatica requires square brackets around the arguments of functions, so sin x becomes Sin [XI .

About trigonometry

Trigonometry is the part of mathematics dealing with the properties of triangles. (From the Greek, trigonon = triangle). You should already know something about the geometric properties of triangles, and right-angled triangles in particular. Pythagoras’ Theorem relates the lengths of the sides in a right-angled triangle, u and b and the hypotenuse h:

h2=a2+b2.

38

zyxwvuts zyxw zyx Foundations

You should also have learnt about the trigonometric (or “trig”) functions: sine, cosine and tangent. Although these are defined as ratios of sides in right-angled triangles, they are used very widely in advanced mathematics, and appear in some surprising places. Trig functions are important; you should have a good grasp of them and have them in your “toolbox” of mathematical methods.

Experiment 1: Degrees and radians Preparatory reading

In your previous study of trigonometry you may have been using only the degree as the unit of angle, where a circle contains 360“. In this module, and as a general rule for university-level mathematics, we will be using the radian, where a circle contains 2nradians. (1 radian is the angle subtended by a circular arc of radius 1 unit and arc-length 1 unit.)

1” is d180 radians, so multiplying any number of degrees by the factor d180 gives the radian measure of the angle.

Trigonometry

zyxw zy 39

zyxwvut

Post-experiment reading 1 radian = 57.2958 degrees;

1" = 0.01745329251994329577radians.

The special angles (30,45,60 and 90 degrees) are found in these right-angled triangles:

l

c

\

1

zyx

40

Foundations

zyxw

Experiment 2: Trig functions from 0 to n/2 Preparatory reading

zyxw zyxwvuts I

Adjacent

For the angle t:

opposite hypotenuse ’ adjacent cost = hypotenuse ’ sint =

zyxw zyx zy

opposite tant = -. adjacent

It is usual to label angles with the Greek letter 8 (“theta”). We can’t use Greek letters easily on the computer, so we’ll be using t instead.

In a right-angled triangle, t can have values between 0”and 90”, and therefore these definitions are only valid for t between 0”and 90”,or 0 5 t 5 n I 2 radians.

Trigonometry

zyxw 41

42

zyxwvutsr zyxw Foundations

Post-experiment reading

You should become familiar with this result:

zy

Experiment 3: Trig functions from 0 to 2nx Preparatory reading

Knowing the definitions of the trig functions in right-angled triangles does not tell us how to calculate their values, except for the special angles above. The calculation of values is a separate topic, and in this era of computers and pocket calculators something we can leave out.

For other ranges of values of t, we could define these functions by considering the exterior angles of an obtuse-angled triangle (some books do this). Instead, we will consider the trig functions as defined in the unit circle:

zyxw zy zyxwv zyxwv zyxw zyxw zyxwv zyxwvu Trigonometry

43

Here we've drawn a unit circle (a circle of radius l), and an arbitrary point P ( t ) which subtends an (acute) angle t a t the origin. The equation of the circle is

P(t) depends on t and has coordinates (x, y). The right-angled triangle containing t has a hypotenuse of length 1, since this is the radius of the circle.

It follows from the definition of sine and cosine that: x=cost, y=sint y =sint tant = x cost

Sine, cosine, tangent and their related functions are often called circular functions because of their definition in the unit circle.

We divide the unit circle into four quadrants, the quarters which are slices of angle d 2 (that's 90",but this is the last time we mention degrees!). We refer to them as:

1st quadrant:

from 0 to d 2 ;

2nd quadrant:

from d 2 to n;

3rd quadrant:

from n to 3 d 2 ;

4th quadrant:

from 3 d 2 to 2 n radians.

1) Use Muthenzatica to gr together type:

Plot CSinttI I it It's laid out like this, u

zyxwvuts

44

Foundations

zyxw zy zyxw zyxw zyxw Trigonometry

Post-experiment reading

45

You should be familiar with the shapes of the graphs of the three main trigonometric functions between 0 and 2n: sin t

cos t

0.

-0.

tan t

zyxwv zyx zyxwvu

Many properties of the trig functions can be found from these graphs and the unit circle diagram. For example, they show the range of the sine and cosine functions: -1 I sint I +I

or

(sint(51

-1 5 cost 5 +1

or

lcostl I 1

A circle “contains” 2n radians, which means that the point P reaches the same place after each turn of 2n. Its associated angle will look the same, but the circular definition is 2 8 (or 4 z or 6z etc.) larger. Similarly for turns in the negative direction, P will return every 2 z P(t) = P ( t + 2n) = P(t + 4n)

... = P ( t - 2n) = P(t - 4n) ...

:.

P ( t ) = P(t + 2nx),

for any integer n, which may be positive, negative or zero.

46

zyxwvutsr zyxw zyxw zyxwv zyxwvutsrq zyxwv zyxw zyxwvut Foundations

We defined the trig functions in terms of the point P, so they have the same property: sin t = sin(t + 2nn)

cost = cos(t + 2nn)

tan t = tan(t + 2nn).

With tangent we can go further. The graph of tan x doesn’t only repeat every 2n radians: it actually repeats every Irradians, as is clear from the graph. Thus, tan t = tan(t + nn). We have found the value of the trig functions for any angle, using just the values in the interval 0 to d 2 . The trig functions are periodic (that is, they repeat themselves) and the period (the length of one repeating cycle) is 27c for sin and cos. and n for tan.

zyxw zy

zyxw Trigonometry

47

Experiment 4: Amplitude, frequency and phase Preparatory reading

The periodicity of sine and cosine functions makes them useful for describing periodic behaviours, such as waves and vibrations. Such applications usually require that the trig functions be transformed, and there are really four kinds of transformations we can do. Let’s start with a sine function:

zyxwv zyxwv a sin t

e.g. 5 sin t

multiply the argument by a number, w :

sin wt

e.g. sin 21

or add a number to the argument:

sin( t + p )

e.g. sin ( t + 7d3)

c + sin t

e.g. 2

we can multiply it by a number, a :

or just add a number to the result:

+ sin t

In the most general case we need to look at the function: c + a sin(wt + p ) .

48

zyxwvuts

zyxwvut zy zyxwvuts zyxwvuts zy Foundations

Post-experiment reading

The parameter c moves the curve “in the y-direction” (vertical translation).

The parameter a determines the range of the curve and is called the amplitude.

The parameter w gives the number of cycles that occur as t changes by 2 z this quantity is called the angular frequency (often written using the Greek letter o, “omega”).

The parameter p moves the curve through a horizontal translation and is known as the phase. Note that apositive phase has the effect of moving the curve in the negative x-direction (it shifts to the left).

The period, T, of our transformed sine function is T = 2 dw. The frequency of the oscillation is the number of cycles during 1 unit of the variable t, that is, 1/T or w I 2 ~For sound or light waves, and other time-dependent oscillations, frequency is normally measured by the number of cycles per second; the SI unit for this is the Hertz (Hz).

zyxw

zyxw Trigonometry

49

Experiment 5: Reciprocal functions Preparatory reading

Recall the triangle labelled for our original definition of the trigonometric functions:

Opposite

I

Adjacent

zyxw

There are three other ratios we can define, often known as the reciprocal trigonometric functions. (“Reciprocal” means “one over”).

zyxw

Secant:

hypotenuse 1 = sect, adjacent cost

Cosecant:

hypotenuse - 1 = cosec t , opposite sin t

Cotangent:

adjacent 1 ~= cot t . opposite

tan t

i

i

zyxw zyxwv zyxwvu zyxwvu zyxwv

50

Foundations

Remember that the P1 negative values across

2 ) Copy the shapes of the functions also have a p

Post-experiment reading

These functions all have ranges between (-1, 1).

--w

and

+-w

, excluding the interval

Experiment 6: Trigonometric identities Preparatory reading Because the trigonometric functions arise so frequently you will quite often encounter expressions, including quite complex expressions, involving trigonometric functions. We often need to manipulate these expressions, to simplify them or get them into a more useful form. To do so we can call on some important identities.

zyxwv zyxwvut

An identity is a statement to the effect that that two expressions are exactly the same, irrespective of the values of the variables involved. For example:

(x+2)* = x 2 + 4 x + 4

This is always true, for any value of x. It is not an equation for a particular value of x. To emphasise this difference we use the special identity sign E.

zyxwvuts

Plot cos2t and sin Show [

Plotstyle->RO Plot t ( C O S [t1)”2,

Trigonometry

Post-experiment reading

zyxw zy 51

zyxw zyxw zyxw zyxwv

You should know the following identities by heart: cosLt+sinL t 5 1;

cos(2t) 5 cos 2 t - sin 2 t, =220s 2 t - 1 ,

= 1- 2 sin2 t ; sin(2r) = 2sinrcost. Remember that identities are true for all values oft. The functions on each side of the ‘k”sign are the same.

Experiment 7: Small angles Preparatory reading We sometimes try to replace functions with simpler ones, most typically by polynomial functions, that is functions of powers of a variable.

zyxw zyxw

52

Foundations

There are polynomial approximations to the trigonometric functions which give particularly good approximations near 0.

zyxwvutsrq

Post-experiment reading If t =3 3 ~ 3, 9, 27, 81, 243, ...

where “. ..” means “and so on for ever”. In each case, we could find the 100th term, or the 2000th, or the nth, for any n, because we know the generating function which defines the general, nth term. Thus the two examples above could be written:

2, 4, 6, 8, 10, ..., 2n, ... 3, 9, 27, 81, 243, ..., 3n, ...

56

zyxwvutsrq Foundations

zy zyxw zyxw

Series 1 (Sequences)

Post-experiment reading

57

There are basically three things that happen to sequences as n gets larger:

They can get closer and closer to some value and are said to converge to that value,

OR They get bigger (positive or negative) with no maximum value as n increases and are said to diverge to (plus or minus) infinity,

OR They keep “visiting” a set of different values, or a range of values without converging. Such sequences are also said to diverge.

In the mathematical language of limits, we seek the behaviour of the sequence as n tends to infinity. In traditional notation we would write, for example:

zyxw

1 lim - = O , n

n+-

which is read: “the limit of one over n , as n tends to infinity, is zero”. The sequence generated by lln is, therefore, a convergent series, which converges on zero.

There are methods for determining the limiting behaviour of sequences: you will study them later.

58

zyxwvutsrq zyxw zyxwv zyxw zyx Foundations

Experiment 2: Progressing Preparatory reading

Arithmetic progressions

An arithmetic sequence or arithmetic progression (AP) is a sequence in which each term differs from the one before by a constant. This constant is called the common difference. For example the sequence

10, 12, 14, 16, ...

is an AP with first term 10 and a common difference of 2.

In general, call the first term a and the common difference d. The general arithmetic sequence is: a, a + d , a+2d, a+3d,

..., a + ( n - l ) d , ....

The nth term, the general term we need, is there. Can you see why its multiplier is (n-l)?

Geometric progressions A geometric sequence or geometric progression (GP) is one in which each term is a constant multiplied by the previous one. This constant is called the common ratio. For example

2,4,8,16,... is a GP with first term 2 and a common ratio of 2. In general, if the first term of the sequence is a, and the common ratio is r, then the sequence is: a,

The nth term is urn-'

ar, ar 2, ar3, ..., urn-',

....

zyxwv zyxw

Series I (Sequences)

59

60

zyxw zyxwvut zy zyxwv zyxw zyxwv Foundations

Experiment 3: Summing APs Preparatory reading Series notation

A series is the sum of a sequence. The normal notation for summation is capital Greek “sigma”). So, instead of writing the sum of an AP like this:

(a

2 + 5 + 8 + 11 + 14,

we may use the general term to write:

n=l

Similarly, the infinite sum of this GP:

8 + 4 + 2 + 1 + 0.5 + 0.25 + ... may be written: m

zyxwvuts

c8.(;)”-’ or c8.(:)” oreven ’ n=l

c8.(+)”-’.

n

The convention for sums is that the count is assumed to be up to infinity if the upper limit is omitted, and to start at 1 if the lower limit is omitted. You can even leave out the counter variable ( n ) if this is obvious from the expression. In all cases the counter is assumed to be going up in 1’s.

zyxwvu zyxw

Series 1 (Sequences)

Post-experiment reading Summing an arithmetic sequence

61

zyxw zyx zy zyx

“Add up all the numbers between 1 and 1000.’’

This problem was set for the great mathematician Gauss when he was in primary school, probably to keep him quiet for a few days. His solution, which you rederived in the experiment, can be easily generalised. Let’s call the sum of the first n terms of an arithmetic sequence S,:

zyxw zyxwvutsr zyx zyxwv Foundations

62

S, = a +(a+ d ) + ( a + 2 d ) +

... + ( a + ( n - 2 ) d ) + ( a + ( n - 1)d)

and, writing it backwards:

S, = ( a + ( n- l ) d ) + ( a + ( n - 2 ) d ) +

Add them:

... + ( a + 2 d ) + ( a + d ) + a

2S, = n(a + a + ( n - 1)d) n S, = -(2a + ( n - 1)d). 2

*

A useful alternative way of writing this is:

S, = (number of terms) x (average of first and last terms).

Series 1 (Sequences)

Experiment 4: Summing GPs

zyxw 63

zyxw zyxw zyxwvu zyxw zyx

Post-experiment reading

The general geometric series summed to n terms is:

S, = a +ur+ur'

+

(multiply by r ) r.S, = ur + ur2 + ...

... +urn-' +urn-'

+ urn-' + urn-' + ur".

64

zyxwvutsr zyxw Foundations

zyxw zyxw zyxwv

Now subtract and most of the terms disappear:

S,-rSn=a-arn

:. sn= a(1- r n > ~

1-r

or S, =-.

a(rn - 1) r-1

The first formulation is more convenient when r < 1, the second when r > 1. The case when r = 1 is not covered. Can you see from the derivation why not? What is the right formula for Sn in this case?

Series 1 (Sequences)

zyxw zy 65

zyxwv

Experiment 5: Summing to infinity Preparatory reading Summing to infinity

We can allow the pattern of terms to continue forever but the sort of manipulations we use to sum AP’s and GP’s cannot be used for series with an infinite number of terms.

zyx

In general, if we have any infinite sequence (AP or GP or something else) we can form the partial sums up to each term. If we call the sum to n terms Sn then we can build a new sequence:

This new sequence will either converge or diverge. If it converges then its limit is the sum to infinity of the original series.

zyxwv

You can probably see that for arithmetic sequences, and those geometric sequences with Irl2 1 , the terms get larger (maybe large and negative) as n increases and hence that the sum of terms will increase as we take more and more terms of the series. These series diverge. For a geometric sequence with Irl < 1, the absolute value of each term will be smaller than that of the previous one, but what can we say about the sum? If

111

< 1 , then: a(1-rn) Sn=-----, 1-r

a S, = lim S, = - (for Irl< 1). njm 1-r

66

zyxw zyxwvutsr zyxwv Foundations

A note of caution

Although it’s clear that a series in which the terms are getting bigger can’t converge to a limit, it is not enough for the terms in a series to be getting smaller for its sum to infinity to exist.

zyxwv zyxw

Series 1 (Sequences)

67

Experiment 6: Recurrence sequences Preparatory reading Recurrence sequences are defined by deriving each term from one or more of the previous ones. An example is the Fibonacci sequence given by:

zyxwvuts

Fibonacci derived this series to describe the population growth of rabbits, taking u, to be the number of pairs of rabbits in the nth generation.

We need to assign values to the first two terms, u l and u2. Fibonacci started with one pair of rabbits, and assumed that it took them two seasons to breed, so we have u1 = u2 = 1. The second example in this experiment is based on the nonlinear recurrence relation:

68

zyxwvutsr zyxwvu zyxw Foundations 2

x, = c - x,-l

where c is a number. This is nonlinear because it has a squared term in it -this apparently simple fact implies some absolutely remarkable mathematical properties.

zyxwvu zyxw

Series 1 (Sequences)

69

zyxw zyxwvutsr zyxw zyxwv zyxwvu zy zyxwvuts zyxwvut

70

Foundations

Post-experiment reading

2

The sequence generated by x, = c - xn-, exhibits remarkable behaviour. For some values of c the sequence converges (whatever the starting value, X I )but for other values it will visit two, four, or more different values, getting closer each visit in a “convergent” sort of way. For yet other values of c even stranger behaviour can be observed, and this sequence demonstrates the essential characteristic of chaotic systems, namely that very small changes in the values of c can have disproportionately large impact on the limiting behaviour of the sequence and the value(s) it visits.

The diagram on the title page of this module shows the results of plotting xlooo to between 0.5 and 2.

~ 1 0 3 for 2 c

If x and c are allowed to be complex (see Complex Numbers in Chapter 4), even richer patterns of behaviour occur. The well-known Mandelbrot Set stems from analysis of these patterns.

Differentiation 1

72

zyxwvuts Calculus

zyxwv zyxw zy

Differentiation 1

73

Experiment 1: Gradients of straight lines Preparatory reading

The gradient of a straight line is a measure of its steepness. It’s equal to the number of units the line rises for each unit step to the right. The following graph, then, has gradient 2: it goes up 2 units for every 1 unit along.

If the graph falls instead of rises, then the gradient is negative: here’s a line with gradient -3.

74

zyxwvutsrq zyxw Calculus

zyxw zyx zyxw zyxwv zyxwvuts zyxw

To calculate the gradient of a straight line, fix two points on it, (XO,yo) and (XI, yl). The line’s gradient is then Y1 -Yo x1 -xo

or, more simply,

t

change in y change in x

You’ll have spotted, probably, that there’s a correspondence between a function’s equation and its graph. The function with equation y = 2x - 4 has a graph with gradient 2, and the function with equation y = 6 - 3x has a graph with gradient -3. In general, the function with gradient y = mx + c has a graph with gradient m.

zyxwv

Differentiation 1

75

76

zyxwvuts zyxw zy zyxwv zyxwvutsr Calculus

Experiment 2: Chords and tangents Preparatory reading

It's often important for us, as users of mathematics, to know about gradients of graphs. If the horizontal axis represents time, for instance, then the gradient of the graph represents how rapidly the quantity is changing in time (velocity = gradient of distance-time graph, acceleration = gradient of velocity-time graph, inflation = gradient of price-time graph, etc.)

The problem is, few graphs we study are straight lines. We need, then, some idea of gradient for curves. Suppose we're interested in the gradient of a curve at a given point. Now: we already know about gradients of straight lines. So we can draw a straight line through our point, exactly as steep as the curve.. .

2-

-2 -

...and then ask: what's the gradient of this line? This line, which just touches the curve, is called a tangent. The bad news is that, in general, it's hard to calculate gradients of tangents. Far harder, for example, than it is to calculate the gradient of a line that crosses the curve at two given points.

zy zyxw zyxwv

Differentiation 1

77

zyxw zyxwvuts

Lines like this are called chords or secants. Because they pass through two points whose coordinates we know, we can use the formula change in y change in x

to find their gradients.

BIG IDEA: The closer together the two points, the more the chord looks like a tangent.. .

78

zyxwvutsrq zyxw zyxwv zyxwvu zyxw zyxwvutsrqponm zyxwvu zyxwvu zyxwv Calculus

Thejrstpurt ofrhe e produce this partied

Plotchord fx"2, Ex, PlotRange->E-S, 251

then "shift-return '' i

1) Generate a dia

Generate a fresh diagram. the second point a litt of the chord. Repeat, Note down the gradient ea

3 ) Write a short report s at the point x = 2. Exp results of your experiment

4) Use the same technique to x= l,x=3andx= 5 ) What do your findings

Note: this section uses try going back to the Instru

zy zyxw 79

Differentiation I

Experiment 3: Limits and derivatives Preparatory reading

zyxwv zyxwvu zyxwv zyxw

We can express the ideas you met in Experiment 2 like this:

the gradient of the tangent at the point P is the limit, as Q approaches P , of the gradient of the chord PQ.

A limit is a number that we can get as close to as we like, even though we may not be able to quite reach it. Let’s think about the equation y = x2. If P has coordinates (2,4), and Q has coordinates (2 + h, [2 + hI2),then the gradient of the chord PQ is given by change in y - (2 + h)2 - 4 change in x h

As h gets progressively smaller (we say it tends to zero) Q approaches P and the gradient of the chord PQ gets closer to that of the tangent at P. The gradient of this tangent, then, is the limit as h tends to zero of the above quantity. We write this as lim h+O

(2+h)2-4 h

Notice, though, that

(2+h)’-4=4+4h+h2-4 =4h+h2, and therefore that lim h+O

(2+h)2- 4 h

4h + h2

= lim ___ h+O

h

= lim 4 + h h+0

= 4.

This shows us, then, that the gradient of the tangent at x = 2 is 4. Does this fit in with what you found?

80

zyxwvuts zyxw zyxw zyx Calculus

zyxwvu zyxw zy

More generally, the gradient of the graph y =Ax) at the point

(x,Ax))is given by

This is called the derivative off, and is writtenf '(x)or sometimes justf '.

zyxw zyxw

Differentiation 1

81

zyxw zyxwv zyxw zyxw

Experiment 4: Differentiation Preparatory reading

In the preparatory reading for Experiment 3, we saw a mathematical argument proving that the gradient of the graph y = x2 at the point ( 2 , 4 )was 4. We can use a very similar argument to prove that gradient of the graph y = x2 at the point ( x , x2) is 2x, whatever the value of x may be: lim h+O

zyxw

( x + h ) 2- x 2 2xh + h2 = lim h h+O h = lim 2 x + h h+O

= 2x.

The derivative of x2, then, is 2x. We write iff(x) = x2 thenf '(x) = 2x

or dY = 2x. if y = x2 then -

dx

82

zyxwvutsr zyxw zyxwv Calculus

Finding a function's derivative is called differentiating the function.

We could repeat these kinds of calculation every time we need to differentiate (what we call differentiationfrom Prst principles), but that would be timeconsuming. Alternatively, we could rely on Mathematica to do the job for us every time; that, though, would be a kind of cheating. It would be ideal to have sets of rules that allow us to differentiate relatively quickly without relying on technology and without getting bogged down in calculations involving limits. In this experiment, you'll use Mathemarica to explore some rules of that type.

zy zyxwvu zyxw zyxwv

We've already met one Mathematica approach to diflerentiution: the f [x idea you saw in Experiment 3. Another uses something called the I) operator. Try the following: D[XA2, X I

1) Using either the D operator or the f [ X I technique, find the derivatives of x 3 , J? and x. What do you notice? Explore further. 2) Find the derivatives of dxt l/x, and 1/x2. Do these fit in with your findings from part l ?

3) Write a short report summarising your fi of the formfix) = xn. 4)

Try the following:

zyxwv zyxw zyxwv zyxw zyxw zyxw

Differentiation 1

Post-experiment reading The observations

83

iff@) = x 2 then f '(x) = 2x,

iff@) = x3 thenf'(x) = 3x2,

iff@) = x4 thenf '(x) = 4x3, etc. can be summed up in the single rule

if&) = x n thenf '(x) = &-I. This rule isn't hard to prove from first principles. It applies to any function of the form

including cases where n is fractional or negative. Thus, for example, suppose Ax)= dx. Then

f( x ) = .'I2 and thus

zyxwvu zyxw zyxwv f' ( x ) = z1 x -112

You'll notice, too, that the derivative of, say, 5x3 is 5 x 3x2 (or 15x2), and that the derivative of, say, 5x3 + 2x2 is 5 x 3x2 + 2 x 2x (or 15x2+ 4x). This works quite generally: the derivative of aAx) + b g(x) is af '(x) + b g'(x).

84

zyxwvutsrq zyxw Calculus

Experiment 5: Trigonometric functions

Differentiation 1

85

zy

zyxw zyxwvut zy

Post-experiment reading

It isn't hard to show, from first principles, that the derivative of sin x is, in fact, cos x. You need to know two facts: that, for small values of h, sin h is very close to h and cos h is very close to 1 h212; that sin (A + B ) = sin A cos B

-

zyxwvu zyx

+ cosA sin B.

The argument then goes like this. Supposeflx) = sin x. Then sin(x + h) - sin x h sin x cos h + cos xsin h -sin x = lim h h+0

f ' ( x ) = lim h+0

i h27

sinx l - T +hcosx-sinx "/ = lim h h+O h = lim cosx--sinx h+O 2 = cos x. A similar method can be used to show that the derivative of cos x is -sin x. Note, though, that all this only works if you measure all angles in radians.

86

zyxw zyxw zyxw zyx zyx zyxwv zyxw zyx Calculus

Experiment 6: Exponential functions and e Preparatory reading

Exponential functions are functions such as y = 2x, y = 4, y = Y,etc. Note that these functions are not the same as things like y = x2 or y = x3: we can’t apply the same rules when we differentiate them. The general shape of the graph of y = ax is more or less the same for all positive values of a : they all look roughly like this:

The graph begins very flat, so for x negative the gradient is close to zero. Then, as x gets larger, the graph gets very quickly steeper: the gradient rises rapidly. If we were to plot a graph of gradient against x, then, we’d get something that begins

close to zero, then rises very rapidly: something very like the graph of the function itself! This suggests that the derivative of an exponential function might be another exponential function, or something very like one.

87

Differentiation 1

Post-experiment reading

zy

zyxw zyxw

The results of this experiment strongly suggest that there is a close relationship between exponential functions and their derivatives. This is indeed the case, as the following argument makes clear. If&) = an, then

zyxwv zyxw

= L a x ,where L = lim-. h+O

ah- 1 h

88

zyxwv zyx zyxwv zyx zyxwv zyxw zyx zy Calculus

This means that the derivative of ax is just some multiple of ax itself. If we choose the value of a carefully, we can make L equal to 1. In this case, the derivative of ax will simply be ax. The value of a for which L = 1 is known as e , and is about 2.7182818284590452354. The functionffx) = 8is so important that it is known as the exponential function, sometimes also written exp(x). Remember the derivative of ex is ex. Check using Mathernatica if you like!

Experiment 7: Derivatives of inverses Preparatory reading Reminder: the inverse of a function is that function in reverse: if inverse off then

f-l

is the

zyxwvutsrq f ( a ) = b w f - y b ) = a.

The inverse of the functionffx) = ax is known as the logarithmic function f-1( x ) = log, x .

zyxw

The inverse of the exponential functionffx) = ex is known as the natural logarithm, and is written f - ' ( x ) = lnx ,or sometimes f - ' ( x ) = log x , though the latter notation may be more familiar to you as standing for loglo x . In Mathernatica, the natural logarithm is written Log [XI(and the base-10 logarithm as Log tl0,xI).

zyxw zyxw

Differentiation 1

89

snlnqv3

zyxw 06

zyxw zyxw zy zyxwvu zyxw zyxwvu zyxwvut Differentiation 1

91

Summary Function

Derivative

Xn

nxn-l

sin x

cos x

cos x

- sin x

ex

ex

In x

1 X

arcsin x

arctan x

zy

1

1 1+x2

Differentiation 2

94

zyxwvutsr Calculus

zyxw zy zyxw zyxwv zyx zyxw zyxw zyxwv Differentiation 2

95

Experiment 1: Products and quotients Preparatory reading

If you've performed the experiments in the Differentiation 1 module, you'll already know the importance of being able to find gradients of curved graphs, and you'll already know how to do this -how to differentiate- in the case of a fairly wide range of simple functions. We now seek techniques that allow us to differentiate things like

Y=

x5 sin x + eCoSn 2x + x3 f

more complicated functions built from the simple ones we can already handle.

In this experiment, you are asked to seek techniques for differentiating products and quotients. Thus, if we know how to differentiateflx) and g(x), then we can also differentiate bothfix) g(x) andflx)lg(x).

96

zyxwvutsr zyxw Calculus

zyxw zyxwvutsr zyxw zyxw

Post-experiment reading

zyxw

We can sum up the rules for differentiating products and quotients in the form of two formulae. The first, the product rule, is this:

d dx

-(24.)

or

du

dv

= v -+ u -,

d x d x

[uv]'=u'v+uv'.

zyxwv zyxw zyxwvu

zyxw

Direrentiution 2

97

The second, the quotient rule, can be stated like this:

This corresponds to the way Muthernuticu expresses the formula, but it is not the usual or preferred way of writing it. The quotient rule is more often expressed (and more easily remembered) as

du

v--24-

or

[;I1=-

u' v

dv

- uvf

V

2

.

zyxwv

Experiment 2: Composite functions Preparatory reading

zyxwv

A composite function is one made from two or more simpler functions strung together. For example: y = e cos x

cosine

+ exponential function

or y = cos(e x )

98

zyxw zyxwvutsr zyxw Calculus

exponential function

+ cosine

In this experiment, we seek a rule which enables us to differentiate a composite function when we know how to differentiate the two simple functions which make it up.

Post-experiment reading

zyx zyxwvut

The rule you have just discovered is called the chain rule. It can be written like this: if the derivative of u(x) is u‘(x)and the derivative of v(x) is v’(x)then the derivative of u[v(x)] is v’(x)u‘ [v(x)]; or, perhaps more simply, like this:

zyxw zyxw zyxwv zyxw zyxwvuts zyxwv zyxwvu zyxwv Differentiation 2

99

dy dy du -=-dx d u a k ‘

For example: if y = sin (5 + 1lx) then we let u = 5 + 1lx. Then y = cos u, which gives dY du

-=cosu

It follows that

du and -=11.

dx

dY = 11cos u = 1lcos(5 + 1lx). dx

QuestCons

We’ve included a feature which allows you practice questions and their answers. There differentiation rules, To generate a question o QiveQuastion I“product rule”

not forgetting to “shift-return”. To

You can do this as o and repetitions shou return”.]

100

zyxwvutsr zyxw zyxwvu Calculus

Experiment 3: Max and min Preparatory reading

A local maximum on a graph is “the top of a hill”: a point higher than all points close to it.

Note that it isn’t necessarily the highest point attained: merely the highest in its immediate vicinity. Similarly a local minimum is “the bottom of a valley”: a point lower than all points close to it.

zyxw zyxw

Difftrentiation 2

101

zyxwvutsr

A general term meaning “either maximum or minimum” is turning point.

Many real-life problems have to do with maximising and minimising quantities: an insight into the nature of maxima and minima is a useful thing to have. In this experiment, we use calculus to seek one.

102

zyxwvutsr Calculus

zyxw zyxw zyxw zyxwv zyxwvut Differentiation 2

103

Post-experiment reading

The stationary points on the graph of y =Ax) are those points where the graph is locally horizontal: wheref '(x) = 0. All turning points are stationary points, but not all stationary points are turning points: it's possible for the gradient to be zero at a point which is neither a maximum nor a minimum. This third type of stationary point is called a point of stationary (or horizontal) inflexion.

At a stationary point P where the second derivative is positive, the gradient is zero and rising. This means the gradient must be negative to the left of P, and positive to the right of P: we have a minimum.

104

zyxw zyxwvutsr Calculus

10;

X

f '(x) zero and rising

-

zyx

-

X

gradient off '(x) positive

-20-

zyxwvuts -30-

Similarly, a stationary point where the second derivative is negative is a maximum.

A stationary point where the second derivative is zero can be either a maximum, or a minimum, or a point of horizontal inflexion.

zyxw z zyxwvu zyx zyxwv Differentiation 2

GiveQuestion[

105

Experiment 4: Implicitly defined functions Preparatory reading

So far, we've only met graphs of functions of the form y =fix). However, it's entirely possible to specify a graph by means of an equation of which y is not the subject: an example is the circle equation x2 + y 2 = 4.

106

zyxw zyxwvutsr Calculus

zyxw zyxwvu

Equations such as this are said to define graphs implicitly. The circle example also defines a function y =Ax) implicitly if we restrict its range to be either all positive or all negative (since every input can have only one output).

zy

Each point on the graph of an implicitly defined function has a gradient, so it must be possible to make sense of the idea of the derivative of y with respect to x. In this experiment, you seek a way of doing that.

Differentiation 2

Post-experiment reading

zyxw zy 107

zyxw zyx zy

Implicit equations give us, typically, expressions for dyldx which involve both x and y (ordinary explicit equations give us dyldx as a function of x only). To find such expressions, we simply differentiate the implicit equation term by term, remembering that

(a result which is quite easy to prove from the chain rule).

108

zyxwvutsr zyxwvuts zyxwvuts zyxwvu zyxw zyx Calculus

For example:

y 2 = x2(3 - x) + 2y-dY = 6x - 3x2

dx dy 6x-3x2 j-= dx 2Y

Integration 1

110

zyxwvutsr Calculus

zyxw zyxwv zy

Integration 1

111

Experiment 1: Areas under curves Preparatory reading

It’s important for users of mathematics to have a way of calculating the area under a curve (or, more strictly, the area enclosed by the curve and the x-axis.) On a velocity-time graph, for instance, this area represents distance or displacement. There are two problems, however. Firstly, there’s the issue of how we calculate areas under curves. Secondly, it’s not even clear what, precisely, we mean by the area of an irregular shape. Definitions like “the amount of space inside” don’t really get us anywhere. Both problems can be solved at a stroke. It was first done, somewhat informally, by Newton and Leibniz in the seventeenth century, and the reasoning was then made more watertight by Riemann two hundred years or so later. Here’s a simplified version of the argument. We do know what we mean by the area of a rectangle:just its length times its width. We know how to calculate it too. But every irregular shape, including the area under the curve y =Ax), can be approximated as a collection of rectangles (the Riemann approximation).

112

zyxwvutsr zyxwvu zyxwvuts Calculus

If we know the width of each rectangle, and if we also know all the heights (which we can get from the equation of the curve), then we can calculate the area of them all, and thus the approximate area under the curve.

BIG IDEA: The thinner all the rectangles, the better the approximation.

Integration 1

zyxwv zy 113

Experiment 2: “Area so far’’ Preparatory reading The Riemann approximation is quite a good theoretical basis for our work, but it isn’t a very good way of calculating actual areas. To get anything like a good approximation, we usually need a very small strip width. You’re going to do some more numerical experiments of the type you’ve just met; it would be nice to have an approximate method which does a little better. We can obtain one by treating each strip, not as a rectangle, but as a long, thin trapezium.

114

zyxwvutsr zyxw Calculus

a

b

zyxw zyxw

h

The formula for the area of such a trapezium is

h(a + b) 2 ’

where h, a and b are as shown. We can get quite a good approximation for any given area by dividing it into trapezoidal strips, and repeatedly using this formula.

zyxwv zyxwv zyxwvu Integration I

115

This approach is called the trapezium rule. You’ll meet it again in more detail in a later series of experiments.

Post-experiment reading

zyxw

In general, we can say that the area under the graph of y = 3x2 up to the point x is x3 + c, where the value of c depends on where the measurement of area begins. The function (or, strictly, the family of functions) x3 + c can be thought of as an “area so far” function for y = 3x2. More formally, it is known as the indefinite integral of 3x2. Finding it is known as integrating 3x2. The notation we use for indefinite integrals recalls the Riemann approximation. You’ll recall that this involves the idea of slicing the area into thin strips which we treat as rectangles. If the width of each of these strips is 6x, then the height will be the y-value on the left edge of the strip, which we’ll call y.

116

zyxwvutsr Calculus

zyxwv

The area of each strip is thus y6x, so the total area might reasonably be written as

c

where is the usual symbol for summation. We’re interested in letting 6x get gradually smaller (and therefore letting the number of strips get larger) and noting the behaviour of the approximation. In other words, we think of the true area as being equal to

The standard notation for indefinite integrals is simply a shorthand form of the above, namely

zyx zyxwvuts zyxwvu zyxwvut

Note that the has turned into an elongated “s” (known as the integral sign) and the 6 has turned into a d. On the basis of the first two experiments, then, we can conjecture that

j3x2dx=x3 +c,

where the value of c depends on the point from which the area is measured.

Integration 1

zyxwv zy 117

Experiment 3: Integration and differentiation

Post-experiment reading The fact that integration happens to be, as it were, “differentiation backwards”, is so important that it’s known by the following rather grandiose name: the Fundamental Theorem of the Calculus. It’s not all that hard to prove, though we won’t.

zyxwvu zy zyxw

It gives us the basis for finding indefinite integrals (always assuming we don’t have Mathernatica to hand) To integrateflx), we try to find a function whose derivative isflx). Suppose we find one, and suppose we call it F(x): then any function of the form F(x) + c (where c is any constant) will also have derivative Ax),and the indefinite integral offlx) is F(x) + c.

For example, suppose we’re trying to find the indefinite integral of 8x7.We know from our work on differentiation that the derivative of x8 is 8x7.It follows that the indefinite integral of 8x7 is x8 + c.

118

zy

zyxwvutsrq Calculus

Experiment 4: Integration of xn

zyxw zy

Integration 1

119

zyxw

Post-experiment reading

The last activity suggests the following:

Xn+l

jx"dx = -+ c. n+l

It will be noted that the formula appears to be valid whatever the sign of n, and

whether or not n is a whole number. For example,

zyx zyxw

3

- XT _+ c

-

-

2

and +x

j

= x-2dX X

-1

=-+c

-1

1

--- +c.

zyxwvu X

The only exception is the integral of rl, which does not fit the pattern. Since the derivative of In x is llx, it follows (from the Fundamental Theorem of the Calculus) that the integral of llx is In x + c.

120

zyxwvutsr zyxw Calculus

Experiment 5: Other simple functions

zyxw zy

zyxw zyxwv zyxw zyxw zyxw zyxwvu zyx Integration 1

Post-experiment reading

121

By reversing the relevant differentiation results, we can establish the following:

J'sinx dx = --cosx

+ c;

Jcosx dx = sinx + c; J'exdx = e x

J'

I

Q -Jxf

+ c;

dx = sin-' x + c;

1

= tan-'

x + c.

You will notice that a number of familiar functions are missing from the list we have built up: what, for example, is the integral of tan x,or of In x? It turns out that we need to move rather beyond the "what is the function whose derivative is this?' technique in order to tackle even these functions, let alone more complicated ones. This we begin to do in the final experiment of this module; we take the process further in the Integration 2 module.

Experiment 6: Simple rules and patterns

zyxw

zyxwvutsr zyxw zyxwv zyxw zyx zyxw zyxwvutsr Calculus

122

Post-experiment reading

Since we can differentiate “term by term” in a long expression, it follows that we can integrate “term by term” too. For example:

j(5x3 +

p)

dx = SjX3dx + 7j:dx 5x4

=-++lnx+c. 4

Since the derivative of, say, sin (2x - 1) is 2 cos (2x - 1) (as you will know from your work on differentiation of composite functions), it follows that the integral of 2 cos (2x - 1) is sin (2x - 1) + c, and therefore that the integral of cos (2x - 1) is 1 - sin(2x - 1) + c. In general, if 2

then, if a and b are constants,

If(a+

1 b ) d x = - F(ax + b )+ c a

Simply divide by the coeficient of x. Note that we are still a long way from a general rule for integrating composite functions. In fact, there is no such general rule; no technique exists, for example, for integrating symbolically even so simple a composite function as

zyxw zyxw zyxwv zyxwv zyxwvut zyxwv zyxwv Integration 1

There are two more sets of q from the fourth set, type GiveQuestiont ‘lint,

not forgetting to “shift-enter”. LeLstAnswer

I 9nt , I’

For a question from t OiveQuestion t I‘

You can do this as oft

123

Integration 2

126

zyxwvutsr zyxw Calculus

This essential first step

zyxw zy zyxwv zyx

Integration 2

127

Experiment 1: Definite integrals Preparatory reading

If you have looked at the Integration I module you may recall the close connection between the idea of integration and the calculation of areas under curves. The first module’s treatment of symbolic, indefinite integration will now be of use to us in devising a method - an exact one, not an approximation - for finding such areas. The key ideas are these:

1. The indefinite integral is really an “area so far” function, which tells us the area under the curve “up to” a certain value of x. (It includes an arbitrary constant whose value depends on what point we start measuring from.) 2. We might typically be interested in finding the area under a certain curve (what’s known as the definite integral of the function) between, say, x = 3 and x=8.

2

4

6

8

3. We can get, from the indefinite integral, an expression for the area “up to” x = 8...

128

zyxwvutsr zyxw Calculus

zyxwv zyxwv

...and for the area “up to” x = 3:

A way of using these two expressions may already have occurred to you.

Integration 2

zyxw 129

zyxwvutsr zyxwvutsr

130

Calculus

Post-experiment reading

A definite integral calculation is set out formally as follows:

zy zyxwv zyxwvutsrq zyxwv

It’s important to note the following things. (i) The definite integral notation:

jabf(x) dx means “the definite integral offix)

between x = a and x = b”. The numbers a and b are called the limits of integration.

(ii) The square bracket notation: [ F ( x ) ] f :is shorthand for “F(b)- F(a)”. We just evaluate what’s inside the square brackets at each of the limits of integration, then subtract one from the other. (iii) We don’t include the constant of integration (if we did, it would cancel anyway). (iv) Where the curve dips below the x-axis (in other words, in those regions for which the function is negative), the integral regards enclosed areas above the xaxis as positive and below as negative. (So for sections of the curve below the xaxis, it is incorrect to speak of the area ‘under’ the curve.)

zyxw zyx zyxwvut zy zyxwvut zyxwvuts zyxwv Integration 2

131

This explains the result you probably got when you integrated sin x between 0 and 2 n. It's not at first obvious why Mathematica had so much trouble integrating l l x between x = -2 and x = 2. It looks OK to reason as follows:

= ln121- lnl-21 = ln2 - ln2 = 0.

Here's the problem, though: the domain of integration - the set of numbers between -2 and 2 - clearly includes the number zero, where the functions l l x and In x are not defined. The number zero is called a singularity of the integral. Singularities aren't always disastrous, but they can be, as here. The integral

j:2$

is said to be undefined.

132

zyxwvutsr zyxw Calculus

Experiment 2: The trapezium rule Preparatory reading

Using the indefinite, symbolic, integral to deduce actual areas (definite integrals) is the ideal method when it works, because the areas we get are exact. Symbolic integration is notoriously hard, though; functions don’t have to get all that complicated before we run out of techniques for integrating them symbolically.

zyxwvuts

Instead, we often fall back on the approximate methods, such as the Riemann approximation and the trapezium rule, that you have briefly met if you have worked in the Integration I module. The Riemann approximation is, as we’ve said elsewhere, of theoretical rather than practical interest; in practice, we generally want the trapezium rule or something better.

In this experiment you study the trapezium rule in more detail. As you’ll recall, we split the area we want to find into a number of strips, each of which we think of as being a trapezium (they’re not: that’s where the approximation comes in). Suppose the width of each trapezium is h, and the y-values (ordinates) at each trapezium boundary are yo, y1, y2, etc, as shown in the diagram below.

Integration 2

zyxw zyx zyx 133

h 2

Then the area of the first trapezium is, by the standard formula, - ( y o

So, if there are n trapezia (and therefore n total area of all the trapezia is h

= ?(YO + 2 y , + 2 y ,

zyx

+ 1 ordinates, from yo up to yn) then the

?(YO + Y1) + ;(Yl+ Y,) + ; ( Y 2 + Y J + h

+y l ) .

**.

+ 5(Y,-1 + Y,)

+ ... + 2Y,-2 + 2Yn-, + Y,) .

This serves as an approximation for the true area.

zy z

It’s a good idea, when doing trapezium rule calculations, to add up the numbers y1 to yn-l before doubling: that way, you only have to double once. Here’s a worked example.

To estimate, using eleven ordinates (and therefore ten strips), the integral 2 -dx. 1 . 1 x

zyxwvuts zyxwvuts zyxwvu

134

Calculus

h = 0.1 X

1.o 1.1

V -

IlX

1.oooooo

0.909091

1.2

0.833333

1.3

0.769231

1.4

0.714286

1.5

0.666667

1.6 1.7 1.8 1.9 2.0

zyxw zyxwvu zyxwv zyxwvu zyxwvu zyxwvuts 0.625000 0.588235

0.555556

0.526316

0.500000

1.500000 6.18771

0.1 Area = -(1.5 + 2 x 6.18771) 2 = 0.693771.

u will haw alrea have worked on the

TrapszieuleC

zyxwv

TarbulateQ->Truel

1)

Use the above Muthe

zyxw zyxw

Integration 2

135

zyxw

Experiment 3: Parabolic segments Preparatory reading

We can, of course, make the trapezium rule as accurate as we like by making h sufficiently small. However, it’s possible, without changing the value of h, to make the same data work harder for us. The argument (and it’s a clever one) goes like this. The trapezium rule depends on our taking segments of the graph, and pretending that each is simpler than it is. In fact, we pretend that each is as simple as it possibly could be: a straight line segment. We’d lose some simplicity, but

136

zyxwvutsrq zyxw zyxwvuts Calculus

possibly gain some accuracy, if we pretended instead that each segment was the second simplest thing it could possibly be.



The next simplest function after a linear one is a quadratic, and in the same way the next simplest curve after a straight line segment is a segment of a quadratic curve - what’s called a parabolic segment.

That’s the strategy, then: approximate the curve, not by a sequence of straight line segments, but by a sequence of parabolic ones.

Integration 2

Post-experimentreading

zyxw zy 137

zyxw

In this experiment you encountered the main drawback of trying to approximate a curve by a set of parabolic segments rather than a set of straight lines: namely, that each segment needs three points to specify it rather than two.

This leaves us with two options if we wish to use the “parabolic segments” idea to find approximate integrals. Either we sample the function in more places than we would for the trapezium rule, or we sample in the same number of places but settle for fewer segments. In practice, even if we take the second option we usually get a better approximation than the trapezium rule would give us.

zyxwvuts zyxw

This experiment seems to indicate that the area under the parabola that passes h 3

through (4,yo), (0, y1) and (h, y2) between x = -h and x = h is -(yo This is illustrated on the next page:

+ 4yl + y 2 ) .

138

zyxwvutsr Calculus

zyxwv zyxwvu

Now, the fact that, in the case we examined, the y-axis happened to be exactly in h

the middle is irrelevant. j ( y ~+ 4yl passes through the points

(I

+ y 2 ) is also the area under the parabola that

- h, yo), ( I , yl) and

(I

+ h, y 2 ) :

zy zyxw zyxwvutsr Integration 2

139

Experiment 4: Simpson’s rule Preparatory reading

Presented with a function for which we wish to find an approximate direct integral, we divide the range of integration into an even number of strips, each of width h. This gives us half that number of parabolic segments, each of width 2h, as shown:

zyxwv

The area of the first pair of strips put together is approximately equal to that under h 3

+ 4 y l + y2). The area of the second pair + 4y3 + y4). That of the third pair is

the first parabolic segment, namely -(yo is, similarly, approximately approximately

h (y4 3

-

h - (y2 3

+ 4y5 + y6), and so on.

140

zyxwvutsr zyxwvut zy zyxw Calculus

This is known as Simpson’s rule. As with the trapezium rule, it’s a good idea to add those ordinates which need to be multiplied by 2 or 4 first, and then perform the multiplication. Here is a worked example. To estimate the integral

61,

-&, using eleven

ordinates (and therefore ten strips, and a strip width of 0.1):

zyxw zyxwvu zyxwv zyxwvut zyxw zyxwv Integration 2

h =0.1 X

1.o 1.1 1.2 1.3

1.4 1.5 1.6 1.7

1.8 1.9 2.0

y = llx

1.oooooo

0.909091

0.833333

0.769231

0.714286

0.666667

0.625000

0.588235

0.555556

0.526316

0.500000

1..5000C)O 2.72817 3.45954

Area = E ( 1 . 5 + 2 x 2.72817 + 4 x 3.45954) 3

=0.69315.

141

142

zyxwvutsr Calculus

zyxw zy zyxwvuts zyxwvu Integration 2

143

Post-experiment reading

The two approximate integration methods you’ve met can be applied to a far wider range of functions than can any symbolic technique, including the more sophisticated ones in the next module. There’s a drawback, though, and it’s an obvious one: because these methods are approximate, our results may not be entirely trustworthy. There will be, in each case, an error: a difference between our estimate and the true value of the integral.

Often - though not always - this error will be quite small. In almost all cases of practical importance, Simpson’s rule outperforms the trapezium rule for the same number of ordinates, provided the strip width is small enough. Mathernatica’s NIntegrate function uses a highly sophisticated range of numerical integration techniques. It usually outperforms both the trapezium rule and Simpson’s rule, except where the strip width is extremely small. (A very small strip width can give rise to other kinds of accuracy problems, though, as well as making the execution time for TrapeziumRule and SiwsonsRule excessive.) NIntegrate is usually accurate to about fifteen decimal places. This makes it quite as good as Integrate for most practical applications of definite integration (with the advantage of working for a far larger class of functions and often using far less memory). Furthermore, it is possible to set options within NIntegrate which make it as accurate as you choose.

GiveQuestion I ’

and

Integration 3

146

zyxwvuts Calculus

Wold down the “shift” key Muthematica’s res

This essential fi

zyxwvu zyxwv

The following Mathem Commands that com Integrate, D, E HolBForm, Relea

Special commands for this modul

To find out more ab

zyxw zyxw zy

zyxw Integration 3

147

Experiment 1: Manipulating the integrand Preparatory reading

Integration is quite a lot harder to do than differentiation. There are no general rules for dealing with products, quotients or composite functions, so fairly simple functions (like cos (x2), for instance) can prove very difficult to integrate symbolically.

The thing we’re trying to integrate is called the integrand. One approach to integrals we don’t immediately know how to handle is to see if we can rewrite the integrand in an algebraically equivalent, but more “integration-friendly”, form.

Try some exampl more) polynomia and compare with the Mathematica does to

148

zyxwvutsr zyxw Calculus

Post-experiment reading

zyzy

(i) If the integrand is in the form of the product of two or more bracketed expressions, it’s usually best to expand the brackets before integrating. For example

zyxwvu zyx -5x4+x3+7x2-35x+7

-x

6

6

x

5

x4 7x3 +-+--4

3

2

1dr

35x + 7 x + c . 2

(ii) Integrands involving products of trigonometric functions are best recast in their equivalent forms involving multiple angles. For example

zyxw zyxw zyxwv zyxw zyx

Integration 3

149

s

zyxw zyxwvu zyxw 3 (1- cos2.x) dx = 3[x - 3sin 2x) + c

jsin’x dx =

t

= (2x - sin2x)

(iii) Integrands of the form

+ c.

where p and q are bothpolynomials, can be best tackled by factorising q(x), then expressing the function in partial fractions.

At its simplest, the method of partial fractions depends on the fact that ax+b (cx+d)(ex+ f )

can always be expressed in the form

A +- B c x + d ex+ f ’ the problem then being merely to find the values of the constants A and B. Here is a simple example. To perform the integral 1

2 l d x x -3~+2

we first reflect that 1 1 x2-3x+2 - ( ~ - 1 ) ( ~ - 2 ) -- A -

x-1

B +-3

x-2

zyx

where A and B are constants yet to be determined and where ‘b”is the identity sign, meaning “is equal, for all values of x, to”.

150

zyxwvuts zyxwvutsr

zyx zyx zyx

Calculus

Now, if

1 (x-l)(x-2)

-- A

- x-1

B

+-7

x-2

then 1= A ( x - 2) + B(x - 1). Setting x = 2 gives 1 = B, and setting x = 1 gives 1 -A. Hence 1 - 1 x2-3x+2 x-2

1 x-1’

and thus

x-2

x-1

+

= 1n)x- 2)- 1nJx- 1) c.

It can also be shown that ax2 + b x + c

can always be expressed in the form

A +- B x + C d x + e fx2+g’ which allows us to use this method on a wider range of functions.*

* Note that this is not intended to be a comprehensive treatment of partial fractions. In particular, we have ignored the important case in which there are repeated factors in the denominator.

zyxwv zyxw

Integration 3

151

Experiment 2: Change of variable, type 1 Preparatory reading Many integrals one meets can’t be dealt with in the manner of the last activity: no alternative, friendlier form of the integrand exists. An example is

there are many others.

152

zyxwvutsrq zyxw zyxw zyxw zyxwv Calculus

However, consider the function u = x2. It's clear that

x =1

2 dx'

du

-

dx

= 2 x , and therefore that

The integral can be written, then, as

zyxwv zy zyx

and it's not hard to show that this is in turn equivalent to

we can think of this as "the dx's cancelling", though that's not strictly what's going on. Performing the integration gives us

$ eu + c , which is equivalent to 4en' + c.

Here's how we'd set out the calculation:

I

I

2

xex d x = i eUdu = 1 ~ u +ec - 2l -

2 e X

(U =

x 2 3 du = 2 x d x

* x d x = r2d u )

+c.

The method, known as integration by change of variable, depends on spotting a function, which we call u, which appears buried somewhere in the integrand and whose derivative, duldx, is one of the parts of a product.

Integration 3

zyxw 153

154

zyxw zyxwvutsr zyxw zyxw zyxwv zyxw Calculus

Post-experiment reading

In the case of definite integration, we can change the x-limits on the integral into u-limits: this saves our having to convert back to x at the end. For example e'du

( u = x 2 a d u = 2 x d x a x d x =2~ d)u

u=4

=iju=, eUdu

(x=1

u = 1; x = 2 3 u = 4)

= 3 ( e 4 -e).

Experiment 3: Change of variable, type 2 Preparatory reading In all the change of variable examples you've met SO far, you've expressed the new variable, u , in terms of the old variable, x. Sometimes, it's possible to work the other way round: the old variable is expressed in terms of the new one. Here's an example, in which we integrate d(36 - x2) using the change of variable x = 6 sin t. .6cost dt

(x = 6sint 3 dx = 6cost dt)

(x=O*t

= 9 p t + sin 2t]tJ6

9215 =3n+-. 2

=o;

x=3*t

1

=$

zyxw zyxw

Integration 3

155

zyxwvutsr zy zyx zyxw

XP x p x p x p x p xp .n - ( A n > -= -n c= -n + -n = ( A n ) VP

P

AP

AP

nP

P

zyxwv zyxw zy zyxwvu zyxwv Integration 3

157

which can be written more simply as

zyx

The technique of integration by parts, based on this formula, uses the following strategy: to integrate a product, try to differentiate one half of it, and integrate the other, and end up with something simpler. In the case of the integral j x c o s x dx,

for instance, we can differentiate x, which gives 1, and integrate cos x, which gives sin x. Our new product will then be sinx x 1, or just sin x. Here’s how it works

I

xcosxdx=xsinx= xsin x

I

sinxdx

+ cosx + c.

u=x

dv=cosxdx

du=dx

v=sinx

158

zyxwvutsrqp Calculus

zyxwv zyxw zy

Integration 3

159

zyxw

Experiment 5: Areas in the plane Preparatory reading

Examine the following diagram.

It’s fairly clear that if we subtract the integral of the lower curve from that of the upper, between two appropriate limits, then what’s left will be the shaded area.

160

zyxwvutsr zyxw Calculus

What’s perhaps less immediately clear is that the same is true in the case of areas that lie below the x-axis, or even those that “straddle” it, like that shown below.

zyxw zyx zy zyxwvu zyxwv zyxwvu

To state it precisely: if the curves y =f(x) and y = g(x) do not cross in the domain a < x < b, and if y =f(x) is the upper of the two in this region, then the area enclosed between the two curves between x = a and x = b is

What happens if the two curves do cross? You are invited to consider this case in the following experiment.

Plot, on the same pair of a typing PlOt[{X”2,

XI,

{x

Find the finite area b

Integrate [x )

-

Use a similar technique and y = sin x for PO

zyx zy zy zyxw zyxwvuts

*in0idaMs aq 01 adeys pqos I? Bu;rsne3‘s!xl?-xayl inoqe i!aie10.1 aM au~8eur~ pue ‘ ( x ) j = ic dq paugap ‘aueld ayi uy v a n ue au!8eu11

162

zyxwvutsr Calculus

zyxwv zyxw zyxw zyx

In the limit as we make the disc thinner - that is, as Sx tends to zero - we have exact equality, and can write volume =

j bny’h, a

where a and b are the lower and upper x-limits of the shape.

zyxw zyxw zy zyx zyx zyxwvut Integration 3

163

Our curve in the first diagram of this section was actually y = x 2 - x 4 + 1

between x = 0 and x = 1, which means that the volume of the solid shown is

--1 8 7 ~ 1575 ’

We’ve written a c automates this cu 2) Check your answer to t VOlWil8OfRevOlUt

zyxwvu

zyxwvutsrq

VolwmeOfRevolut IllustrateQ

-

The integration invol for -2 I xI 1 is extre be done numerically.

VolumeOfRevoluti IllustrateQ -> IntFunction

-

164

zyxwvutsr Calculus

Series 2

166

zyxwvutsr Calculus

zyxw zy

zyxw zyxw Series 2 (Series)

167

Experiment 1: Binomial expansions Preparatory reading

Expressions such as (1+ x ) n are called binomial, meaning “with two terms”. It might help you to recall how such expressions are expanded: (1 + x)2 = (1 + x)(l + x )

+

= 1(1+ x ) x ( l + x )

=l+x+x+x 2 = 1 + 2 x + x2.

zyxw

(1+x)3 = (I+ x)(l+ x)2

=1[1+2x+x2 + x 1+2x+x2)

zyxwvut =1+3x+3x2+x3.

In the final expression, with like terms collected, the number multiplying each power of x is called its coefficient. So in the expansion of (1+x)2 the coefficient of x is 2 and the coefficient of x2 is 1.

Mathematica expands quad = ExpanB[(x+Z) The inverse of this Factor t quati]

168

zyxwvutsr zyxw Calculus

Post-experiment reading

zyxwv zyx

The coefficients form a pattern known as Pascal’s Triangle (after Blaise Pascal, a French mathematician, philosopher and theologian). The first five lines of Pascal’s Triangle are shown below.

1

1

4

1 1

2

3

1

5

1

1

3

4

6

10

1

10

1

5

1

zyxwv z zyxwvut zyxwvutsrq Series 2 (Series)

169

zyxw

(So, for example, (1 + x)4 = 1+ 4x + 6x2 + 4x3 + x4.)

Pascal’s Triangle is formed using the following rule: each element is the sum of the two directly above it.

It may not be immediately obvious why the Pascal’s Triangle pattern should arise in the context of binomial expansions. The second “10” in line 5, for example, is the x3 coefficient in the expansion of (1 + x>5. It is formed by adding 6 and 4: the x2and x3 coefficients, respectively, in the expansion of (1 + x ) ~ To . see why this should be so, reflect that

zyxw zyxw

(1 + x)5 = (1+ x)(l + x4)

= ( l + x ) ( 1 + 4 x + 6 x 2+4x3 + x 4 ) =1+4x+6x2+4x3+x4

+ x + 4 x 2 +6x3 +4x4 + x 5

-

...

+(4+6)x3+

....

Experiment 2: Factorials and the binomial coefficients Preparatory reading

For binomial expansions (1 + x ) when ~ IZ is very large, constructing Pascal’s Triangle is not a suitable method for generating the binomial coefficients. Think about (1 + x)loo: the Triangle simply becomes too big to print or display on a computer screen. There is a better way to do it, which involves the use of the idea of a factorial.

170

zyxwvutsr Calculus

zyxw zyxwvut zyxwvu

Post-experiment reading

The factorial of n , written n ! , is the product

n x ( n - 1) x ( n - 2)x.. .x2 x 1.

The exception is O!, which by convention is held to be 1.

zyxw zy zyxwvu zyx zyxw zyxw zyx Series 2 (Series)

Now: consider the expansion

171

( I + x ) ~ =1+6x+15x2 +20x3 +15x4 +6x5 + x 6 , and think of the coefficients in terms of factorials:

0 61 coefficient of x = 1= 0!6!’ 1 6! coefficient of x = 6 = -, 1!5! 2 6! coefficient of x = 15 = 2!4!’ 3 6! coefficient of x = 20 = -, 3!3! 4 6! coefficient of x = 15 = 4!2!’ 5 61 coefficient of x = 6 = -, 5!1! 6 6! coefficient of x = 1= 6!0!‘

More generally, the coefficient of x‘ in the expansion of (1 + xy” is

n!

This formula allows us to calculate binomial coefficients without needing to contruct Pascal’s Triangle. It is the best option for comparatively large values of

n. The accepted shorthand notation for choose r”.

or “C,; we often say “n

172

zyxw zyxw

zyxwvutsr zyxw Calculus

Experiment 3: (a + bx)n Preparatory reading

The ideas you have met generalise to binomial expansions such (1 + 2 . ~or) ~ (5 + 7 ~ )In~ this . experiment we look at binomials of the form (a + bxyt, where n is a positive integer.

zy zyxw zyxwvut zyx zyxw zyxwv zyxw Series 2 (Series)

173

Post-experiment reading In general

( a + b x y = a n + . .un-*. bx+

...+ ( r !)(n!n-r) ! .u"-'.(bx)'

+ ... + n.a. (bxy-' + ( b x y

It is conventional to order these expansions in increasing powers of x,and there is a good reason for doing so which we'll consider shortly. The completely general case for two variables x and y , is: (uy

+ b x y = ( U y y + n.(uy)n-l.bx + ... + ( r ! )n!( n - r ) !.(u + ...+n.ay.(bx)n-l

y y . (bx)'

+(bxy

This can also be written as:

pructiw questions binomial expansions

zyxwv

GiveQuestion[

To see the answer type: LastAnswer ["bi

Giveguestion[

174

zyxwvutsr zyxwvu zyxwvu zyxwv zyxwvut zyxwvu zyxwvu zyxwv Calculus

and repetitions should be commands: simply click

Note: this section us try going bock to the

Experiment 4: Other kinds of n Preparatory reading

Everything we’ve done so far has been valid only when n is a positive integer. We now want to consider expanding binomials to negative and non-integer powers such as:

Is it possible that the same pattern of coefficients that we found for positive integer n, n! r! (n-r)!’

works for negative and non-integer values?

Expand C (1 + x

zyxwv zyxw z

zyxwv zyxw Series 2 (Series)

175

Series[(l + xIA4, Series[ (1 + x)"4, etc. Compare the outp

Expand[(l + XI^

3)

Evaluate the foll

Series t (1 + Series[(l +

4)

Try the general expansion

Series[(l+~)~n,

Post-experiment reading

zyxwvu zyxw zyxwv

This experiment suggests that for all values of n (including negative and fractional ones) we can write n.(n-1) 2 n . ( n - l ) . ( n - 2 ) 3 ( l + x y =l+m+x + x + .... 2! 3!

This is indeed the case, although the proof is outside the scope of this module. This proposition is known as the binomial theorem.

176

zyxwv zyx zyxwvu zy zyxw zyxwv Calculus

For positive, integer n, the coefficients n.(n - I) 1, n, ---, 2!

n.(n - l).(n - 2 )

3!

, etc

are exactly the same as the factorial expressions

which you met in Experiment 2. The last such coefficient is

n.(n-l).(n-2). ... 2.1 9 n!

which is equal to 1; after that, they’re all zero. The expansion is therefore$nite in length, and holds true for all values of x. For negative or fractional n, though, the coefficients never become zero, and the expansion takes the form of an infinite series.

Experiment 5: Convergence Preparatory reading Consider the statement

(an example of the pattern you discovered in Experiment 4).

zyx

At first sight, it iss hard to see how an infinite series can possibly be the same as a finite binomial expression. What, we may ask, does it even mean to say that two such things are “equal”? The answer is that, for certain values of x, the value of the infinite expression on the right-hand side will approach that of the finite expression on the left as we take more and more terms. We say that, for these values of x, the series is convergent to the finite expression. Note that convergence need not happen for all values of x. What happens when convergence does not occur is one of the questions you are asked to address in this experiment.

zyxwv zyxw zyxwv zyxwvu zyxwvu zyxwvut Series 2 (Series)

177

Evaluate the following i

Series[(l + X I " ( Now evaluate

Muthematicu. 2)

Evaluate the foll

Normal [Series[ ( 1

This sets up a userpiece of Mutheinati

Try the following input myseries [x, 21 myseries [x, 3 1

zyxwvu

xlist = TabletmyS

Describe the output you se

4)

Substitute the value x = 0.

list1 = xlist / . x

Describe the behaviour o f t Generate a plot of these Listplot [list Describe what you s

‘...

+

zyxw zyxwv zyx zyxwvutsrqp zyxwv zy x

E

iE iz + m + 1 =& + I ) ( ~ - u ) . ( ~ - u ) W + z X ~

ieyi ~ u a w a ~ ae ~ y s~ xoyssaldxa , airuy amos 01 ,,Ienba,, s! i!lay1 6as 01 asuas ou s a ~ m J! pur! ‘mns a i p y ou sey s a p s aq1 ‘x30 s a n p .~aqio

zyxwv zy

Series 2 (Series)

179

zyxwvu zy zyxw

Experiment 6: Polynomial approximations Preparatory reading

A polynomial in x is a finite series of terms of the form axn, where IZ is a positive whole number; for example: 9+2x+15x2-x5,

- 4 + 2 x 3 +xll, 2 - x 2 +5x 3 , etc.

The degree of a polynomial is the highest power of x that it contains. Quadratics are polynomials of degree 2; cubics are polynomials of degree 3; quartics are polynomials of degree 4; quintics are of degree 5. When we say, for example:

(l+x)-' = 1 - x + x 2 - x 3 + x 4 . . , we mean that, for a certain range of x, the non-polynomial function:

(1 + x)-l and the quartic polynomial:

1-x+x 2 - x 3 +x4 have values close to each other.

180

zyxwvuts Calculus

Series 2 (Series)

Post-experiment reading

zyxw zy 181

zyxw

The idea that functions which aren’t themselves polynomials can nonetheless be approximated by them turns out to be one of the most useful in mathematics, because polynomials are so easy to work with.

zyxw zyxwvut

Although we introduced the idea of polynomial approximations and infinite series using the binomial expansion, it turns out that many functions can be approximated by suitable polynomials. Typically, as with the binomial expansions, the higher the polynomial’s degree, the better the approximation and/or the wider the range of values of x for which it is useful. As with binomial expansions, we can think of the successive polynomial approximations as leading towards an infinite series expansion in x. We call this expansion the function’s Maclaurin Series. This is what Mathematica calculates with its Series command

The Maclaurin series for In( 1 + x) and for arctan x are convergent only for -1