Functions and Graphs. The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996.

Similar documents
Graphing Trig Functions - Sine & Cosine

Walt Whitman High School SUMMER REVIEW PACKET. For students entering AP CALCULUS BC

AP Calculus Summer Review Packet

Basics of Computational Geometry

SNAP Centre Workshop. Introduction to Trigonometry

A function: A mathematical relationship between two variables (x and y), where every input value (usually x) has one output value (usually y)

3. parallel: (b) and (c); perpendicular (a) and (b), (a) and (c)

Math Analysis Chapter 1 Notes: Functions and Graphs

AP Calculus AB. Table of Contents. Slide 1 / 180. Slide 2 / 180. Slide 3 / 180. Review Unit

Green Globs And Graphing Equations

Trigonometric Functions. Copyright Cengage Learning. All rights reserved.

MEI Desmos Tasks for AS Pure

AP Calculus AB. Table of Contents. Slide 1 / 180. Slide 2 / 180. Slide 3 / 180. Review Unit

Mastery. PRECALCULUS Student Learning Targets

Math Analysis Chapter 1 Notes: Functions and Graphs

MEI GeoGebra Tasks for AS Pure

1.1 Pearson Modeling and Equation Solving

Chapter 1. Math review. 1.1 Some sets

2D and 3D Transformations AUI Course Denbigh Starkey

MTH 120 Fall 2007 Essex County College Division of Mathematics Handout Version 6 1 October 3, 2007

Pre-Calculus Mr. Davis

Pure Math 30: Explained!

MEI GeoGebra Tasks for A2 Core

Welcome. Please Sign-In

2 Unit Bridging Course Day 2 Linear functions I: Gradients

Algebra II. Slide 1 / 162. Slide 2 / 162. Slide 3 / 162. Trigonometric Functions. Trig Functions

Limits. f(x) and lim. g(x) g(x)

We begin this section with a question. What do the roots of a polynomial have to do with its graph?

College Pre Calculus A Period. Weekly Review Sheet # 1 Assigned: Monday, 9/9/2013 Due: Friday, 9/13/2013

Important!!! First homework is due on Monday, September 26 at 8:00 am.

Section 1.5 Transformation of Functions

MATH STUDENT BOOK. 12th Grade Unit 4

Section 6.2 Graphs of the Other Trig Functions

Albertson AP Calculus AB AP CALCULUS AB SUMMER PACKET DUE DATE: The beginning of class on the last class day of the first week of school.

PARAMETRIC EQUATIONS AND POLAR COORDINATES

CLEP Pre-Calculus. Section 1: Time 30 Minutes 50 Questions. 1. According to the tables for f(x) and g(x) below, what is the value of [f + g]( 1)?

Math 3 Coordinate Geometry Part 2 Graphing Solutions

1 Review of Functions Symmetry of Functions; Even and Odd Combinations of Functions... 42

Chapter 7. Exercise 7A. dy dx = 30x(x2 3) 2 = 15(2x(x 2 3) 2 ) ( (x 2 3) 3 ) y = 15


Calculus I Review Handout 1.3 Introduction to Calculus - Limits. by Kevin M. Chevalier

1.7 Limit of a Function

Birkdale High School - Higher Scheme of Work

Algebra II Trigonometric Functions

Translation of graphs (2) The exponential function and trigonometric function

Section 1.5 Transformation of Functions

Unit 1: Sections Skill Set

A lg e b ra II. Trig o n o m e tric F u n c tio

Vocabulary Unit 2-3: Linear Functions & Healthy Lifestyles. Scale model a three dimensional model that is similar to a three dimensional object.

FUNCTIONS AND MODELS

1. How Mathematica works

Mid Term Pre Calc Review

Calculus III. 1 Getting started - the basics

Rational functions, like rational numbers, will involve a fraction. We will discuss rational functions in the form:

AH Properties of Functions.notebook April 19, 2018

Unit 1 and Unit 2 Concept Overview

Foundations of Math II

Preview Notes. Systems of Equations. Linear Functions. Let y = y. Solve for x then solve for y

9.1 Linear Inequalities in Two Variables Date: 2. Decide whether to use a solid line or dotted line:

Graphing Trigonometric Functions: Day 1

MAT 003 Brian Killough s Instructor Notes Saint Leo University

MEI Casio Tasks for A2 Core

An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s.

Section 7.6 Graphs of the Sine and Cosine Functions

Polar Coordinates. 2, π and ( )

1. The Pythagorean Theorem

Math Precalculus (12H/4H) Review. CHSN Review Project

8.6 Other Trigonometric Functions

DOWNLOAD PDF BIG IDEAS MATH VERTICAL SHRINK OF A PARABOLA

GSE Algebra 1 Name Date Block. Unit 3b Remediation Ticket

College Algebra. Gregg Waterman Oregon Institute of Technology

More Ways to Solve & Graph Quadratics The Square Root Property If x 2 = a and a R, then x = ± a

Applied Calculus. Lab 1: An Introduction to R

2.1 Transforming Linear Functions

Section 10.1 Polar Coordinates

Not for reproduction

Jim Lambers MAT 169 Fall Semester Lecture 33 Notes

Trigonometric ratios provide relationships between the sides and angles of a right angle triangle. The three most commonly used ratios are:

What is log a a equal to?

PreCalculus Summer Assignment

UPCAT Reviewer Booklet

Math 231E, Lecture 34. Polar Coordinates and Polar Parametric Equations

2.4. A LIBRARY OF PARENT FUNCTIONS

SECTION 1.3: BASIC GRAPHS and SYMMETRY

Section 4.1: Introduction to Trigonometry

AP Calculus Summer Review Packet School Year. Name

CCNY Math Review Chapter 2: Functions

Section 3.7 Notes. Rational Functions. is a rational function. The graph of every rational function is smooth (no sharp corners)

Topic. Section 4.1 (3, 4)

Week 4: Day 1: Unit circle and meaning!

Why Use Graphs? Test Grade. Time Sleeping (Hrs) Time Sleeping (Hrs) Test Grade

WARM UP DESCRIBE THE TRANSFORMATION FROM F(X) TO G(X)

Definitions Associated w/ Angles Notation Visualization Angle Two rays with a common endpoint ABC

GRAPHING WORKSHOP. A graph of an equation is an illustration of a set of points whose coordinates satisfy the equation.

Unit 2: Function Transformation Chapter 1. Basic Transformations Reflections Inverses

Quadratic Functions CHAPTER. 1.1 Lots and Projectiles Introduction to Quadratic Functions p. 31

Test # 1 Review. to the line x y 5. y 64x x 3. y ( x 5) 4 x 2. y x2 2 x. Á 3, 4 ˆ 2x 5y 9. x y 2 3 y x 1. Á 6,4ˆ and is perpendicular. x 9. g(t) t 10.

You are not expected to transform y = tan(x) or solve problems that involve the tangent function.

9-1 GCSE Maths. GCSE Mathematics has a Foundation tier (Grades 1 5) and a Higher tier (Grades 4 9).

Preparing for AS Level Further Mathematics

Transcription:

Functions and Graphs The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996.

Launch Mathematica. Type <<Mathetic`fngpack` Instructions for getting started Hold down the shift key and press the return key. Wait for Mathematica s response. Be sure to use the ` symbol rather than the ' : you may need to hunt for it on your keyboard. This essential first step sets up Mathematica for this module. If you omit this bit, the special commands (see below) will not work. Mathematica commands The following Mathematica commands are used in this module. Commands that come with Mathematica: Sin, Cos, Tan, Sqrt, Abs, Exp, Plot, ListPlot, Fit Special commands for this module only: GiveQuestion, LastAnswer To find out more about a Mathematica command, e.g. Plot, type?plot then shift-return.

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. 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: Mathematica issues Functions y = x 2 sin x, or y(x) = x 2 sin x, or f (x) = x 2 sin x, or f : x x 2 sin x. Mathematica uses square brackets to enclose function inputs, where we might usually use round ones. For example: Sin[Pi] Exp[2] Mathematica has many functions built in, and you can easily define your own functions in Mathematica as we ll see shortly. Graphs Computer-generated graphs in Mathematica are built by making a table of x and y coordinate pairs across a range of x. Mathematica chooses the y ranges on graphs so that it shows the most interesting part of the graph corresponding to the x-range you chose. You can force it to use a certain y-range if you use an option, like this: Plot[x^2, {x, -7, 7}, PlotRange -> {-5, 25}]

Experiment 1: Functions Preparatory reading Mathematica 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 Mathematica. 1) In the Getting Started module you ve seen and used some of Mathematica s built-in functions, for example: Sin, Abs, Exp. You should have an idea about what a function is, but look at the Introduction to make sure. Try out some Mathematica functions, for these and other inputs: Sin[Pi] Exp[1] Abs[-3] Cos[1.5] Log[10] 2) Mathematica s syntax for defining a new function is like this: square[n_] := n * n press shift-return to define it Note the use of the underscore character ( shift - on the keyboard), _, and ':=' rather than just '='. These are explained in the Post-experiment Reading for this Experiment. 3) Try the new function out: square[4] square[w] square[w + 3] Try the last two examples again after you ve assigned a value to w: w = 4 4) Function definitions may involve other variables, e.g.: quadratic[x_] := a x^2 + b x + c This is the general quadratic. Try using it before you assign values to a, b and c, then try it again after making the assignments: a=4; b=10; c=8; The semicolons here allow you to put several commands together into the same input line. They also have the effect of suppressing the output from any command. 5) Some functions are even, that is f ( x) = f ( x), and some functions are odd, f (x) = f ( x), and some are neither. Find two Mathematica functions that are even, two that are odd, and two that are neither. 6) Find the sets of values of a, b, and c that make the quadratic function even; and the sets of values that make it odd. Make a note of your answer.

Post-experiment reading Function definitions use two pieces of Mathematica syntax that you haven t seen before. The underscore character ( shift - on the keyboard), as in n_, used on the left-hand side of definitions means that the symbol n is a placeholder. This means that the function will work on whatever gets put in the square brackets: if you leave out the underscore, the function is only defined for the input n. Note that the n here is a local symbol, there s no danger of conflict with any use of the symbol n elsewhere. The difference between ':=' and '=' is slightly complicated. For the time being, we ll use the former for function definitions (like square[n_] := n * n) and the latter for ordinary assignments (like x = 5). The general quadratic function has two even terms (the x 2 term and the constant), and one odd one (the x term). To make the general quadratic into an even or odd function the offending terms have to be eliminated, by setting b = 0 for evenness, and a = c = 0 for oddness. The term symmetric function is sometimes used instead of even function, and anti-symmetric function instead of odd function. It is useful to keep in mind that even powers of a variable are even whilst odd powers are odd! 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 function f to g(x)". The function fg (sometimes written f g or f o g ) is called the composite of f and g. Notice that fg means apply the function g first, then apply f to the output. It is easy to get confused, because the function to be applied last is written first. 1) Define the general quadratic function: Clear[a, b, c] quadratic[x_] := a x^2 + b x + c 2) Compare these two commands: quadratic[sin[t]] Sin[quadratic[t]] Which of the functions has been applied first in each case? 3) Write functions to: (i) square an input; (ii) multiply an input by 3; (iii) multiply by 7;

(iv) add 5; (v) divide by 3. For example, the function for (ii) might look like this: times3[num_] := num * 3 Use sensible names! And remember to do shift-return to install each definition. 4) Using these functions, and others, with different numbers or variables as inputs, write a short discussion of the question: When does the order of applying functions make a difference, and when does it definitely not? 5) For some of the functions defined above there is an obvious inverse: a function that takes us back to where we started. You should already be able to type something like: times3[divide3[z]] and get z back as the output. Find the inverses, wherever they exist, of all the functions in part 3. 6) Think about this expression, which looks like it should work: Sqrt[square[-3]] Explain why the inverses of functions like sin x and x 2 need special treatment. 7) Can you find, or define, any functions that are self-inverting, so that: fun[fun[anynum]] outputs just anynum? Post-experiment reading Inverse functions can be problematic, because of our insistence that a function must only have one output. But, for example, there are two numbers whose squares are 9, namely 3 and 3. The inverse square of 9, then, is not uniquely defined. The solution to this problem is to define a limited inverse, which we usually call square root, that leads only to the positive one. The sine function is even worse. For example, the equation sin x = 0.5 has an infinite number of solutions and the convention is to choose the value that lies between - /2 and /2. With this restriction, the inverse of the sine function is written: arcsin x, or sin 1 x. The other inverse trigonometric functions are written similarly. These functions are discussed more fully in the Trigonometry module. Note that the sin 1 x notation is extremely ambiguous: it does not mean (sin x) 1 = 1/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 = 4x y 2 4 = x. 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 = 1/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 function f is the (infinite) set of points (x, y) such that y = f(x). When we draw graphs we usually choose some values of x, calculate f(x) and plot each of the points (x, y) until there are enough to be able to draw a curve through the points. Mathematica 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). 1) A powerful way to represent functions is by their graphs. Try this example of Mathematica s graph plotting command: Plot[x^2, {x, -4, 4}] This is the graph we usually call y = x 2, with y plotted vertically and x horizontally. 2) The Plot command gives Mathematica s best attempt at joining points together and putting on a pair of axes. Try this: Plot[1/(x-2), {x, 3, 5}] Repeat this plot with some different values for the range of x (i.e. the 3 and the 5 ) and write a note about how Mathematica seems to decide on the appearance of the axes. 3) There are many ways to modify the appearance of a plot. If a graph doesn t include the origin (0, 0) within its plotting ranges then Mathematica will normally make the axes cross at some other convenient point. You can insist on a certain crossing point (origin) for the axes by applying an option: Plot[1/(x-2), {x, 3, 5}, AxesOrigin->{0,0}] That looks a bit strange, but try this:

Plot[1/(x-2), {x,3, 5}], AxesOrigin->{0,0}, PlotRange->{{-1,5}, {-1,1}}] Plot has many other options, including ones for labelling axes, putting a title over a graph, and controlling the tick points along the axes. The options are very useful and you should get familiar with them. 4) Plot is a general-purpose plotting tool which sometimes goes wrong. Consider: Plot[1/(x-2), {x,-5,5}] This function has an asymptote at x = 2: its value is when approaching x = 2 from below, and + when approaching from above. But Plot doesn t know this and plods on, joining up a large negative value for x just less than 2 to a large positive value for x just bigger than 2. Don t be fooled: the computer s graph is wrong, and that joining line should not be there! 5) Plot will be fooled by each of the following functions. Try plotting them, and write a note identifying how and why each plot has gone wrong: (i) tan x (ii) x + 4 x 2 1 (iii) sin 1 x. 6) If you know a function and its inverse function, what can you say about their graphs? Here s an example function and its inverse: f[x_]:=5 x + 3; invf[x_]:=(x - 3) / 5 You can plot two graphs on the same set of axes by doing: Plot[{f[x], invf[x]}, {x,-5,5}, PlotRange->{-5,5}, AspectRatio->Automatic] The extra options here make the scales on both axes the same. This helps us to spot the general graphical relationship between a function and its inverse (there may be a clue in that). Try plotting some other function-and-inverse pairs, to determine and confirm what you believe the relationship is. What do the graphs of self-inverting functions have in common? Post-experiment reading 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 1/(x - 2) (discontinuous at x = 2), or tan x (discontinuous at x = ± /2, ±3 /2, ), or sin(1/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(1/x) 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 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 (t, 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. All straight lines have an equation like this: y = mx + c, where m is the gradient of the line (= tan θ), and c is the intercept on the y-axis. y θ c 0 x Here are the results of an experiment in which the temperature T of a system was measured at 1 minute intervals of the time t: t (mins) 1 2 3 4 5 6 7 8 T ( C) 45 51 54.5 62 64 70 76 78 1) We can store data of this sort in a Mathematica list. To enter it, type: data = {{1,45},{2,51},{3,54.5},{4,62},{5,64}, {6,70},{8,78}} We ve assigned the name data to this list. 2) Now let s plot these results, storing the graph under the name datagraph for later use: datagraph=listplot[data] We don t know the function underlying this graph. Can we use these points, which are subject to experimental errors, to find a functional relationship between T and t? 3) The simplest function to try and fit is a straight line. The following commands define a first guess for the slope and gradient of the straight line, and plot the line and data together on the same axes: m=4; c= 45; fitline = Plot[m * x + c, {x, 1, 8}] Show[{dataGraph, fitline}] 4) Adjust the values of m and c to get the best values.

Write a short report saying what we mean by best. Compare your results with friends and with Mathematica s own best-fit function: Fit[data, {1,x}, x] The {1,x} term here specifies that a straight line fit is required. You can try other powers of x, or different kinds of functions. Post-experiment reading 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): Experiment 5: Functions from graphs Preparatory reading This final Experiment is intended to help you see the relationships between common functions and their graphs. Spotting the function behind a graph is detective work, with clues like: Symmetry: in either axis, symmetric or anti-symmetric or neither Periodicity: trigonometric functions like sin x repeat every 2 radians Zeroes: what are the y values when x = 0, and x values when y = 0? Infinity: what happens as x goes towards ±? Infinite y can originate from division by zero at some value of x, or asymptotes of functions like tan x. from We ve set up a set of mystery plots, numbered from 1 to 11. To view the first, type: mysteryplot1

and so on. For each, identify the function that s been plotted (use trial and error if you like). Write a short report summarising the symmetry and periodicity characteristics of each function, and noting the positions of any zeroes and asymptotes. Practice Questions There are several sets of practice questions which present you with graphs that you should try to identify. Look at each graph, check it against your report from the last Experiment, and try to plot it for yourself in Mathematica. The first set of questions concerns graphs of powers of x between -2 and 4. Type: GiveQuestion["powers graphs"] for a question, and: LastAnswer["powers graphs"] to check your answer. You can do this as often as you want: the questions are randomly generated, and repetitions should be rare. For questions on trigonometric functions, type: GiveQuestion["trig graphs"] and to check your answer: LastAnswer["trig graphs"] Finally, for questions concerning a wider range of functions, use: GiveQuestion["graphs"] This section uses this module s special commands. If they fail to work try going back to the Instruction for Getting Started at the beginning.