Refinement of "Introduction to Discrete Mathematics" - Chapter 9 (Functions)

Learning is a long and arduous process, but not learning is even harder.

introduction

The author has always felt that discrete mathematics is an extremely important knowledge base in the study of computer science. The idea of ​​discretization is reflected in all aspects of computer science. For example, the concept of "pixel" is familiar to us in our daily life. Splitting a picture into tiny pixels is to use the idea of ​​discretization. In order to help everyone lay a solid foundation of thinking in discrete mathematics, the author has opened a new column to refine the book "Guide to Discrete Mathematics" to make it easier to understand. This article is the fifth part of this column, mainly introducing Chapter 9.
Chapter 1-3 Portal Portal
4-5 Portal Portal
Chapter 6-7 Portal Portal
Chapter 8 Portal Portal

text

function definition

The definition of a function we learned in middle school mathematics is that one independent variable corresponds to at most one dependent variable, which is similar in discrete mathematics.
A relation is called a function if each element in the source maps to at most one element in the target.

full function

If all elements of the function source can be mapped to an element of the target, the function is called a full function. The following figure is an example of a full function:
insert image description here

Coverage operation

Covering operation A⊕B, we use an example to illustrate:

  1. Let the following figure be the mapping relationship between functions A and B (the first line is the source, and the second line is the target):
    insert image description here
  2. Then A⊕B is:
    insert image description here

Then what A⊕B draws is: check the sequence pair in B one by one, if you find that the source of the sequence pair is also in A, then directly replace the target of the sequence pair in A with the target of the sequence pair in B, if is a new sequence pair (the source does not appear in A), and this sequence pair is directly added to A.

Properties of Functions (Key Points)

single shot

A function is injective if one element of the source maps to at most one element of the target. Note: It is also possible to map to 0 elements, i.e. do not map. The following figure is an injective function:
insert image description here

Full shot

This function is surjective if all elements in the target have source elements mapped to them. The following figure is a surjective function:
insert image description here

bijection

A function that is both injective and surjective is a bijective function. The following figure is a bijective function:
insert image description here

recursive function

Any function defined by itself is called a recursive function. As a classic recursive function, we use the Fibonacci function as an example:

f(1)=f(2)=1
n>2时,f(n)=f(n-1)+f(n-2)

In this function, except for f(1) and f(2), other function values ​​are defined by some function values ​​themselves.

well defined

We call the following recursive function well-defined :

  1. There is a base value
  2. Each time a function outside the base value evaluates to itself, the function argument moves closer to the base value.

It is not difficult to see from the definition that a well-defined recursive function is actually a recursive function that can finally find all function values. The Fibonacci function is a well-defined recursive function.
Please add a picture description
I am Shuang_Ai, a newcomer working hard on the road of algorithms, thank you for reading! If you think it is good, you can pay attention to it, and I will bring more and more comprehensive algorithm explanations in the future!

Guess you like

Origin blog.csdn.net/m0_72987309/article/details/130236594