1 / 30

CSCI 115

CSCI 115. Chapter 5 Functions. CSCI 115. §5 .1 Functions. §5 .1 – Functions. Function Relation such that for every domain element a, |f(a)| = 1 Mappings, transformations f(a) = {b} f(a) = b a = argument b = function value. §5 .1 – Functions. Types of functions Everywhere defined

gaius
Download Presentation

CSCI 115

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI 115 Chapter 5 Functions

  2. CSCI 115 §5.1 Functions

  3. §5.1 – Functions • Function • Relation such that for every domain element a, |f(a)| = 1 • Mappings, transformations • f(a) = {b} • f(a) = b • a = argument • b = function value

  4. §5.1 – Functions • Types of functions • Everywhere defined • Onto • One to one (1–1) • 1 – 1 Correspondence • ED, Onto, 1–1 • Invertible Functions

  5. §5.1 – Functions • Theorem 5.1.1

  6. §5.1 – Functions • Theorem 5.1.2

  7. §5.1 – Functions • Theorem 5.1.4

  8. §5.1 – Functions • 1-1 functions and cryptography • Allows coding AND decoding • Substitution codes • Table from Example 18 (p. 188)

  9. CSCI 115 §5.2 Functions for Computer Science

  10. §5.2 – Functions for Computer Science • mod–n (or modn) • Factorial • Floor • Ceiling • Boolean • Hashing • Others

  11. §5.2 – Functions for Computer Science • Set • Collection of objects • Any element is unambiguously in the set or not • Characteristic function • Fuzzy sets • Whether or not an element is in the set may be ‘fuzzy’ • The set of all rich people

  12. §5.2 – Functions for Computer Science • Fuzzy sets • Function f defined on a set having values in the interval [0, 1] • If f(x) = 0, x is not in the set • If f(x) = 1, x is in the set • If 0 < f(x) < 1 then f(x) is the degree to which x is in the set • Degree of membership • Ordinary sets are special cases of fuzzy sets

  13. §5.2 – Functions for Computer Science • Fuzzy set operations • Theorem 5.2.1 (Finding other degrees of membership) • Let A and B be subsets of the same universal set U. Then:

  14. §5.2 – Functions for Computer Science • Fuzzy Logic • Fuzzy predicates • Values can be true, false, or somewhere in between • Schrodinger’s Cat • Quantum theory and computers • Applications • Control theory • Elevator operation • ABS systems in cars • Expert systems

  15. CSCI 115 §5.3 Growth of Functions

  16. §5.3 – Growth of Functions • Algorithmic Analysis • Efficiency • Number of steps (running time) • Comparison

  17. §5.3 – Growth of Functions • Definitions • Let f and g be functions whose domains are subsets of Z+. • We say f is O(g) (read f is big-Oh of g) if  constants c and k s.t. |f(n)|  c |g(n)|  n  k. • We say f and g have the same order if f is O(g) and g is O(f) • We say f is lower order than g (or f grows more slowly than g) if f is O(g) but g is not O(f)

  18. §5.3 – Growth of Functions • Definition • We define a relation Θ (called big-theta) on functions whose domains are subsets of Z+ as:fΘg iff f and g have the same order. • Theorem 5.3.1 • The relation Θ is an equivalence relation.

  19. §5.3 – Growth of Functions • Equivalence classes of Θ • Equivalence classes (called Θ–classes) consist of functions of the same order • One Θ–class is said to be lower than another if any of the functions in the first is lower than any in the second • Θ–classes provide the necessary information to do algorithmic analysis

  20. §5.3 – Growth of Functions • Image from page 203 of the text

  21. CSCI 115 §5.4 Permutation Functions

  22. §5.4 – Permutation Functions • Permutation • 1-1 correspondence from a set onto itself • Theorem 5.4.1 • If A = {a1, a2, …, an} with |A| = n, then n! permutations of A

  23. §5.4 – Permutation Functions • Cycle of length r • If p(a1) = a2, p(a2) = a3, …, p(ar-1) = ar and p(ar) = a1, this is called a cycle of length r, and is denoted (a1, a2,…, ar) • Disjoint cycles

  24. §5.4 – Permutation Functions • Theorem 5.4.2 • A permutation of a finite set that is not the identity or a cycle can be written as a product of disjoint cycles of length greater than or equal to 2

  25. §5.4 – Permutation Functions • Transposition • Cycle of length 2 • Every cycle can be written as a product of transpositions as follows: • (b1, b2, …, br) = (b1, br)(b1, br-1)  …  (b1, b2)

  26. §5.4 – Permutation Functions • Even permutation • A permutation that can be written as the product of an even number of transpositions • Odd permutation • A permutation that can be written as the product of an odd number of transpositions

  27. §5.4 – Permutation Functions • Theorem 5.4.3 • A permutation cannot be both even and odd • Theorem 5.4.4 • Let A = {a1, a2, …, an}, with |A| = n  2. Then there are n!/2 even permutations of A, and n!/2 odd permutations of A.

  28. §5.4 – Permutation Functions • Transposition codes • Encrypt by using the following transpositionMATH IS GREAT(1, 10, 7)  (11, 3, 2, 8)  (5, 4, 9) • Decrypt the followingMessage: OICLPCYIGULSOYRRVTTEATransposition Code: (16, 15, 6, 1, 3, 7, 11, 2)  (8, 13, 4, 5, 19)  (14, 10)  (21, 20, 17)

  29. §5.4 – Permutation Functions • Transposition codes • Keyword Columnar Transposition – Example 8Using the keyword “JONES” to encrypt:THE FIFTH GOBLET CONTAINS THE GOLDResult:FGTAHDTFBONGEHETTLHTLNSOIOCIEX

  30. §5.4 – Permutation Functions • Transposition codes • Keyword Columnar TranspositionUse the keyword “BASEBALL” to decrypt:AAK7ENWHRSOER9SAETOELNNWIDYELXBO1DXKTI3RUsing a keyword columnar transposition

More Related