Section III Mathematical Preparation knowledge

Source: Internet
Author: User
Tags mathematical functions

collection (set)

A whole consisting of certain, distinct members (Member) or elements (element). A member is taken from a larger range, called a base type. The number of members in the collection is called the cardinality of the collection (cardinality).

For example, set R consists of integers 3, 4, and 5, written as R={3, 4, 5}.

At this point the members of R are 3, 4, 5, the base type of R is integer, and the base of R is 3.

Depending on the base type of the collection, its members often have a linear order.

The members of the collection are called Subsets of the collection (subset), and each member of the subset belongs to that collection.

A collection without elements is called an empty set (empty sets, also known as Null set), which is billed as φ.

As in the above example, 3 is a member of R, recorded as: 3∈r, 6 is not a member of R, is recorded as: 6∉r. {3, 4} is a subset of R.

Representation of a set

1) The method of exhaustive: S={2, 4, 6, 8, 10};

2) Description Method: S={x|x is an even number, and 0≤x≤10}.

3, the characteristics of the collection

1) Certainty: Any object can be accurately judged to be an element in the set or not;

2) Cross-specific: The elements in the set cannot be duplicated;

3) Disorder: The elements in the collection are not order-independent.

Unit of measure: In accordance with the standard of representation provided by the IEEE, the byte abbreviation is "B", the bit abbreviation is "B", the megabyte (220 bytes) abbreviation is abbreviated as "MB", and the kilobytes (210 bytes) are abbreviated as "KB".

Factorial functions factorial function

The factorial function n! refers to the multiplication of all integers from 1 to n, where n is an integer greater than 0. So, 5!=1*2*3*4*5=120. In particular, 0!=1.

Remove the whole and take up the whole (floor and Ceiling):

The removed integer function (floor) of the real x is recorded as ⌊x⌋ and returns the largest integer not exceeding x. For example, ⌊3.4⌋=3 is the same as the result of ⌊3.0⌋.

The integral function (Ceiling) of the real x is recorded as ⌈x⌉ and returns the smallest integer not less than x. For example, ⌈3.4⌉=4 is the same as the result of ⌈4.0⌉.

modulo operator (modulus):

The modulo function returns the remainder, sometimes called redundancy, after the division is divisible. The representation of the modulo operator in the C # language is n%m. From the definition of the remainder, N%m gets an integer that satisfies the n=qm+r, where Q is an integer and 0≤r

Logarithmic:

If the power of a (a>0,a≠1) is equal to N, which is ab=n, then the number B is called the logarithm of the base N of a (logarithm), which is recorded as Logan=b, where a is called the logarithm of the radix, N is called the true number.

From the definition, negative numbers and 0 have no logarithm. In fact, because of the a>0, so no matter what the real number B is, there is ab>0, that is, regardless of what B is, N is always positive, so negative numbers and 0 have no logarithm.

The binary lookup algorithm used to find the specified value in a linear table: first compared to the intermediate element to determine whether the next step is to find in the upper half or in the lower part. Then continue to divide the appropriate child table in half until the specified value is found. a linear table of length n is then successively divided into half, until only one element in the last child table , how many times does it need to be performed? The answer is log2n times.

The logarithm used in this book is almost 2, because data structures and algorithms always divide things into two, or use bits to store encodings.

recursion :

An algorithm calls itself to do part of its work, and in solving certain problems, an algorithm needs to call itself. If an algorithm calls itself directly or indirectly, the algorithm is called recursive (Recursive). Depending on how it is called, it is divided into direct recursion (directly recursion) and indirect recursion (Indirect recursion).

There are many mathematical functions that are defined by recursion.

As we are familiar with the factorial function, we can define n! as follows:

The C # language of the factorial function is implemented as follows.

public static long fact (int n)

{

if (n <= 1)

return 1;

Else

return n * fact (n-1);

}

Recursive algorithms are usually not the most efficient computer program to solve problems, because recursive includes function calls, which require a space-time overhead. Therefore, recursion is more expensive than alternative alternatives such as while loops.

Section III Mathematical Preparation knowledge

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.