Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Topics • Intro. to Functions (7.1) • More functions (9.1) • Efficiency of algorithms/functions (9.2) 1 Original author of the slides: Vadim Bulitko University of Alberta http://www.cs.ualberta.ca/~bulitko/W04 Modified by T. Andrew Yang ([email protected]) 2 Definition • Intuition: a function takes input and produces one output: – f(x) = x2 – f(x) = sin(x) • Formalism: – Domain type: Df – Range type: Rf – [Mapping] Graph: • Gf = { <x, f(x)> | xDf, f(x)Rf} Df x Rf – For every xDf there is at most one pair <x,f(x)> Gf • Graphs of sample functions: – Let D = {1,2,3,4,5}. f(x) = x2, x D. – f(x) = 1/x, x R. 3 Example: f(x) = x2 4 Functional Property For every x there is at most one y such that y=f(x) [y=1/x] There is an x such that more than one y satisfy y=f(x) [x2+y2=25] Example: x=0, y1=5, y2=-5 5 Domain & Range 6 Questions? 7 Graphs of Real-Valued Functions of a Real Variable • A real-valued function of a real variable is a function from one set of real numbers to another. • Let f be a real-valued function of a real variable. • The graph of f is the set of all points (x, y) in the Cartesian coordinate plane with the property that x is in the domain of f and y = f(x). • Exercises: Show the graphs of the following functions. – – – – – f(x) = a, where a is a number. f(x) = ax, where a is a number. f(x) = x2 f(x) = x1/2 f(x) = log bx, where b is a number. 8 Multiple of f by M • Let f be a real-valued function of a real variable, and let M be any real number. • M f, called the multiple of f by M (or M times f), is the real-valued function with the same domain as f and (M f) (x) = M f(x), for all x in the domain of f. • See Example 9.1.4 (p.514-515) • Show the graphs of the following functions: f(x) = x f(x) = 2x f(x) = x2 f(x) = 3x2 9 Tool: http://www.lukewallin.co.uk/graph/newsuite.htm 10 Increasing vs Decreasing functions • Let f be a real-valued function defined on a set of real numbers, and suppose the domain of f contains a set S. • f is increasing on the set S iff for all x1 and x2 in S, x1 < x2 f(x1) < f(x2). • f is decreasing on the set S iff for all x1 and x2 in S, x1 < x2 f(x1) > f(x2). • See Figure 9.1.5 (p.516) for examples of increasing and decreasing functions. • Examples of increasing or decreasing functions? 11 Exercises p.517: 2, 3, 4, 5, 6, 7, 14, 15, 16 21, 22 12 Questions? 13