functions
play

Functions f(x)=x 2 0 0 x Functions For each element in a - PowerPoint PPT Presentation

Functions f(x)=x 2 0 0 x Functions For each element in a universe (domain), a predicate assigns one of two values, True and False. Co-domain is {True,False} pair AIW 2 Likes(pair) Functions: more general (Alice, Alice) TRUE


  1. Functions f(x)=x 2 0 0 x

  2. Functions For each element in a universe (domain), a predicate assigns one of two values, True and False. “Co-domain” is {True,False} pair ∈ AIW 2 Likes(pair) Functions: more general (Alice, Alice) TRUE co-domains (Alice, Jabberwock) FALSE f : A → B (Alice, Flamingo) TRUE (Jabberwock, Alice) FALSE A function maps each element (Jabberwock, Jabberwock) TRUE in the domain to an element in (Jabberwock, Flamingo) FALSE the co-domain (Flamingo, Alice) FALSE To specify a function, should (Flamingo, Jabberwock) FALSE specify domain, co-domain (Flamingo, Flamingo) TRUE and the “table” itself

  3. Functions eg: Extent of liking, f: AIW 2 → {0,1,2,3,4,5} Note: no empty slot, x ∈ Domain f(x) ∈ Co-Domain no slot with more than one entry (Alice, Alice) 5 (Alice, Jabberwock) 1 Not all values from the (Alice, Flamingo) 4 co-domain need be used (Jabberwock, Alice) 0 (Jabberwock, Jabberwock) 4 Image: set of values in the (Jabberwock, Flamingo) 0 co-domain that do get used (Flamingo, Alice) 1 (Flamingo, Jabberwock) 0 For f:A → B, Im(f) ⊆ B s.t. (Flamingo, Flamingo) 5 Im(f) = { y ∈ B | ∃ x ∈ A f(x) = y }

  4. Functions eg: Extent of liking, f: AIW 2 → {0,1,2,3,4,5} x ∈ Domain f(x) ∈ Co-Domain (Alice, Alice) 5 (Alice, Alice) 5 (Alice, Jabberwock) (Alice, Jabberwock) 1 4 (Alice, Flamingo) (Alice, Flamingo) 4 (Jabberwock, Alice) 3 (Jabberwock, Alice) 0 (Jabberwock, Jabberwock) (Jabberwock, Jabberwock) 4 2 (Jabberwock, Flamingo) (Jabberwock, Flamingo) 0 (Flamingo, Alice) 1 (Flamingo, Alice) 1 (Flamingo, Jabberwock) (Flamingo, Jabberwock) 0 0 (Flamingo, Flamingo) (Flamingo, Flamingo) 5

  5. Function as a Relation As a relation between domain & co-domain, R f ⊆ domain × co-domain R f = { (x,f(x)) | x ∈ domain } Special property of R f : every x has a unique y s.t. (x,y) ∈ R f Can be represented using a matrix Convention: domain on the “x-axis”, co-domain on the “y-axis” Every column has exactly one cell “switched on” f(x) 5 4 3 2 1 0 ,J) (F ,F) (A,A) (A,J) (A,F) (J,A) (J,J) (J,F) (F ,A) (F x

  6. Plotting a Function When both domain and co-domain are numerical (or otherwise totally ordered), we often “plot” the function Shows only part of domain/codomain when they are infinite (here f: Z → Z ) f(x)= ⌊ x/5 ⌋ 0 f(x)=x 0 x f(x)=5x f(x)=x 2 0 0 0 x 0 x 0 x 0

  7. Composition Composition of functions f and g: g ○ f : Domain(f) → Co-domain(g) output input g ○ f(x) ≜ g(f(x)) g ○ f input output g ○ f g f (Alice, Alice) (Alice, Alice) 5 High High (Alice, Jabberwock) (Alice, Jabberwock) 4 (Alice, Flamingo) (Alice, Flamingo) (Jabberwock, Alice) (Jabberwock, Alice) 3 Medium Medium (Jabberwock, Jabberwock) (Jabberwock, Jabberwock) 2 (Jabberwock, Flamingo) (Jabberwock, Flamingo) (Flamingo, Alice) (Flamingo, Alice) 1 Low Low (Flamingo, Jabberwock) (Flamingo, Jabberwock) 0 (Flamingo, Flamingo) (Flamingo, Flamingo)

  8. Composition Composition of functions f and g: g ○ f : Domain(f) → Co-domain(g) g ○ f(x) ≜ g(f(x)) g ○ f f g (Alice, Alice) (Alice, Alice) 5 High High (Alice, Jabberwock) (Alice, Jabberwock) 4 (Alice, Flamingo) (Alice, Flamingo) (Jabberwock, Alice) (Jabberwock, Alice) 3 Medium Medium (Jabberwock, Jabberwock) (Jabberwock, Jabberwock) 2 (Jabberwock, Flamingo) (Jabberwock, Flamingo) (Flamingo, Alice) (Flamingo, Alice) 1 Low Low (Flamingo, Jabberwock) (Flamingo, Jabberwock) 0 (Flamingo, Flamingo) (Flamingo, Flamingo) Defined only if Im(f) ⊆ Domain(g) Typically, Domain(g) = Co-domain(f) g ○ f : Domain(f) → Co-domain(g) Im(g ○ f) ⊆ Im(g)

Recommend


More recommend