Tags :
mathematics function
based concept
function
mathematics
concept
based
discrete
approach
functions
called
set
notation
inverse
data
elements
input
element

Download Presentation

Download Presentation - The PPT/PDF document "Chapter 6 General Functions and Growth F..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Chapter 6General Functions and Growth Functions

1

Discrete Mathematics: A Concept-based Approach

Slide2Introduction

Every relation involves sets and combination of the elements of the sets. One can map the elements of one set to the other. This mapping is also called function. All the functions are relations, but every relation is not a function. In general every program is viewed as a function. Input to the program is a set and output of the program as another set.

In mathematics, a

function

is considered a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output.

2

Discrete Mathematics: A Concept-based Approach

Slide3In modern mathematics, a function is defined by its set of inputs, called the domain of the function and a set of the outputs, called co-domain or range of the function. The pictorial representation of a set of all pairs of inputs and outputs is called its graph. In case of the function

f(x) = x

2

, the domain and co domain are the real numbers, and the ordered pairs are of the form (

x, x2

). The function notation is also used in non-numeral situations, as given in the following illustrations (i) and (ii).

i

) Consider a set of employees in a firm. Now, we shall associate each employee of a firm to the salary obtained. This association is denoted by the function f. If x- denotes an employee, then f(x) denotes the salary obtained by the employee.

3

Discrete Mathematics: A Concept-based Approach

Slide4ii) Consider an electronics experiment to study the effect of temperature on a semiconductor, whose resistance decreases as temperature increases. Let x denote the temperature T and the resistance denotes the value of the function f(x). The resistance depends on temperature.

iii) Consider a mechanical engineering experiment of load and bending moment of a metal rod. Let x denote load applied (w) and f(x) denotes bending moment ,

( L/12 is constant for given set), where bending depends on the load applied.

4

Discrete Mathematics: A Concept-based Approach

Slide5Example : Consider the sets A = {1, 2, 3, 4, 5} , B = { a, b, c, d, e }. Whether f is a function?

f = { (1,a), (2,b), (3,b), (4,c), (5,c) }Solution: 1- is associated with a, 2- is associated with b, 3- associated with b, 4- is associated with c, 5- is associated with d. It is also denoted as f(1)= a, f(2) = b, f(3) = b, f(4) = c, f(5) = d. In this process, it should be noted that every element of A – is associated with a unique element of B and all elements of A are used. Hence it is a function.

Example :

Consider the sets A = {p, q, r}, and B = {a, b }. Let R be the relation from A to B. The function f is given as

f = { (p, a) (q, a) (q, b) (r, b) }.

Whether R – is a valid function from A to B?Solution: The function f = { (p, a), (q, a), (q, b),(r, b)}. The element q of A is related to two different elements a and b, of B, Hence, f is not a function.

5

Discrete Mathematics: A Concept-based Approach

Slide6Different Types of Functions:The functions are classified into two groups, namely, Algebraic functions and Transcendental functions.

Algebraic functions: It consists of a finite number of terms, which contains integral or fractional powers of the independent variable (argument) x. The function is operated by the four basic arithmetic operators +, -, x, and ÷. A few sub-classes of algebraic functions are as follows.

i

)Polynomial function ii) Rational function iii)Absolute value function iv) Exponential Function

6

Discrete Mathematics: A Concept-based Approach

Slide7Transcendental function: A function which is not algebraic is called a transcendental function. Trigonometric functions, inverse trigonometric functions, logarithmic functions, hyperbolic functions and inverse hyperbolic functions come under this category.

Hashing functions: In computer science, we store large number of data and yet provide random access to data. The computer can retrieve a specific record without reading other records first. The computer can identify the memory locations of records in the form of non-negative integers and are called keys. A transformation that maps the set of keys to a set of addresses (of memory cells) is called a

hashing function.

7

Discrete Mathematics: A Concept-based Approach

Slide8Into function:

A function f: A →B is called an into function, if some elements of co-domain are not images under the function f, as shown in Fig. 6.6. Let the sets be A= { 1,2,3,4,5} and: B= {a, b, c, d, e}. The function is defined as under f(1) = a, f(2) = b, f(3) = b, f(4) = c , and f(5) = d

8

Discrete Mathematics: A Concept-based Approach

Slide9Onto function: A function f: A →B is called an onto function, if all the elements of Co-domain are images under the function. Consider the relation on the two sets A = { 1, 2, 3, 4, 5 } and, B = {a, b, c, d}, is as shown in Fig.

9

Discrete Mathematics: A Concept-based Approach

Slide10One-One function: A function f: A →B is called a one-one function, if

different elements of domain have different images. Thatis x1

≠ x

2

, => f(x1) ≠ f(x2). The one-to-one function is

also called Injective function.It is to note that if there exist more than one member of A,say x

1

, x2 such that x1

= x2, then we have f(x1) = f(x2

).

Example :

Consider the function y = x

2

with the domain asthe set of real numbers. Show that the function is not one-one.Solution: Consider x

1=1 and x2 = -1. It is clear that x1 ≠ x2, but f(x1) = f(x

2)=1. Therefore, the function is not one-to-one.

10

Discrete Mathematics: A Concept-based Approach

Slide11One-One and onto:

A function f: A →B is said to be one-to-one and onto, if it is both one-one and onto function. It is also called Bijective

function.

Inverse function:

The inverse of a function exists only if the function is bijective, also

called one-one and onto. If f: A →B is a bijection, then the inverse function exists f

-1

: A →B. It is also true that the inverse of every element of B is a single element of A. f-1

: A →B. is also a bijection.

11

Discrete Mathematics: A Concept-based Approach

Slide12The function f: A →B is defined by f(1) = a, f(2) = b,f(3) = c f(4)=d, and A = { 1,2,3,4 } , B= { a, b, c, d }.

The inverse Function f-1: A →B is defined by f

-1

(a) = 1,

f-1(b) = 2, f-1

(c) = 3, and f-1(d) = 4. The inverse of the function exists, which is shown in Fig.

12

Discrete Mathematics: A Concept-based Approach

Slide13Example :As a simple example, if f converts a

temperature in degrees Celsius C to degrees Fahrenheit F, the function converting degrees Fahrenheit to degrees

Celsius would be a suitable f

−1

. . It’s inverse function converts degree Fahrenheit to

Degree Celsius.

Then its inverse function converts degrees Fahrenheit to degree Celsius.

Since

For every C. Such an inverse function exists if and only if f is bijective

13

Discrete Mathematics: A Concept-based Approach

Slide14Composite functions: It is also called function of a function. Consider three non-empty sets A,

B, C and the functions f: A →B and g

: B →C

The composition or product

of these functions is defined as the function (g ◦ f ). g ◦ f : A →C

with (g ◦ f)(x) = g[ f(x)] , for all x A.

14

Discrete Mathematics: A Concept-based Approach

Slide15A composite function g(f(

x)) can be visualized as the combination of two "machines". The first takes input x

and outputs f(

x). The second takes f(x) and outputs

g(f(x)). The composition of two functions takes the

output of one function as the input to the second

function. More specifically, the composition of f with a

function g: B→ C is the function. defined by

15

Discrete Mathematics: A Concept-based Approach

Slide16Illustration: If f and g are treated as relations, then the composition

of f and g denoted by and the composition ofthe functions g and f is denoted by .Suppose

that a airplanes elevation at time t is given by

the function h(t), and that the oxygen concentration at

elevation x is given by the function c(x). then

describes the oxygen concentration around the plane at time t.

16

Discrete Mathematics: A Concept-based Approach

Slide17Growth functionsIn science, engineering and technology, one frequently

comes across the asymptotic behavior of functions. It is necessary to estimate the growth of a function in terms

of another, usually simpler function and also the limiting

behavior of a function, when argument tends towards a

particular value or infinity.

17

Discrete Mathematics: A Concept-based Approach

Slide18Big-O notation:

Big-O notation, also called upper bound, is a member of a larger family of notations called Landau notation or Bachmann–Landau notation, named after Edmund Landau and Paul Bachmann or asymptotic notation. In computer science. Big-O notation is used to classify algorithms based on how they respond to the changes in the input size. The algorithms are analyzed in terms of processing time or working space requirements. In analytic number theory, it is used to estimate the "error committed", while replacing the asymptotic size or asymptotic mean size of an arithmetic function, by the value, or the mean value.

18

Discrete Mathematics: A Concept-based Approach

Slide19Big-O notation is also used to estimate the growth of a function in terms of another, usually simpler, function. The functions used in the estimation often include, log(n), n, n log(n), n

2, 2n, and n!.

In computer science, it is useful in the analysis of the complexity of algorithms, the number of effective operations an algorithm uses as its input grows. In mathematics, it is used to characterize the residual term of a truncated infinite series, especially an asymptotic series.

19

Discrete Mathematics: A Concept-based Approach

Slide20Definition: A function f(x) is said to be of the order

O(g(x)) if and only if there exists constants C and k, such that for every In principle, O(g(x)) is a set defined accordingly.

From theoretical point of view, we the following subset

relation

20

Discrete Mathematics: A Concept-based Approach

Slide21Example 6.31 Give a big–O estimate for these functions.

i) 3n + n3+4

ii) 1 + 2 + 3 + ---- + n + 3n

2

. iii)Log10 2

n + 1010 n

2

.Solution:a) Since 3n + n

3 +4 ≤ 3n3 +n3

+4 n

3

= 8 n

3

for n>1. Therefore, 3n+ n3 + 4 = O (n3)

b) We have 1 + 2 + 3 + ----+n ≤ n + n + ---+ n= n .n = n2 Hence, 1 + 2 + 3 +----+ n + 3 n2 ≤ n2

+3n2 = 4 n2

.

21

Discrete Mathematics: A Concept-based Approach

Slide22c)

22

Discrete Mathematics: A Concept-based Approach

Slide23Other notations:There are other notations used in the analysis of algorithms, namely, big omega

(Ω) and big-theta (Θ). The Ω indicates lower bound and Θ indicates tight bound.Ω-notation:

Just same as O-notation, it provides an asymptotic upper bound on

a function. Ω -notation gives an asymptotic lower bound. For a given function

g(n), we denote by Ω(g(n)).

Ω(g(n))= {f(n): there exists positive constants C and k such that 0≤Cg(n)≤f(n), for all n>k }. In other words, a function is of order Ω(g(n)) if and only if there

exists a constant (C > 0) and a constant k, such that for every (n > k),

Big-theta (Θ) notation: For any two functions f(n) and g(n), we have f(n) = Θ(g(n)) if f(n) = O(g(n)) and f(n) = Ω(g(n)).

23

Discrete Mathematics: A Concept-based Approach

Slide24The following fig gives the graphical representations of theaforesaid different notations.

24

Discrete Mathematics: A Concept-based Approach

Slide25ApplicationsWhile studying the complexity of an algorithm, we are

Concerned with the increase in the number of operationsrequired by the algorithm as the size of the data

Increases. We then try to Compare the values of this

function, for large n, to the values of some known

function, such as a power function, exponential function,

or logarithm function. Thus, the growth of functions refers to the relative size of the values of two functions for

large values of the independent variable.

25

Discrete Mathematics: A Concept-based Approach

Slide26That is, we are concerned with how the running time of an algorithm increases with the size of the input in the limit

, as the size of the input increases without bound. Usually, an algorithm that is asymptotically more efficient will be the best choice for all but very small inputs. This is one area wherein experience with the concept of a limit from calculus is of great help. Most algebra and calculus texts use log x to denote log

10

x (or, perhaps, log

e x), but in computer science base 2 is used more prevalently. So we shall use log x to denote log2 x.

26

Discrete Mathematics: A Concept-based Approach

Slide27Sorting

Sorting is an important concept in computer science. It provides a systematic arrangement of elements in a given record or a file. Telephone directory is an example of sorted data and it is called lexicographic ordering, which is one way of alphabetical ordering.Efficiency considerations

Many well established sorting methods are available in the literature. The important fact is that the programmer must be able to identify the several interconnected and sometimes conflicting efficiency considerations to make the best choice of sorting techniques. The most important considerations are listed under.

Time spent by programmer in coding a particular program.

The amount of machine time required for running the program

The amount of space required for the program.

27

Discrete Mathematics: A Concept-based Approach

Slide28Selection sortThe technique consists of selecting a data element and placing it in proper position and repeating the same till all the data elements get placed in their respective positions except the last one. The last data element gets automatically placed when the remaining (n – 1) data elements are placed in order. The initial n-element priority queue is reduced by one element after each selection. The entire array is sorted after n-1 iterations. The first pass makes (n – 1) comparisons, the second pass makes (n – 2) comparisons and so on.

Total number of comparisons

It is of the order O(n

2). The method is faster than the bubble sort. A little additional storage is required. There is no improvement if the input data is completely sorted or unsorted.

28

Discrete Mathematics: A Concept-based Approach

Slide29SummaryEvery function is a relation but vice versa need not be true. Every program is given concept to be function. Computer science applications in terms of growth functions are given with fair examples.

The analysis of algorithms is dealt with examples on sorting of data. The content of this chapter serves as basics to the course on analysis and design of algorithms

29

Discrete Mathematics: A Concept-based Approach

Slide30© 2020 docslides.com Inc.

All rights reserved.