Chapter 5 Functions Benchaporn Jantarakongkul Faculty of Informatics
Chapter 5 Functions Benchaporn Jantarakongkul Faculty of Informatics, Burapha University 1
Functions Example • กำหนดฟงกชน f: P C โดยกำหนด P = {Linda, Max, Kathy, Peter} C = {Boston, New York, Hong Kong, Moscow} f(Linda) = Moscow Linda Boston f(Max) = Boston Max New York f(Kathy) = Hong Kathy Hong Kong f(Peter) = Boston • f เปน ฟงกชนหรอไม พสย (range(ของฟงกช นนคอ ? yes ? Peter Moscow {Moscow, Boston, Hong Kong} Faculty of Informatics, Burapha University 7
Composition 1. f : Z R, f (x ) = x 2 และ g : R R, g (x ) = x 3 g○f : Z R , g○f (x ) = x 6 2. f : R R, f(x) = 7 x – 4, และ g : R R, g(x) = 3 x (g ○ f)(x) = g(f(x)) = g(7 x – 4) = 3(7 x – 4) = 21 x-12 (f ○ g)(x) = f(g(x)) = f(3 x) = 21 x - 4 3. f : {ประชากรโลก}, f (x ) = g(x ) = พอของ x g○f (x ) = ปของ x Faculty of Informatics, Burapha University 14
Repeated Composition A 1: f : Z Z, f (x ) = x 2 f 4(x ) = x (2*2*2*2) = x 16 A 2: g : Z Z, g (x ) = x + 1 gn (x ) = x + n A 3: h (x ) = พอของ x, hn (x ) = บรรพบรษลำดบท n ของ x Faculty of Informatics, Burapha University 16
คณสมบตของฟงกชน Linda Boston Max New York Kathy Hong Kong Peter Moscow Helena Sidney • f เปน • Yes Faculty of Informatics, Burapha University 1 -1? onto? bijection? 23
One-to-One, Onto, Bijection Examples 1. f : Z R, f (x ) = x 2: ไมเปนทง 1 -1 และ onto 2. f : Z Z, f (x ) = 2 x : เปน 1 -1 3. f : R R, f (x ) = x 3: เปนทง 1 -1, onto, bijection, inverse คอ f -1(x ) = x (1/3) 4. f : Z N, f (x ) = | x |: เปน onto 5. f (x ) = พอของ x : ไมเปนทง 1 -1 และ onto Faculty of Informatics, Burapha University 25
ฟงกชนผกผน (Inverse Function( ตวอยาง : ฟงกชนผกผน กำหนดโดย : f(Linda) = Moscow f(Max) = Boston f(Kathy) = Hong Kong f(Peter) = Sidney f(Helena) = New York f-1(Moscow) = Linda f-1(Boston) = Max f-1(Hong Kong) = Kathy f-1(Sidney) = Peter f-1(New York) = Helena ดงนน f-1 f เปน bijection ผกผนจะหาไดเฉพาะกบฟงกช นทเปน bijections เทานน Faculty of Informatics, Burapha University (= invertible functions) 27
- Slides: 30