chapter 1 recurrent problem 具体数学 第一章

合集下载

美国初中数学教材第一章解决问题的工具

美国初中数学教材第一章解决问题的工具

骤是:1 探索作计划要从理解问题入手。

你需要了解什么是已知的,什么是未知的,问题是什么。

2计划理解了问题之后,你就应该列一个计划来解决这个问题了。

你可以使用很多办法和策略。

你将会在这本书里学到很多方法,策略。

通常这些方法会有助于你作出估计。

3解决接着你要执行你的计划。

如果这个计划行不同,就试试另外一个。

4检验最后,你应该看看你的答案是否能回答原来的问题。

你还可以用另一种方法来解决这个问题,以此来检查答案是否正确。

把你的答案和你估计的比较一下,如果答案讲不通,就重新建一个计划试一下。

例一让我们用四步法来试着解决本节开头的问题。

探索条件是什么?你知道什么?·一分钟有60秒。

·一小时有60分钟。

·一天有24小时。

·假设数一个数需要1秒钟。

问题是什么?你数到一百万需要多少天?计划因为你已经假设数一个数需要1秒钟,那么数到一百万就要1000000秒钟。

要想知道几天能数完一百万,首先要知道一天有多少秒。

要做到这一点,就必须把天换算成小时,把小时换算成分,再把分换算成秒。

然后再用除法算出数到一百万所需的天数。

解决·把天换算成分。

一位物理学家,一位建筑师,一位教授——挨着坐在一排看电影。

任意两位丈夫或妻子都不坐在一起,没有一个妻子坐在她丈夫旁边。

他们的名字分别是Jan,Joy,Jill,Bob,Bart,和Brad。

(名字和职业没有特别的顺序。

)牙医占据了中间两张座位中的一张,而且就坐在Joy的旁边。

Bob坐在这一排的最边上,坐在他旁边的是画家的妻子。

他们究竟是怎样就座的呢?有时候,当你在想怎么解决一个问题时,区分条件会帮助你。

探索你已知的是什么?·有六个成年人坐在一排。

·男女是交替而坐的。

·没有一个丈夫和他的妻子坐在一起。

·牙医坐在中间的一张座位,而且旁边坐的是Joy。

·Bob坐在最边上,而且旁边坐着画家的妻子。

组合数学chapter1

组合数学chapter1
Chapter 1 What is Combinatorics?
What is combinatorics?
Almost everyone has delt with the problems of combinatorics. The following are some examples: (1) The number of games that n terms would play. (2) Construct magic squares.
II. Pruned chessboard: Cut out two diagonally opposite squares. There is no perfect cover. We can prove it by assigning them two colors: 31BW

32B+30W
Example 1: Perfect cover of chessboard
A chessboard has 64 squares in 8 rows and 8 columns. A domino has 2 adjacent squares. Is it possible to arrange 32 dominoes to cover every square of chessboard (of course no 2 dominoes overlap)? Such an arrangement is called a perfect cover. The number of perfect covers is 12,988,816= 2 4 9012 , which was found by Fischer in 1961.
Some generalizations: I. 8-by-8 to m-by-n. The perfect cover need not exist now, such as m=n=3. It is easy to know that there is a perfect cover if and only if at least one of m and n is even

应用数学专业外文翻译

应用数学专业外文翻译

本科毕业论文外文翻译外文译文题目(中文):具体数学:汉诺塔问题学院:专业:学号:学生姓名:指导教师:日期: 二○一二年六月1 Recurrent ProblemsTHIS CHAPTER EXPLORES three sample problems that give a feel for what’s to c ome. They have two traits in common: They’ve all been investigated repeatedly by mathe maticians; and their solutions all use the idea of recurrence, in which the solution to eac h problem depends on the solutions to smaller instances of the same problem.1.1 THE TOWER OF HANOILet’s look first at a neat little puzzle called the Tower of Hanoi,invented by the Fr ench mathematician Edouard Lucas in 1883. We are given a tower of eight disks, initiall y stacked in decreasing size on one of three pegs:The objective is to transfer the entire tower to one of the other pegs, movingonly one disk at a time and never moving a larger one onto a smaller.Lucas furnished his toy with a romantic legend about a much larger Tower of Brah ma, which supposedly has 64 disks of pure gold resting on three diamond needles. At th e beginning of time, he said, God placed these golden disks on the first needle and orda ined that a group of priests should transfer them to the third, according to the rules abov e. The priests reportedly work day and night at their task. When they finish, the Tower will crumble and the world will end.It's not immediately obvious that the puzzle has a solution, but a little thought (or h aving seen the problem before) convinces us that it does. Now the question arises:What's the best we can do?That is,how many moves are necessary and suff i cient to perfor m the task?The best way to tackle a question like this is to generalize it a bit. The Tower of Brahma has 64 disks and the Tower of Hanoi has 8;let's consider what happens if ther e are TL disks.One advantage of this generalization is that we can scale the problem down even m ore. In fact, we'll see repeatedly in this book that it's advantageous to LOOK AT SMAL L CASES first. It's easy to see how to transfer a tower that contains only one or two di sks. And a small amount of experimentation shows how to transfer a tower of three.The next step in solving the problem is to introduce appropriate notation:NAME ANO CONQUER. Let's say that T n is the minimum number of moves that will t ransfer n disks from one peg to another under Lucas's rules. Then T1is obviously 1 , an d T2= 3.We can also get another piece of data for free, by considering the smallest case of all:Clearly T0= 0,because no moves at all are needed to transfer a tower of n = 0 disks! Smart mathematicians are not ashamed to think small,because general patterns are easier to perceive when the extreme cases are well understood(even when they are trivial).But now let's change our perspective and try to think big;how can we transfer a la rge tower? Experiments with three disks show that the winning idea is to transfer the top two disks to the middle peg, then move the third, then bring the other two onto it. Thi s gives us a clue for transferring n disks in general:We first transfer the n−1 smallest t o a different peg (requiring T n-1moves), then move the largest (requiring one move), and finally transfer the n−1 smallest back onto the largest (req uiring another T n-1moves). Th us we can transfer n disks (for n > 0)in at most 2T n-1+1 moves:T n≤2T n—1+1,for n > 0.This formula uses '≤' instead of '=' because our construction proves only that 2T n—1+1 mo ves suffice; we haven't shown that 2T n—1+1 moves are necessary. A clever person might be able to think of a shortcut.But is there a better way? Actually no. At some point we must move the largest d isk. When we do, the n−1 smallest must be on a single peg, and it has taken at least Tmoves to put them there. We might move the largest disk more than once, if we're n n−1ot too alert. But after moving the largest disk for the last time, we must trans fr the n−1 smallest disks (which must again be on a single peg)back onto the largest;this too re quires T n−1moves. HenceT n≥ 2T n—1+1,for n > 0.These two inequalities, together with the trivial solution for n = 0, yieldT0=0;T n=2T n—1+1 , for n > 0. (1.1)(Notice that these formulas are consistent with the known values T1= 1 and T2= 3. Our experience with small cases has not only helped us to discover a general formula, it has also provided a convenient way to check that we haven't made a foolish error. Such che cks will be especially valuable when we get into more complicated maneuvers in later ch apters.)A set of equalities like (1.1) is called a recurrence (a. k. a. recurrence relation or r ecursion relation). It gives a boundary value and an equation for the general value in ter ms of earlier ones. Sometimes we refer to the general equation alone as a recurrence, alt hough technically it needs a boundary value to be complete.The recurrence allows us to compute T n for any n we like. But nobody really like to co m pute fro m a recurrence,when n is large;it takes too long. The recurrence only gives indirect, "local" information. A solution to the recurrence would make us much h appier. That is, we'd like a nice, neat, "closed form" for Tn that lets us compute it quic kly,even for large n. With a closed form, we can understand what T n really is.So how do we solve a recurrence? One way is to guess the correct solution,then to prove that our guess is correct. And our best hope for guessing the solution is t o look (again) at small cases. So we compute, successively,T3= 2×3+1= 7; T4= 2×7+1= 15; T5= 2×15+1= 31; T6= 2×31+1= 63.Aha! It certainly looks as ifTn = 2n−1,for n≥0. (1.2)At least this works for n≤6.Mathematical induction is a general way to prove that some statement aboutthe integer n is true for all n≥n0. First we prove the statement when n has its smallest v alue,no; this is called the basis. Then we prove the statement for n > n0,assuming that it has already been proved for all values between n0and n−1, inclusive; this is called th e induction. Such a proof gives infinitely many results with only a finite amount of wo rk.Recurrences are ideally set up for mathematical induction. In our case, for exampl e,(1.2) follows easily from (1.1):The basis is trivial,since T0 = 20−1= 0.And the indu ction follows for n > 0 if we assume that (1.2) holds when n is replaced by n−1:T n= 2T n+1= 2(2n−1−1)+1=2n−1.Hence (1.2) holds for n as well. Good! Our quest for T n has ended successfully.Of course the priests' task hasn't ended;they're still dutifully moving disks,and wil l be for a while, because for n = 64 there are 264−1 moves (about 18 quintillion). Even at the impossible rate of one move per microsecond, they will need more than 5000 cent uries to transfer the Tower of Brahma. Lucas's original puzzle is a bit more practical, It requires 28−1 = 255 moves, which takes about four minutes for the quick of hand.The Tower of Hanoi recurrence is typical of many that arise in applications of all kinds. In finding a closed-form expression for some quantity of interest like T n we go t hrough three stages:1 Look at small cases. This gives us insight into the problem and helps us in stages2 and 3.2 Find and prove a mathematical expression for the quantity of interest.For the Tower of Hanoi, this is the recurrence (1.1) that allows us, given the inc lination,to compute T n for any n.3 Find and prove a closed form for our mathematical expression.For the Tower of Hanoi, this is the recurrence solution (1.2).The third stage is the one we will concentrate on throughout this book. In fact, we'll fre quently skip stages I and 2 entirely, because a mathematical expression will be given to us as a starting point. But even then, we'll be getting into subproblems whose solutions will take us through all three stages.Our analysis of the Tower of Hanoi led to the correct answer, but it r equired an“i nductive leap”;we relied on a lucky guess about the answer. One of the main objectives of this book is to explain how a person can solve recurrences without being clairvoyant. For example, we'll see that recurrence (1.1) can be simplified by adding 1 to both sides of the equations:T0+ 1= 1;T n + 1= 2T n-1+ 2, for n >0.Now if we let U n= T n+1,we haveU0 =1;U n= 2U n-1,for n > 0. (1.3)It doesn't take genius to discover that the solution to this recurrence is just U n= 2n;he nce T n= 2n −1. Even a computer could discover this.Concrete MathematicsR. L. Graham, D. E. Knuth, O. Patashnik《Concrete Mathematics》,1.1 ,The Tower Of HanoiR. L. Graham, D. E. Knuth, O. PatashnikSixth printing, Printed in the United States of America1989 by Addison-Wesley Publishing Company,Reference 1-4 pages具体数学R.L.格雷厄姆,D.E.克努特,O.帕塔希尼克《具体数学》,1.1,汉诺塔R.L.格雷厄姆,D.E.克努特,O.帕塔希尼克第一版第六次印刷于美国,韦斯利出版公司,1989年,引用1-4页1 递归问题本章将通过对三个样本问题的分析来探讨递归的思想。

Algebra1中英版对照目录

Algebra1中英版对照目录
GCF:greatest common factor LCM:least common multiple 0—10:Equivalent Fractions 等值分数 Z23—Z24 0—11:Decimals ,Fractions ,and Percents 小数,分数,百分数 Z25—Z27 0—12:Finding a Common Denominator 公分母求值 Z28—Z29 0—13:Adding and Subtracting Fractions 分数的加减运算 Z30—Z31 0—14:Multiplying and Dividing Fractions 分数的乘除运算 Z32—Z33
解两侧有变量的一元一次不等式 P194—P201 3—6:Solving Compound Inequalities
解混合一元一次不等式(一元一次不等式组)P202—P209 Quiz for Chapter 3 第三章小测试 P210—P225 CHAPTER 4—Functions 函数 4—1:Graphing Relationships 关系图(函数关系图)P230—P235 4—2:Relations and Functions 函数的对应关系 P236—P244 4—3:Writing Functions 函数的表达式 P245—251 4—4:Graphing Functions 函数的图像(直线、二次函数)P252—P260 CHAPTER 4—Functions 函数 4—5:Scatter Plots and Trend Lines 点的散布图与趋势线 P262—P271 4—6:Arithmetic Sequences 等差数列 (等差数列的项和通项)P272—P278 Quiz for Chapter 4 第四章小测试 P279—P291 CHAPTER 5— Linear Functions 一次函数 5—1:Identifying Linear Functions 识别一次函数 P296—P302 5—2:Using Intercepts 截距式(一次函数与坐标轴的交点)P303—P309 CHAPTER 5— Linear Functions 一次函数 5—2:Using Intercepts 截距式(一次函数与坐标轴的交点)P303—P309 5—3:Rate of Change and Slope 变化率和斜率 P310—P319 5—4:The Slope Formula 斜率的公式 P320—P325 5—5:Direct Variation 正比例函数 P326—P332 5—6:Slope-Intercept Form 斜截式方程 P334—P340 5—6:Point-Slope Form 点斜式方程 P341—P348 5—8:Slope of Parallel and Perpendicular Lines 相互平行与垂直直线的斜率

liu_ch01

liu_ch01

Æ Æ
4
CHAPTER 1. INTRODUCTION AND PRELIMINARIES cij is summable, then
∞ ∞ ∞ ∞
Theorem 1.2.1. If the double series
n m
cij =
(i,j )∈I
m,n→∞ j =1i=1
lim
cij =
cij =
1.1
Summability of Systems of Real Numbers
For a set S , the family of all nonempty finite subsets of S will be denoted by F (S ). Consider now a system {cα }α∈I , of real numbers indexed by an index set I . The system {cα }α∈I will be simply denoted by {cα } if the index set I is assumed either explicitly or implicitly. The system is called summable if there is ℓ ∈ such that for any ǫ > 0 there is A ∈ F (I ) with the property that whenever B ∈ F (I ) and B ⊃ A, then
Chapter 1
Introduction and Preliminaries
This chapter serves two purposes. The first purpose is to prepare the readers for the more systematic development in later chapters of methods of real analysis through some introductory accounts of a few specific topics. The second purpose is, in view of the possible situation where some of the readers might not be well conversant with basic operations of elementary analysis, to acquaint general readers with fundamental background of analysis.

01_introduction_problems

01_introduction_problems

Module:Introduction(Week2out of5)Course:Algorithmic Toolbox(Course1out of6)Specialization:Data Structures and Algorithms Programming Assignment1:IntroductionRevision:September10,2016IntroductionWelcome to your first programming assignment of the Algorithmic Toolbox class!It consists of seven algorithmic problems.The first three problems require you just to implement carefully the algorithms covered in the lectures.The remaining four problems will require you to first design an algorithm and then to implement it.For all the problems,we provide starter solutions in C++,Java,and Python3.These solutions implement straightforward naive algorithms that usually work only for small inputs.To verify this, you may want to submit these solutions to the grader.This will usually give you a“time limit exceeded”message for Python starter files and either“time limit exceeded”or“wrong answer”message for C++and Java solutions(the reason for wrong answer being an integer overflow issue).Your goal is to replace a naive algorithm with an efficient one.In particular,you may want to use the naive implementation for stress testing your efficient implementation.In this programming assignment,the grader will show you the input data if your solution fails on any of the tests.This is done to help you to get used to the algorithmic problems in general and get some experience debugging your programs while knowing exactly on which tests they fail.However,for all the following programming assignments,the grader will show the input data only in case your solution fails on one of the first few tests(please review the questions9.4and9.5in the FAQ section for a more detailed explanation of this behavior of the grader).1Learning OutcomesUpon completing this programming assignment you will be able to:1.See the huge difference between a slow algorithm and a fast one.2.Play with examples where knowing something interesting about a problem helps to design an algorithmthat is much faster than a naive one.3.Implement solutions that work much more faster than straightforward solutions for the following com-putational problems:(a)compute a small Fibonacci number;(b)compute the last digit of a large Fibonacci number;(c)compute a huge Fibonacci number modulo m;(d)compute the last digit of a sum of Fibonacci numbers;(e)compute the last digit of a partial sum of Fibonacci numbers;(f)compute the greatest common divisor of two integers;(g)compute the least common multiple of two integers.4.Implement the algorithms covered in the lectures,design new algorithms.5.Practice implementing,testing,and debugging your solution.In particular,you will find out how inpractice,when you implement an algorithm,you bump into unexpected questions and problems not covered by the general description of the algorithm.You will also check your understanding of the algorithm itself and most probably see that there are some aspects you did not think of before you had to actually implement it.You will overcome all those complexities,implement the algorithms,test them,debug,and submit to the system.Remember the advice(link)we gave you in the first module about testing your programs and feel free to return to those videos or parts of them again while working on your assignment.In the end of this document you will find also general recommendations on solving algorithmic problems.Passing Criteria:3out of7Passing this programming assignment requires passing at least3out of7code problems from this assignment. In turn,passing a code problem requires implementing a solution that passes all the tests for this problem in the grader and does so under the time and memory limits specified in the problem statement.2Contents1Problem:Small Fibonacci Number4 2Problem:Last Digit of a Large Fibonacci Number6 3Problem:Greatest Common Divisor8 4Problem:Least Common Multiple10 5Advanced Problem:Huge Fibonacci Number modulo m12 6Advanced Problem:Sum of Fibonacci Numbers14 7Advanced Problem:Partial Sum of Fibonacci Numbers16 8General Instructions and Recommendations on Solving Algorithmic Problems188.1Reading the Problem Statement (18)8.2Designing an Algorithm (18)8.3Implementing Your Algorithm (18)8.4Compiling Your Program (18)8.5Testing Your Program (20)8.6Submitting Your Program to the Grading System (20)8.7Debugging and Stress Testing Your Program (20)9Frequently Asked Questions219.1I submit the program,but nothing happens.Why? (21)9.2I submit the solution only for one problem,but all the problems in the assignment are graded.Why? (21)9.3What are the possible grading outcomes,and how to read them? (21)9.4How to understand why my program fails and to fix it? (22)9.5Why do you hide the test on which my program fails? (22)9.6My solution does not pass the tests?May I post it in the forum and ask for a help? (23)9.7My implementation always fails in the grader,though I already tested and stress tested it alot.Would not it be better if you give me a solution to this problem or at least the test casesthat you use?I will then be able to fix my code and will learn how to avoid making mistakes.Otherwise,I do not feel that I learn anything from solving this problem.I am just stuck (23)31Problem:Small Fibonacci NumberProblem IntroductionRecall the definition of Fibonacci sequence:F0=0,F1=1,and F i=F i−1+F i−2fori≥2.Your goal in this problem is to implement an efficient algorithm for computingFibonacci numbers.The starter files for this problem contain an implementationof the following naive recursive algorithm for computing Fibonacci numbers in C++,Java,and Python3:Fibonacci(n):if n≤1:return nreturn Fibonacci(n−1)+Fibonacci(n−2)Try compiling and running a starter solution on your machine.You will see that computing,say,F40already takes noticeable time.Another way to appreciate the dramatic difference between an exponential time al-gorithm and a polynomial time algorithm is to use the following visualization byDavid Galles:/~galles/visualization/DPFib.html.Try computing F20by a recursive algorithm by entering“20”and pressing the“Fi-bonacci Recursive”button.You will see an endless number of recursive calls.Now,press“Skip Forward”to stop the current algorithm and call the iterative algorithmby pressing“Fibonacci Table”.This will compute F20very quickly.(Note that the visualization uses a slightly different definition of Fibonacci numbers:F0=1insteadof F0=0.This of course has almost no influence on the running time.)Problem DescriptionTask.Given an integer n,find the n th Fibonacci number F n.Input Format.The input consists of a single integer n.Constraints.0≤n≤45.Output Format.Output F n.Time Limits.language C C++Java Python C#Haskell JavaScript Ruby Scala time in seconds11 1.55 1.52553 Memory Limit.512MB.Sample1.Input:3Output:2Explanation:F3=2.4Sample2.Input:10Output:55Explanation:F10=55.Starter FilesThe starter files for this problem contain an implementation of a naive algorithm for the problem in C++, Java,and Python3.For these programming languages,your goal is to replace the naive algorithm with an efficient one.For other programming languages,you need to implement a solution from scratch.Filename: fibonacciNeed Help?Ask a question or see the questions asked by other learners at this forum thread.52Problem:Last Digit of a Large Fibonacci NumberProblem IntroductionYour goal in this problem is to find the last digit of n-th Fibonacci number.Recall that Fibonacci numbers grow exponentially fast.For example,F200=280571172992510140037611932413038677189525.Therefore,a solution likeF[0]←0F[1]←1for i from2to n:F[i]←F[i−1]+F[i−2]print(F[n]mod10)will turn out to be too slow,because as i grows the i th iteration of the loop computes the sum of longer and longer numbers.Also,for example,F1000does not fit into the standard C++int type.To overcome this difficulty,you may want to store in F[i]not the i th Fibonacci number itself,but just its last digit(that is,F i mod10).Computing the last digit of F i is easy:it is just the last digit of the sum of the last digits of F i−1and F i−2:F[i]←(F[i−1]+F[i−2])mod10This way,all F[i]’s are just digits,so they fit perfectly into any standard integer type,and computing a sum of F[i−1]and F[i−2]is performed very quickly.Problem DescriptionTask.Given an integer n,find the last digit of the n th Fibonacci number F n(that is,F n mod10).Input Format.The input consists of a single integer n.Constraints.0≤n≤107.Output Format.Output the last digit of F n.Time Limits.language C C++Java Python C#Haskell JavaScript Ruby Scalatime in seconds11 1.55 1.52553Memory Limit.512MB.Sample1.Input:3Output:2Explanation:F3=2.6Sample2.Input:331Output:9Explanation:F331=668996615388005031531000081241745415306766517246774551964595292186469. Sample3.Input:327305Output:5Explanation:F327305does not fit into one line of this pdf,but its last digit is equal to5.Starter FilesThe starter files for this problem contain an implementation of a naive algorithm for the problem in C++, Java,and Python3.For these programming languages,your goal is to replace the naive algorithm with an efficient one.For other programming languages,you need to implement a solution from scratch.Filename: fibonacci_last_digitNeed Help?Ask a question or see the questions asked by other learners at this forum thread.73Problem:Greatest Common Divisor Problem IntroductionThe greatest common divisor GCD(a,b)of two non-negative integers a and b (which are not both equal to0)is the greatest integer d that divides both a and b. Your goal in this problem is to implement the Euclidean algorithm for computing the greatest common divisor.Efficient algorithm for computing the greatest common divisor is an important basic primitive of commonly used cryptographic algorithms like RSA.GCD(1344,217) =GCD(217,42) =GCD(42,7)=GCD(7,0)=7Problem DescriptionTask.Given two integers a and b,find their greatest common divisor.Input Format.The two integers a,b are given in the same line separated by space.Constraints.1≤a,b≤2·109.Output Format.Output GCD(a,b).Time Limits.language C C++Java Python C#Haskell JavaScript Ruby Scalatime in seconds11 1.55 1.52553Memory Limit.512MB.Sample1.Input:1835Output:1Explanation:18and35do not have common non-trivial divisors.Sample2.Input:288515381183019Output:17657Explanation:28851538=17657·1634,1183019=17657·67.Starter FilesThe starter files for this problem contain an implementation of a naive algorithm for the problem in C++, Java,and Python3.For these programming languages,your goal is to replace the naive algorithm with an efficient one.For other programming languages,you need to implement a solution from scratch.Filename: gcdWhat To DoTo solve this problem,it is enough to implement carefully the corresponding algorithm covered in the lectures.8Need Help?Ask a question or see the questions asked by other learners at this forum thread.94Problem:Least Common MultipleProblem IntroductionThe least common multiple of two positive integers a and b is the least positiveinteger m that is divisible by both a and b.Problem DescriptionTask.Given two integers a and b,find their least common multiple.Input Format.The two integers a and b are given in the same line separated by space.Constraints.1≤a,b≤2·109.Output Format.Output the least common multiple of a and b.Time Limits.language C C++Java Python C#Haskell JavaScript Ruby Scalatime in seconds11 1.55 1.52553Memory Limit.512MB.Sample1.Input:68Output:24Explanation:Among all the positive integers that are divisible by both6and8(e.g.,48,480,24),24is the smallest one.Sample2.Input:288515381183019Output:1933053046Explanation:1933053046is the smallest positive integer divisible by both28851538and1183019.Starter FilesThe starter files for this problem contain an implementation of a naive algorithm for the problem in C++, Java,and Python3.For these programming languages,your goal is to replace the naive algorithm with an efficient one.For other programming languages,you need to implement a solution from scratch.Filename: lcm10What To DoPlay with small datasets to find out how the least common multiple LCM(a,b)is related to the greatest common divisor GCD(a,b).Do you see?For any two positive integers a and b,LCM(a,b)·GCD(a,b)=a·b. Prove this property and implement an algorithm for computing the least common multiple using your solution for the greatest common divisor.Need Help?Ask a question or see the questions asked by other learners at this forum thread.115Advanced Problem:Huge Fibonacci Number modulo mWe strongly recommend you start solving advanced problems only when you are done with the basic problems (for some advanced problems,algorithms are not covered in the video lectures and require additional ideas to be solved;for some other advanced problems,algorithms are covered in the lectures,but implementing them is a more challenging task than for other problems).Problem IntroductionIn this problem,your goal is to compute F n modulo m,where n may be really huge:up to1018.For such values of n,an algorithm looping for n iterations will not fit into one second for sure.Therefore we need to avoid such a loop.To get an idea how to solve this problem without going through all F i for i from0to n,let’s see what happens when m is small—say,m=2or m=3.i0123456789101112131415F i01123581321345589144233377610F i mod20110110110110110F i mod30112022101120221Take a detailed look at this table.Do you see?Both these sequences are periodic!For m=2,the period is011and has length3,while for m=3the period is01120221and has length8.Therefore,to compute, say,F2015mod3we just need to find the remainder of2015when divided by8.Since2015=251·8+7,we conclude that F2015mod3=F7mod3=1.This is true in general:for any integer m≥2,the sequence F n mod m is periodic.The period always starts with01and is known as Pisano period.Problem DescriptionTask.Given two integers n and m,output F n mod m(that is,the remainder of F n when divided by m). Input Format.The input consists of two integers n and m given on the same line(separated by a space). Constraints.1≤n≤1018,2≤m≤105.Output Format.Output F n mod m.Time Limits.language C C++Java Python C#Haskell JavaScript Ruby Scalatime in seconds11 1.55 1.52553Memory Limit.512MB.Sample1.Input:1239Output:1Explanation:F1mod239=1mod239=1.12Sample2.Input:2391000Output:161Explanation:F239mod1000=39679027332006820581608740953902289877834488152161(mod1000)=161. Sample3.Input:281621358830524Output:10249Explanation:F2816213588does not fit into one page of this file,but F2816213588mod30524=10249.Starter FilesThe starter files for this problem contain an implementation of a naive algorithm for the problem in C++, Java,and Python3.For these programming languages,your goal is to replace the naive algorithm with an efficient one.For other programming languages,you need to implement a solution from scratch.Filename: fibonacci_hugeNeed Help?Ask a question or see the questions asked by other learners at this forum thread.136Advanced Problem:Sum of Fibonacci NumbersWe strongly recommend you start solving advanced problems only when you are done with the basic problems (for some advanced problems,algorithms are not covered in the video lectures and require additional ideas to be solved;for some other advanced problems,algorithms are covered in the lectures,but implementing them is a more challenging task than for other problems).Problem IntroductionThe goal in this problem is to find the last digit of a sum of the first n Fibonacci numbers.Problem DescriptionTask.Given an integer n,find the last digit of the sum F0+F1+···+F n.Input Format.The input consists of a single integer n.Constraints.0≤n≤1014.Output Format.Output the last digit of F0+F1+···+F n.Time Limits.language C C++Java Python C#Haskell JavaScript Ruby Scalatime in seconds11 1.55 1.52553Memory Limit.512MB.Sample1.Input:3Output:4Explanation:F0+F1+F2+F3=0+1+1+2=4.Sample2.Input:100Output:5Explanation:The sum is equal to927372692193078999175,the last digit is5.Starter FilesThe starter files for this problem contain an implementation of a naive algorithm for the problem in C++, Java,and Python3.For these programming languages,your goal is to replace the naive algorithm with an efficient one.For other programming languages,you need to implement a solution from scratch.Filename: fibonacci_sum_last_digitWhat To DoInstead of computing this sum in a loop,try to come up with a formula for this sum.For this,play with small values of n.Then,use a solution for the previous problem.14Need Help?Ask a question or see the questions asked by other learners at this forum thread.157Advanced Problem:Partial Sum of Fibonacci NumbersWe strongly recommend you start solving advanced problems only when you are done with the basic problems (for some advanced problems,algorithms are not covered in the video lectures and require additional ideas to be solved;for some other advanced problems,algorithms are covered in the lectures,but implementing them is a more challenging task than for other problems).Problem IntroductionNow,we would like to find the last digit of a partial sum of Fibonacci numbers:F m+F m+1+···+F n.Problem DescriptionTask.Given two non-negative integers m and n,where m≤n,find the last digit of the sum F m+F m+1+···+F n.Input Format.The input consists of two non-negative integers m and n separated by a space. Constraints.0≤m≤n≤1018.Output Format.Output the last digit of F m+F m+1+···+F n.Time Limits.language C C++Java Python C#Haskell JavaScript Ruby Scalatime in seconds11 1.55 1.52553Memory Limit.512MB.Sample1.Input:37Output:1Explanation:F3+F4+F5+F6+F7=2+3+5+8+13=31.Sample2.Input:1010Output:5Explanation:F10=55.Sample3.Input:10200Output:2Explanation:F10+F11+···+F200=73454486715781809323490890211044929642326216Starter FilesThe starter files for this problem contain an implementation of a naive algorithm for the problem in C++, Java,and Python3.For these programming languages,your goal is to replace the naive algorithm with an efficient one.For other programming languages,you need to implement a solution from scratch.Filename: fibonacci_partial_sumWhat To DoUse a solution for the previous problem to solve this problem.Need Help?Ask a question or see the questions asked by other learners at this forum thread.178General Instructions and Recommendations on Solving Algorith-mic ProblemsYour main goal in an algorithmic problem is to implement a program that solves a given computational problem in just few seconds even on massive datasets.Your program should read a dataset from the standard input and write an answer to the standard output.Below we provide general instructions and recommendations on solving such problems.Before reading them,go through readings and screencasts in the first module that show a step by step process of solving two algorithmic problems:link.8.1Reading the Problem StatementYou start by reading the problem statement that contains the description of a particular computational task as well as time and memory limits your solution should fit in,and one or two sample tests.In some problems your goal is just to implement carefully an algorithm covered in the lectures,while in some other problems you first need to come up with an algorithm yourself.8.2Designing an AlgorithmIf your goal is to design an algorithm yourself,one of the things it is important to realize is the expected running time of your ually,you can guess it from the problem statement(specifically,from the subsection called constraints)as follows.Modern computers perform roughly108–109operations per second.So,if the maximum size of a dataset in the problem description is n=105,then most probably an algorithm with quadratic running time is not going to fit into time limit(since for n=105,n2=1010)while a solution with running time O(n log n)will fit.However,an O(n2)solution will fit if n is up to103=1000, and if n is at most100,even O(n3)solutions will fit.In some cases,the problem is so hard that we do not know a polynomial solution.But for n up to18,a solution with O(2n n2)running time will probably fit into the time limit.To design an algorithm with the expected running time,you will of course need to use the ideas covered in the lectures.Also,make sure to carefully go through sample tests in the problem description.8.3Implementing Your AlgorithmWhen you have an algorithm in mind,you start implementing it.Currently,you can use the following programming languages to implement a solution to a problem:C,C++,C#,Haskell,Java,JavaScript, Python2,Python3,Ruby,Scala.For all problems,we will be providing starter solutions for C++,Java,and Python3.If you are going to use one of these programming languages,use these starter files.For other programming languages,you need to implement a solution from scratch.8.4Compiling Your ProgramFor solving programming assignments,you can use any of the following programming languages:C,C++, C#,Haskell,Java,JavaScript,Python2,Python3,Ruby,and Scala.However,we will only be providing starter solution files for C++,Java,and Python3.The programming language of your submission is detected automatically,based on the extension of your submission.We have reference solutions in C++,Java and Python3which solve the problem correctly under the given restrictions,and in most cases spend at most1/3of the time limit and at most1/2of the memory limit. You can also use other languages,and we’ve estimated the time limit multipliers for them,however,we have no guarantee that a correct solution for a particular problem running under the given time and memory constraints exists in any of those other languages.Your solution will be compiled as follows.We recommend that when testing your solution locally,you use the same compiler flags for compiling.This will increase the chances that your program behaves in the18same way on your machine and on the testing machine(note that a buggy program may behave differently when compiled by different compilers,or even by the same compiler with different flags).∙C(gcc5.2.1).File extensions:.c.Flags:gcc-pipe-O2-std=c11<filename>-lm∙C++(g++5.2.1).File extensions:.cc,.cpp.Flags:g++-pipe-O2-std=c++14<filename>-lmIf your C/C++compiler does not recognize-std=c++14flag,try replacing it with-std=c++0x flag or compiling without this flag at all(all starter solutions can be compiled without it).On Linux and MacOS,you most probably have the required compiler.On Windows,you may use your favorite compiler or install,e.g.,cygwin.∙C#(mono3.2.8).File extensions:.cs.Flags:mcs∙Haskell(ghc7.8.4).File extensions:.hs.Flags:ghc-O∙Java(Open JDK8).File extensions:.java.Flags:javac-encoding UTF-8java-Xmx1024m∙JavaScript(Node v6.3.0).File extensions:.js.Flags:nodejs∙Python2(CPython2.7).File extensions:.py2or.py(a file ending in.py needs to have a first line which is a comment containing“python2”).No flags:python2∙Python3(CPython3.4).File extensions:.py3or.py(a file ending in.py needs to have a first line which is a comment containing“python3”).No flags:python3∙Ruby(Ruby2.1.5).File extensions:.rb.ruby∙Scala(Scala2.11.6).File extensions:.scala.scalac198.5Testing Your ProgramWhen your program is ready,you start testing it.It makes sense to start with small datasets—for example, sample tests provided in the problem description.Ensure that your program produces a correct result.You then proceed to checking how long does it take your program to process a massive dataset.For this,it makes sense to implement your algorithm as a function like solve(dataset)and then implement an additional procedure generate()that produces a large dataset.For example,if an input to a problem is a sequence of integers of length1≤n≤105,then generate a sequence of length exactly105,pass it to your solve()function,and ensure that the program outputs the result quickly.Also,check the boundary values.Ensure that your program processes correctly sequences of size n= 1,2,105.If a sequence of integers from0to,say,106is given as an input,check how your program behaves when it is given a sequence0,0,...,0or a sequence106,106,...,106.Check also on randomly generated data.For each such test check that you program produces a correct result(or at least a reasonably looking result).In the end,we encourage you to stress test your program to make sure it passes in the system at the first attempt.See the readings and screencasts from the first week to learn about testing and stress testing:link.8.6Submitting Your Program to the Grading SystemWhen you are done with testing,you submit your program to the grading system.For this,you go the submission page,create a new submission,and upload a file with your program.The grading system then compiles your program(detecting the programming language based on your file extension,see Subsection8.4) and runs it on a set of carefully constructed tests to check that your program always outputs a correct result and that it always fits into the given time and memory limits.The grading usually takes no more than a minute,but in rare cases when the servers are overloaded it might take longer.Please be patient.You can safely leave the page when your solution is uploaded.As a result,you get a feedback message from the grading system.The feedback message that you will love to see is:Good job!This means that your program has passed all the tests.On the other hand, the three messages Wrong answer,Time limit exceeded,Memory limit exceeded notify you that your program failed due to one these three reasons.Note that the grader will not show you the actual test you program have failed on(though it does show you the test if your program have failed on one of the first few tests;this is done to help you to get the input/output format right).8.7Debugging and Stress Testing Your ProgramIf your program failed,you will need to debug it.Most probably,you didn’t follow some of our suggestions from the section8.5.See the readings and screencasts from the first week to learn about debugging your program:link.You are almost guaranteed to find a bug in your program using stress testing,because the way these programming assignments and tests for them are prepared follows the same process:small manual tests, tests for edge cases,tests for large numbers and integer overflow,big tests for time limit and memory limit checking,random test generation.Also,implementation of wrong solutions which we expect to see and stress testing against them to add tests specifically against those wrong solutions.Go ahead,and we hope you pass the assignment soon!20。

数学必修一第一章知识点总结

数学必修一第一章知识点总结

数学必修一第一章知识点总结Studying the first chapter of Mathematics for compulsory education is crucial for building a strong foundation in this subject. 通过学习数学必修一的第一章,我们可以掌握一些基础的数学知识,为以后更深入地学习奠定基础。

Firstly, this chapter covers the topic of sets, which are fundamental to various mathematical concepts. 首先,这一章涵盖了集合的主题,集合是各种数学概念的基础。

Understanding sets allows us to categorize and organize data in a systematic way, which is essential for problem-solving in mathematics. 理解集合使我们能够以系统的方式对数据进行分类和组织,这对数学问题的解决至关重要。

Furthermore, learning about sets helps us develop critical thinking skills as we analyze relationships between different elements and apply logical reasoning to solve problems. 此外,学习集合让我们能够培养批判性思维技能,因为我们分析不同元素之间的关系并应用逻辑推理来解决问题。

In addition to sets, this chapter also introduces the concept of subsets, which are sets that are contained within another set. 除了集合外,这一章还介绍了子集的概念,子集是包含在另一个集合中的集合。

北师大版高中数学必修1第1章4.2一元二次不等式及其解法课件PPT

北师大版高中数学必修1第1章4.2一元二次不等式及其解法课件PPT
由不等式x 2 10 x 2400 0,解得 5 5 97 x 5 5 97
解得乙车的速度大于40km / h,所以乙车违章了.
课堂练习
当 x 是什么实数时,函数 y x 4 x 1 的值
2
1 等于0 ? 2 是正数?3 是负数?
解(1)函数值等于0,即x 2 4 x 1 0,解得:x1 2 3 , x2 2 3
0 0)之间有怎样的关系?
一元二次方程的根即是二次函数图像与 x 轴的交点的横坐标.
一元二次不等式解的情况可通过其二次函数图像与 x 轴相交的情况来确定.
问题:
1.本节课学习了哪些主要内容?
2.本节课学到了哪些关于一元二次不等式求解的方法?
3. 运用一元二次不等式求解方法还可以解决生活中的
哪些问题?
3
2
画出一元二次函数y 9 x 6 x 1的图像,
y
y 9x2 6x 1
可知该函数的图象是开口向上的抛物线,
1
且与x轴仅有一个交点( , 0),
3
1
观察图像可得原不等式的解集为 {x | x }.
3
O
1
3
x
例题探究
例3 求不等式3x 2 5x 2 0的解集.
2
2
由不等式x 2 10 x 1200 0,解得x 40或x 30
由不等式x 2 10 x 1500 0,解得 5 5 61 x 5 5 61
解得甲车的速度不大于40km / h,所以甲车没有违章.
解决问题
请你根据所学内容解出本节开头的两个不等式:
一元二次不
等式.
使一元二次不等式成立的所有未知数的值组成的集合

高中数学第一章不等关系与基本不等式1.2.2绝对值不等式的解法活页作业3北师大版选修4-5(202

高中数学第一章不等关系与基本不等式1.2.2绝对值不等式的解法活页作业3北师大版选修4-5(202

2018年高中数学第一章不等关系与基本不等式1.2.2 绝对值不等式的解法活页作业3 北师大版选修4-5编辑整理:尊敬的读者朋友们:这里是精品文档编辑中心,本文档内容是由我和我的同事精心编辑整理后发布的,发布之前我们对文中内容进行仔细校对,但是难免会有疏漏的地方,但是任然希望(2018年高中数学第一章不等关系与基本不等式1.2.2 绝对值不等式的解法活页作业3 北师大版选修4-5)的内容能够给您的工作和学习带来便利。

同时也真诚的希望收到您的建议和反馈,这将是我们进步的源泉,前进的动力。

本文可编辑可修改,如果觉得对您有帮助请收藏以便随时查阅,最后祝您生活愉快业绩进步,以下为2018年高中数学第一章不等关系与基本不等式1.2.2 绝对值不等式的解法活页作业3 北师大版选修4-5的全部内容。

活页作业(三)绝对值不等式的解法一、选择题1.如果错误!<2和|x|>错误!同时成立,那么实数x的取值范围是( ) A.错误!B.错误!C.错误!D.错误!解析:解不等式错误!<2,得x<0或x>错误!。

解不等式|x|>错误!,得x>错误!或x<-错误!。

∴实数x的取值范围为错误!.答案:B2.不等式2<|2x+3|≤4的解集为( )A.错误!B.错误!C.错误!D.错误!解析:由2<|2x+3|≤4,可得2<2x+3≤4或-4≤2x+3<-2.解得-12<x≤错误!或-错误!≤x<-错误!。

答案:C3.关于x的不等式错误!>a的解集为集合M,且2∉M,则实数a的取值范围为( )A.错误!B.错误!C.错误!D.错误!解析:因为2∉M,所以2∈∁R M.所以错误!≤a,即-a≤错误!≤a。

解得a≥错误!。

答案:B4.不等式|3-x|+|x+4|>8的解集是()A.错误!B.错误!C.错误!D.R解析:|3-x|+|x+4|>8⇔错误!或错误!或错误!⇔错误!或错误!或错误!∴x<-92或x>错误!.∴原不等式的解集为错误!.答案:C二、填空题5.若关于x的不等式|ax-2|<3的解集为错误!,则a=________。

第一章 - 第12课微积分基本定理

第一章 - 第12课微积分基本定理
从而奠定了微积分普遍算法的基础.
数学*选修2-2 *R
从 1684 年起,莱布尼茨发表了很多微积分论文.他的第一篇微分
学文章《一种求极大值极小值和切线的新方法》是世界上最早公开发
表的关于微分学的文献.在这篇论文中,他简明地解释了他的微分学, 文中给出了微分的定义和基本的微分法则.
预学 1:定积分与导数之间的联系
������
奇函数求解,结合定积分的几何意义可知所求定积分的值为 0.
【针对训练 1】计算下列定积分.
(1)
2 1
1dx;(2)
������
1 0
x3dx;(3)
1 -1
exdx.
数学*选修2-2 *R
【解析】(1)∵(ln x)'=1,
������

2 1
1dx=ln
������
x
21=ln
2-ln
一个做变速直线运动的物体的运动规律 s=s(t).由导数的概念 可以知道,它在任意时刻 t 的速度 v(t)=s'(t).设这个物体在时间段 (a,b)内的位移为 s.
想一想:你能分别用 s(t),v(t)来表示 s 吗?从中你能发现导数
和定积分的内在联系吗?(指定小组回答,其他组补充)
数学*选修2-2 *R
数学*选修2-2 *R
数学*选修2-2 *R
【变式设问】在例
3
的条件下,求
3 -3
f(|x|)dx
的值.
提示:
3 -3
f(|x|)dx=2
3 0
f(x)dx=-5+8 2+ 8 .
6 3 ln 2
sin������,0 ≤ ������ < π ,

第一章牛顿问题

第一章牛顿问题

第一章牛顿问题解题关键:牛顿问题,俗称“牛吃草问题”,牛每天吃草,草每天在不断均匀生长。

解题环节主要有四步:1、求出每天长草量;2、求出牧场原有草量;3、求出每天实际消耗原有草量( 牛吃的草量-- 生长的草量= 消耗原有草量);4、最后求出可吃天数。

1、牧场上有一片青草,牛每天吃草,草每天以均匀的速度生长。

这片青草供给10头牛可以吃20天,供给15头牛吃,可以吃10天。

供给25头牛吃,可以吃多少天?分析:==============================如果草的总量一定,那么,牛的头数与吃草的天数的积应该相等。

现在够10头牛吃20天,够15头牛吃10天,10×20和15×10两个积不相等,这是因为10头牛吃的时间长,长出的草多,所以,用这两个积的差,除以吃草的天数差,可求出每天的长草量。

①、求每天的长草量( 10×20-15×10 )÷( 20-10 )=5 ( 单位量)说明牧场每天长出的草够5头牛吃一天的草量。

②、求牧场原有草量因为牧场每天长出的草量够5头牛吃一天,那么,10头牛去吃,每天只有10-5=5 ( 头)牛吃原有草量,20天吃完,原有草量应是:( 10-5 )×20=100 ( 单位量)或:10头牛吃20天,一共吃草量是10×20=200 ( 单位量)一共吃的草量- 20天共生长的草量=原有草量200 -100 =100(单位量)③、求25头牛吃每天实际消耗原有草量因为牧场每天长出的草量够5头牛吃一天,25头牛去吃,(吃的-长的=消耗原草量)即:25 -5=20 ( 单位量)④、25头牛去吃,可吃天数牧场原有草量÷ 25头牛每天实际消耗原有草量=可吃天数100 ÷ 20 =5 ( 天)解:( 10×20-15×10 )÷( 20-10 )=50÷10=5 (单位量) ------- 每天长草量( 10-5 )×20=5×20=100 ( 单位量) ------- 原有草量100÷ ( 25-5 )=100÷20=5 (天)答:可供给25头牛吃5 天。

2020年高中数学第一章集合1.2.1集合之间的关系课件新人教B版必修1

2020年高中数学第一章集合1.2.1集合之间的关系课件新人教B版必修1

D.N M
解析:M={x|x=90°·k+45°,k∈Z} ={…,-45°,45°,135°,225°,…}, N={x|x=180°·k±45°,k∈Z} ={…,-45°,45°,135°,225°,…}, ∴M=N.
答案:A
类型 2 由集合间的关系求参数范围
(1)已知集合 A={x|x2-4=0},集合 B={x|ax-2= 0},若 B⊆A,求实数 a 的取值集合;
【解析】 (1)N={x∈R|x2-x=0}={0,1},则 N M.故选
B. (2)A 中 M=∅,N={0},M≠N;B 中 M 与 N 分别表示 y=
x2+1,x=y2+1 上的点集,M≠N;C 中 M={y|y=x2+2,x∈ R}={y|y≥2},N={y|y=(x-1)2+2,x∈R}={y|y≥2},M=N; D 中 N⊆M.故选 C.
(3)此类问题还应注意“空集”这一“陷阱”,尤其是集合 中含有字母参数时,初学者会想当然认为是非空集合而丢解, 因此分类讨论思想是必须的.
=________.
集合{1,a+b,a}=0,ba,b,则 a-b
解析:∵由题可知 a≠0,b≠0,
a+b=0,
∴ba= +1b, =0
或b=a, ba=1,
知识点一 子集的概念
1.若集合 A={x|x>-3},则( )
A.0⊆A
B.{0}∈A
C.∅∈A
D.{0}⊆A
答案:D
知识点二 集合间的关系
2.已知集合 A={x|2x-3<3x},B={x|x≥2},则集合 A 与 集合 B 的关系为( )
A.A B
B.B A
C.A=B
D.不确定
解析:A={x|2x-3<3x}={x|x>-3},B={x|x≥2},
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Chapter 1 Recurrent Problems
1.1 The Tower of Hanoi Let‟s look first at a neat little puzzle called the Tower of Hanoi. We are given a tower of eight disks, initially stacked in decreasing size on one of three pegs:
Preface
• 具体数学(Concrete Mathematics),从字面上它和传统 的“抽象数学”对立。名字其实是连续(CONtinuous)和离 散(disCRETE)的融合。不过名字不重要,内容主要是说在 计算机科学领域内遇到的问题和传统数学常常不太合拍, 传统数学的方法和理念往往不容易用来解决计算机问题。 具体数学主要致力如何解决计算机科学中的问题,为计算 机算法奠定一个数学基础,或者说给出一些可用的数学手 段/方法。具体数学最早是上个世纪70年代,由Donald E. Knuth在斯坦福开设的一门课,这本书可以说是这门课的 讲义之延伸。 书写的很有意思,第一章讲recurrence,用了几个经 典问题,写的还是挺吸引人的。最后那个约瑟夫环问题, 我看了后,的确是佩服的很。一般来说这个问题的程序的 写法是模拟求解,复杂度是O(n*n),我自己推导过一个递 推的方法,可以把复杂度降到O(n),而这本书里直接给出 了这个问题的解公式,强悍。
Chapter 1 Recurrent Problems
• The recurrence only gives indirect, local information. • A solution to the recurrence would make us much happier. With a closed form, we can understand what Tn really is. • So how do we solve a recurrence? 1. One way is to guess the correct solution, then to prove that our guess is correct.
Chapter 1 Recurrent Problems
2. Mathematical induction is a general way to prove that some statement about the integer n is true for all n≥n0. First we prove the statement when n has its smallest value, n0; this is called the basis. Then we prove the statement for n> n0, assuming that it has already been proved for all values between n0 and n-1, inclusive; this is called the induction.
Chapter 1 Recurrent Problems
• Next, we introduce appropriate notation: NAME and CONQUER
Chapter 1 Recurrent Problems
• Let Tn be the minimum number of moves that will transfer n disks from one peg to another under Lucar‟s rules. Obviously, T0 =0 ,T1 =1, T2 =3. • How can we transfer a large tower? Experiments with three disks show that the winning idea is to transfer top two disks to the middle peg, then transfer the third, then bring the other two onto it.
Chapter 1 Recurrent Problems
• This gives us a clue for transferring n disks in general: We first transfer the n-1 smallest to a different peg(requiring Tn-1 moves), then move the largest(requiring one move), and finally transfer the n-1 smallest back onto the largest (requiring Tn1 moves). Thus we can transfer n disks(n>0) in at most 2Tn-1+1 moves:
Preface
• It is an indispensable text and reference not only for computer scientists--the authors themselves rely heavily on it! but for serious users of mathematics in virtually every discipline.
Preface
• Several new topics have been added, and the most significant ideas have been traced to their historical roots. • The book includes more than 500 exercises, divided into six categories. Complete answers are provided for all exercises, except research problems, making the book particularly valuable for self-study.
Chapter 1 Recurrent Problems
• Let‟s consider what happens if there are n disks. • It‟s advantageous to look at Small Case first. It‟s easy to see how to transfer a tower that contains only one or two disks. And a small amount of experimentation show how to transfer a tower of three.
具体数学 ——计算机科学基础
Concrete Mathematics
A Foundation For Computer Science
Preface
• This book introduces the mathematics that supports advanced computer Programming and the analysis of algorithms. • The primary aim of its well-known authors is to provide a solid and relevant base of mathematical skills-the skills needed to solve complex problems, to evaluate horrendous sums, and to discover subtle Patterns in data.
Tn 2Tn 1 1,
for n 0.
Chapter 1 Recurrent Problems
• We show that 2Tn-1+1 moves are necessary. Is there a better way? Actually no. At some point we must move the largest disk. When we do, the n-1 smallest must be on a single peg, and it has taken at least Tn-1 moves to put them there. We might move the largest disk more than once, if we‟re not too alert. But after moving the largest disk for the last time, we must transfer the n-1 smallest disks back onto the largest; this too requires Tn-1 moves. Hence Tn 2Tn 1 1, for n 0.
• The subject mater is primarily an expansion of the Mathematical Preliminaries section in Knuth's classic Art of Computer Programming, but the style of presentation is more leisurely, and individual topics are covered more deeply.
Chapter 1 Recurrent Problems
• It‟s not immediately obvious that the puzzle has a solution, but a little thought convinces us that it does. • Question : What‟s the best we can do? That is, how many moves are necessary and sufficient to perform the task? • The best way to tackle a question like this is to generalize it a bithematics is a blending of CONtinuous and disCRETE mathematics. • "More concretely," the authors explain, "it
相关文档
最新文档