lecture9-06

合集下载

lecture_06_受控电源及分压分流电路

lecture_06_受控电源及分压分流电路

Lecture06 受控电源及分压分流电路

+
US _
求电流i1 R1 R3
R1 +
i1
R2
ri1
+
US _
i1
ri1/R3
R2//R3
_
R2 R3 R R1 R2 R3
+
US _ 注:
i1
R
+
(R2//R3)ri1/R3 _
Ri1 ( R2 // R3 )ri1 / R3 U S
图1-6-3
广东海洋大学 信息学院 徐国保
Lecture06 受控电源及分压分流电路
广东海洋大学
信息学院
徐国保
Lecture06 受控电源及分压分流电路
例1.6.2.含CCCS电路如图,求Us并计算受控源功率
I1 6Ω + US – + I2 Vf + 0.98I1 – 5Ω 4.9V 0.1 – Ω
Lecture06 受控电源及分压分流电路
lecture_06 受控电源及分压分流电路

内 容 提 纲
1受控电源
(cha.1-7,cha.1-8)
重点难点 含受控电源的电阻电 路分析 分压分流电路的分析
2分压电路
3分流电路
Next: cha.1-10,cha.2-1
作业:1-23,1-28
广东海洋大学 信息学院 徐国保
US i1 R ( R2 // R3 )r / R3
广东海洋大学
受控源和独立源一样可以进行电 源转换;转换过程中注意不要丢 失控制量。
信息学院 徐国保
Lecture06 受控电源及分压分流电路

托福听力tpo69全套对话讲座原文+题目+答案+译文

托福听力tpo69全套对话讲座原文+题目+答案+译文

托福听力tpo69全套对话讲座原文+题目+答案+译文Section1 (2)Conversation1 (2)原文 (2)题目 (5)答案 (7)译文 (7)Lecture1 (10)原文 (10)题目 (14)答案 (16)译文 (17)Section2 (19)Conversation2 (20)原文 (20)题目 (23)答案 (26)译文 (26)Lecture2 (29)原文 (29)题目 (32)答案 (36)译文 (36)Lecture3 (39)原文 (39)题目 (42)答案 (46)译文 (46)Section1Conversation1原文Student:Hi I'm Robert West,we had an appointment.University administrator:You hear about your graduation form right?I'm about to print it out.Student:Oh good,thanks,I was kind of wondering what it is all about,I mean,I’ve completed more than enough courses work to graduate.University administrator:All this is strictly routine,of course you have to finish your course work.But this form is just the administrative checklist.It's our way of making sure you don't have any unfinished university business,like unpaid tuition bills or lab fees that’s sort of thing.Student:Well,I do have an outstanding student loan,but I was told that I don't have to start paying that off yet,not until I get a job,I do have a job interview tomorrow.University administrator:well,good luck with it,but not yourloan,it's not an issue here.Let’s see,the only problem I see is um,what’s this fine for…uh,an overdue CD that you borrow from the music library.Student:Really?I…I checked it out,like three months ago,but wasn’t really for me.University administrator:Oh,you checked it out for a friend?Student:No,for a faculty member actually.We need that music for a play we produced.Uh,professor Williams was our director and I was in the show.Anyway,he’d asked me to borrow the recording from the library.University administrator:Okay,but that still doesn't explain why you didn't return it.Student:Well,he ended up with it.He says he’d return it.And I just assumed that was that.Because I never heard anything from the library.University administrator:That’s all,you used it and you know this.Student:Yeah,Oh,but I did recently move to a new apartment, maybe they did send something.University administrator:Okay,well this should’ve been done in a time in manner.But as they say better late than never,if you return the CD now,you get away with just a late time, which is a lot less than the fee to replace it.Student:Yeah,but it's totally not my fault,so now I have to track down the CD to avoid having to pay this replacement fee.University administrator:Well,yes.I mean it sounds like there was some kind of a mix-up,but the burden is still on you to settle your library account.You know it,it might be that their records are wrong,so first I suggest you go there make sure and then you might have to go talk to professor Williams.Student:Oh,I guess I have no choice.University administrator:Don't worry too much,these things always get sorted out.Student:Yeah,you’re right.It's no big thing,I should be more worried about my job,interview,then about this.University administrator:And when it’s all worked out,come back here for your paper work.题目.Why does the student go to see the woman?A.To make sure he has completed enough course work to graduateB.To find out when his student loan must be paid backC.To pick up an administrative formD.To complain about a library fine2.What is the student's problem?A.He forgot to return some library books.B.He cannot start paying off his student loan yet.C.He paid his graduation fee too late.D.He owes money to the music library.3.Who is Professor Williams?A.The head of the libraryB.The director of a play the student was inC.The student's music professorD.The person who arranged a job interview for the student4.What is the most likely reason the student did not receive the notice from the library?A.He recently moved.B.He has been out of town.C.The library just mailed it the day before.D.The library sent it to Professor Williams.5.What can be inferred about the student when he says this:University administrator:Well,yes.I mean it sounds like there was some kind of a mix-up,but the burden is still on you tosettle your library account.You know it,it might be that their records are wrong,so first I suggest you go there make sure and then you might have to go talk to professor Williams.Student:Oh,I guess I have no choice.A.He is not sure how to respond to the woman.B.He feels he has been treated unfairly.C.He wonders if there is another solution.D.He does not think the woman's suggestions will work.答案C D B A B译文1.学生:嗨!我是Robert West,我们之前有约。

lecture 06 consumer theory

lecture 06 consumer theory
• Points A and B should make the consumer equally happy. • Points B and C should make the consumer equally happy. • This implies that A and C would make the consumer equally happy. • But C has more of both goods compared to A.
Figure 2 The Consumer’s Preferences
Quantity of Pepsi
Indifference curve, I1 0 Quantity of Pizza
Four Properties of Indifference Curves • Property 3: Indifference curves do not cross.
Figure 2 The Consumer’s Preferences
Quantity of Pepsi C
B
D I2 A Indifference curve, I1 Quantity of Pizza
0
Representing Preferences with Indifference Curves • The Consumer’s Preferences
250
C Consumer’s budget constraint
A 0 50 100 Quantity of Pizza
THE BUDGET CONSTRAINT: WHAT THE CONSUMER CAN AFFORD
• The slope of the budget constraint line equals the relative price of the two goods, that is, the price of one good compared to the price of the other. • It measures the rate at which the consumer can trade one good for the other.

每天50道翻译过高考高频单词06-高考英语二轮复习

每天50道翻译过高考高频单词06-高考英语二轮复习

每天50道翻译过高考高频单词061.非常高兴得知周五在我们学校的演讲厅将举行一个欢迎晚会,我想邀请您参加。

2.按照安排,晚会的时间是下午五点半到八点半,内容很丰富。

3.我谨代表学生会给您写信,对您慷慨捐赠的这么多英文原版图书表示最深切的感谢。

4.我是学生会主席李华,写信旨在邀请你们参加我们的校园脱口秀节目。

5.很开心了解到你对中国戏剧感兴趣,我写信的目的是邀请你参加一次传统的戏剧表演。

6.担心你在新学校很难交朋友,我写信是为了向你表达我的关心和安慰,希望你能尽快适应新环境。

7.为提高学生的自我保护意识,一场有关保护学生安全的基本知识的讲座将在我校举行。

8.微信让我们可以在任何地方进行交流。

9.人们普遍认为,互联网在我们的生活中扮演着不可或缺的角色。

10.正是这个北京著名的旅游景点吸引了大量来自世界各地的游客。

(强调句型)11.让我印象最深刻的是那些有天赋的学生画家令人惊叹的作品。

(what引导的主语从句)12.毫无疑问的是/不可否认的是,去北京的旅行是值得且有益的。

13.许多学生参加了这项赛跑比赛,他们从身体和精神上受益。

14.常言道,“自助者天助。

”15.你不仅可以体验到中国的文化,还可以加深你对中国画的理解。

(not only...but also)16.展览上展出了这么多精彩的作品,你一定会更了解中国画。

17.一想到自己一个人在森林里,她就感到一阵强烈的恐惧感。

(被动语态)18. 一看到那只狼,他感到一阵强烈的恐惧感。

(被动语态)19.她感到如此懊悔,以至于脸如充血般发烫。

(倒装句型)20.既害怕又震惊,她一句话也说不出来,热泪盈眶。

(形容词短语作状语,with 复合结构)21.感到坚定和受到鼓舞,David抬起头,感激地看着我。

(形容词短语作状语)22.当我冲向终点线时,我的队友们都兴奋地尖叫起来。

(各种“说”with 情绪类名词)23.梅格高兴得叫了起来,完全忘记了她的恐惧。

(各种“说”with 情绪类名词)24.我一动不动地站着,试图编造一个合理的借口。

新概念英语第三册课后答案

新概念英语第三册课后答案

新概念英语第三册课后答案【篇一:新概念3课后答案详解】>lesson 01 a puma at large 逃遁的美洲狮5? 答案正确: da)把say改成claim就对了(-- people claimed to havespecial difficulties 难点exercises a1. at/for2. to3. to4. in5. onexercises b1. he is the man we have heard about so much.3.whom did you receive a letter from 特殊疑问句中whom 不能省略(本句)。

定语从句中which以及指代人的做宾语的whom, 在非正式用法当中可以省略。

省略时,介词不能前置到关系代词whom, which前,只能用于非固定的动词短语后面。

固定的动词短语look for:寻找(去掉for后look没有寻找的意思,所以介词for 不能前置)非固定的动词短语look at:注视live in:居住(去掉in后live仍有居住的意思,所以介词in可以前置)this is the old house in which he lived. = this is the old house he lived in.4.this is the road we came by5.where is the pencil you were playing with multiple choice questions 多项选择1? 正确答案:din common adv.共有(替换了similar)2? 正确答案:ba)只是一个具体的特定的事列,阅读理解题的时候要把握中心大意b) large catpersuade v.说服, 劝说3? 答案正确:c做理解题时要紧扣主题、紧扣中心大意文章最后一句话总结了大意句型结构题和词汇题是每课的关键4? 答案正确:c make的用法: make somebody do(在主动语态中不定式的符号to应该省略) be made to do(被动语态中不定式的符号to必须补充完整)1special difficulties 难点in1与表达惊奇、恐惧、失望或生气等感情色彩的名词搭lesson 02 thirteen equals one 十三等于一seen the puma.)d)清楚的道明了动作发生的先后关系6? 正确答案:b原句中的 when引导的时间状语从句表示:-...就?(as soon as)被动:on being observed, it immediately ran away.主动:on observing her, it immediately ran away.on seeing me, he waved to me.7? 正确答案:dexcept可以和名词/名词性从句进行搭配(也可是when/if引导的从句形式)unless = if...not = except on the condition that?when = if-- ?except when they are cornered. = ?except if they are cornered.-- whenever you come, you are welcome. = if ever you come, you are welcome.8? 正确答案:da)must be只是对客观现实的推测,时态不一致-- 对于过去事实推测一定要用:情态动词+ have +过去分词9? 正确答案:con more than = nothing more than = only / within = not more than10? 正确答案:bin a corner 偷偷摸摸地, 暗中地, 秘密地in a trap 落于陷阱中at an angle 不正的, 倾斜的(angle n.角, 角度, 角落, 墙角, 棱角) under cover 在遮蔽处, 秘密地, 暗中11... 正确答案:bfishes for pleasure 钓鱼消遣travel for pleasure 外出游玩read for pleasure 阅读消遣12?on one’s own adv.独自地, 独立地, 主动地(= alone)for one’s own benefit 为了某人自己的利益。

新概念英语第三册课后答案详解

新概念英语第三册课后答案详解

新概念英语第三册课后答案详解Lesson 01 A Puma at large 逃遁的美洲狮Special difficulties 难点Exercises A1. at/for2. to3. to4. in5. onExercises B1. He is the man we have heard about so much.2. The shelf you put those books on has collapsed.(vi.倒塌, 崩溃, 瓦解)3.Whom did you receive a letter from特殊疑问句中whom 不能省略(本句)。

定语从句中Which以及指代人的做宾语的Whom, 在非正式用法当中可以省略。

省略时,介词不能前置到关系代词Whom, Which前,只能用于非固定的动词短语后面。

固定的动词短语look for:寻找(去掉for后look没有寻找的意思,所以介词for 不能前置)非固定的动词短语look at:注视live in:居住(去掉in后live仍有居住的意思,所以介词in可以前置)This is the old house in which he lived. = This is the old house he lived in.4.This is the road we came by5.Where is the pencil you were playing withMultiple choice questions 多项选择1…正确答案:Din common adv.共有(替换了similar)2…正确答案:BA)只是一个具体的特定的事列,阅读理解题的时候要把握中心大意B)large catpersuade v.说服, 劝说3…答案正确:C做理解题时要紧扣主题、紧扣中心大意文章最后一句话总结了大意句型结构题和词汇题是每课的关键4…答案正确:CMake的用法:make somebody do(在主动语态中不定式的符号to应该省略)be made to do(被动语态中不定式的符号to必须补充完整)-- They made he r wait for hours. àShe was made to wait for hours.5…答案正确: DA)把say改成claim就对了(-- People claimed to have seen the puma.)D)清楚的道明了动作发生的先后关系6…正确答案:B原句中的when引导的时间状语从句表示:-...就…(as soon as)被动:On being observed, it immediately ran away.主动:On observing her, it immediately ran away.On seeing me, he waved to me.7…正确答案:Dexcept可以和名词/名词性从句进行搭配(也可是when/if 引导的从句形式)unless = if...not = except on the condition that…when = if-- …except when they are cornered. = …except if they are cornered.-- Whenever you come, you are welcome. = If ever you come, you are welcome.8…正确答案:DA)must be只是对客观现实的推测,时态不一致-- 对于过去事实推测一定要用:情态动词+ have +过去分词9…正确答案:Con more than = nothing more than = only / within = not more than10…正确答案:Bin a corner 偷偷摸摸地, 暗中地, 秘密地in a trap 落于陷阱中at an angle 不正的, 倾斜的(angle n.角, 角度, 角落, 墙角, 棱角)under cover 在遮蔽处, 秘密地, 暗中11... 正确答案:Bfishes for pleasure 钓鱼消遣travel for pleasure 外出游玩read for pleasure 阅读消遣12…on one’s own adv.独自地, 独立地, 主动地(= alone)for one’s own benefit 为了某人自己的利益。

UE_Blueprints_Lecture06

UE_Blueprints_Lecture06
右下图显示了可以从列举变量中选择的值。
列举: 开启(SWITCH ON)
有一类开关节点根据列举值来确定执行流。 在右图中,“武器类型”(Weapon Type)是一个列举 变量,“武器网格体”(Weapon Mesh)是一个静态 网格体组件。 该静态网格体将根据武器类型进行设置。
数据表
数据表可以用于表示电子表格文件。这对于数据驱动型 Gameplay十分有用。
编译蓝图。
在“物品栏”(Inventory)变量的“细节”(Details) 面板的“默认值”(Default Value)部分中,可以向数 组添加新元素。每个元素都将包含Item Struct结构体中 定义的变量。
结构体: 分解(BREAK)和创造 (MAKE)节点
当某个结构体被引用时,分解(Break)和创造(Make) 节点将在蓝图中变为可用。 分解节点以结构体为输入,并将它的元素分隔开来。 创造节点以独立的元素为输入,并创建新的结构体。 右图显示了Item Struct结构体的分解和创造节点。
该数据表包含三行,每一行表示一个RPG类。
数据表: 操作
可以创建一个变量以在蓝图中表示数据表。
结构体
结构体(struct)可以用来将多个相关变量汇总在一个位 置。属于结构体的变量可以有不同的类型。结构体还可 以包含其他结构体和数组。
要创建新结构体,单击内容浏览器中的绿色“新增” (Add New)按钮,然后在“蓝图”(Blueprints)子 菜单中选择“结构体”(Structure)。将它重命名为 “项目结构体”(Item Struct)。
数组是一个有序列表,您通过使用基于整数的索引来设 置和获取数组元素。 通过使用数组,可以将同一类型的变量分组在一起。在 蓝图中创建数组十分简单。 首先,创建新变量,并选择所需类型。 单击“变量类型”(Variable Type)下拉菜单旁边的图 标,并选择“数组”(Array)(见右上图)。 编译蓝图后,可以在数组元素中填充默认值,如右下图 所示。

Lecture06

Lecture06

Introduction
Fuzzy systems are one of several possibilities in the area of nonlinear system identification Other universal approximators in nonlinear system identification
l 1
ˆ (t ) Y T W (t ) y
ˆ y (t ) y (t ) e (t ) Y T W (t ) e (t )
where e(t) is the prediction error that is assumed to have zero mean and variance σ2.
Neural networks Wavelets Fourier series Volterra kernels …
Introduction
The advantages of the use of fuzzy systems is their capacity:
to interact and to extract linguistic information from input–output data to describe the dynamics of the system in local regions described by the rules.
Introduction
The capacity to handle linguistic information adds an extra dimension to the identification and modeling.
The validation process will be based not only on quantitative criteria (定量标准) but also on qualitative criteria (定性标准)
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

概率算法随机数概念伪随机数生成算法几种主要的概率算法Sherwood算法Las Vegas算法Monte Carlo算法1伪随机数随机数与伪随机数概率算法中要进行随机选择,需要大量随机数.通常根据某种规则生成随机数,这些随机数不是真正随机的,但在一定程度上可以模拟随机数,一般叫做伪随机数随机变量X的取值范围是(0,1)且对任意的0<a<1,P{0<X≤a}=a, 则称X服从(0,1)上的均匀分布23伪随机数生成算法---线性同余法生成伪随机序列为{ a i }, i = 0,1,…, n ,…,0<a i <m⎩⎨⎧=+==−,...2,1mod )(10n m c ba a d a n n 模数:m , 机器最大数.乘数:b , 2≤b <m ,计算前给定常数:c , 0≤c <m ,计算前给定种子:d , 0≤d <m, 计算时随机给出伪随机数生成算法4乘同余法⎩⎨⎧===−,...2,1mod 10n m ba a d a n n 参数:c = 0,d ≠0,m =231−1, b =75实例:d =116,807, 282,475,249, 1,622,650,073, 984,943,658, 1,144,108,930, 470,211,272, 101,027,544, 1,457,850,878……确定型算法与随机算法1.特点:确定型算法: 对某个特定输入的每次运行过程是可重复的,运行结果是一样的.随机算法:对某个特定输入的每次运行过程是随机的,运行结果也可能是随机的.2. 随机算法的优势:在运行时间或者空间需求上随机算法比确定型算法往往有较好的改进随机算法设计简单6随机算法复杂性度量随机算法A 对于规模为n 的某个给定的实例I 的一次执行的时间与另一次可能不一样.随机算法A 对于某个规模为n 的实例I 的运行时间的期望:算法A 反复求解实例I 的平均时间.一般情况下,许多随机算法对于规模为n 的不同的实例,运行时间期望都一样,因此这个期望时间代表随机算法的平均预期时间.79确定型排序算法Quicksort 最坏情况下时间为O (n 2)平均情况下为O (n log n )确定型排序+选择算法如果选用中位数进行划分, 时间为O(n log n )随机快速排序算法预期时间O (n log n )最坏情况概率非常小,在实际应用中可以忽略算法比较时间期望值估计假设随机选择时,1..n中每个数被选的概率相 等,并且假设第k个数总是出现在划分后两个数组 中较大的数组(最坏情况的上界).那么,随机选 择算法的时间期望为 1 n T ( n) ≤ (T ( n − 1) + T ( n − 2) + ...T ( + 1) n 2 n n + T ( ) + T ( + 1) + ... + T ( n − 1)) + O( n) 2 2 2 n −1 ≤ ∑ T ( i ) + O ( n) n i =n / 2 注意n为奇数,上式没有T(n/2)项11时间的期望(续)2 n −1 T ( n) ≤ T ( i ) + tn n i=n/ 2∑设T ( k ) ≤ ck对一切 k < n为真 , 则 2 n n T ( n) ≤ [c + c( + 1) + ... + c ( n − 1)] + tn 2 n 2 n n ( + n − 1) 2c 2 2 + tn = n 2 c 3n 3cn c = ( − 1) + tn = − + tn 2 2 4 2 3cn 3 t ≤ + tn = ( + )cn ≤ cn 取c ≥ 4t 即可 4 4 c12算法比较拟中位数选择算法 最坏情况 O(n) 平均情况 O(n) 随机算法 平均时间 O(n) 最坏情况 O(n2) 每次恰好选到边界元素 与实例无关,只与选择有关 概率很小,可以忽略 预期时间 O(n)13预期复杂度分析设A为求解问题π的确定型算法,B为对应的Sherwood 算法,对于输入x的计算时间分别记为tA(x), tB(x). 令 Xn={ x | x为π的实例, |x|=n } 输入等概率分布情况下,A的平均时间复杂度 1 t A ( n) = ∑ t A ( x) | X n | x∈ X n B在实例x的预期时间t B ( x ) = t A ( n) + s( n)B 的平均复杂性1 t B ( n) = t B ( x ) = t A ( n) + s( n) | X n | x∈ X n∑14Sherwood算法总结算法能得到正确的解 算法比确定型算法简单 算法的平均性能与确定型算法一样 算法改善了最坏情况的预期复杂性 运行时间基本与输入实例无关 确定算法最坏情况在随机选择出现的概率接近0 实现途径 通过改进确定型算法得到 将确定型选择原则改为随机选择 在确定型算法前增加随机洗牌步骤15随机洗牌算法算法 RandomShuffle(A,n) 1. for i←1 to n-1 do 2. 3. j←Random(i+1,n) A[i]↔A[j]例如数组A: n=12 A i=1, j=4: i=2, j=9: i=3, j=8: 2, 3, 1, 8, 6, 9, 11, 4, 5, 12, 10, 7 8, 3, 1, 2, 6, 9, 11, 4, 5, 12, 10, 7 8, 5, 1, 2, 6, 9, 11, 4, 3, 12, 10, 7 8, 5, 4, 2, 6, 9, 11, 1, 3, 12, 10, 716Las Vegas 算法例3 n后问题算法BoolQueen(n) 1. k←1 // k放皇后的行号 2. count←0 // count放好的皇后数 3. while k≤n do 4. for i←1 to n do // i为待选列号 5. 检查 i 与前面 k-1个皇后的相容性 6. 如果相容则将 i 加入S 7. if S≠∅ then 8. j←Random(1,|S|) 9. xk←S[j] 10. count←count+1 11. k←k+1 12. else k←n+1 13. return count17n后问题的LV算法算法QueenLV(n) //重复调用随机算法BoolQueen 1. p←BoolQueen(n) 2. while p<n do 3. p←BoolQueen(n)改进算法---与回朔相结合 设 stopVegas ≤ n, 表示用QueenLV算法放置的皇后数 剩下 n-stopVegas 个皇后用回朔方法放置 stopVegas = 0 时是完全的回朔算法 stopVegas = n 时是完全的Las Vegas算法18改进的LV算法比较对于不同的 stopVegas 值,设 p 为算法成功概率 s 为一次成功搜索访问的结点数的平均值 e 为一次不成功搜索访问的结点数的平均值 t 为算法找到一个解的平均时间1− p t = ps + (1 − p )(e + t ) ⇒ t = s + e 则 p n=12时的统计数据:stopVegas = 5时算法效率高stopVegas 0 5 12 p 1.0000 0.5039 0.0465 s 262.00 33.88 13.00 e 47.23 10.20 t 262.00 80.39 222.1119Las Vegas 算法总结一次运行可能得不到解 得到的解一定是正确的 改进途径:与确定型算法相结合 改进确定型算法的平均情况下复杂度 修改确定性算法得到20例5串相等测试问题:A有一个长串x, B有长串y,A和B希望知道x=y?方法一:A 将x 发送给B,B 测试x = y?发送消耗:长串占用信道资源大方法二:A 用x 导出一个短串f(x) (fingerprints)A 将f(x) 发送到BB 使用同样方法导出相对于y 的短串f(y)B 比较f(x) 与f(y)如果f(x) ≠f(y),则x ≠y;如果f(x) = f(y),则不确定.25fingerprints的产生方法设x 和y 的二进制表示为正整数I(x), I(y)选择素数p, fingerprint函数为I p(x) = I(x) mod pA 传送p 和I p(x) 给B. 当p 不太大时,传送一个短串. 存在问题:x = y ⇒I p(x) = I p(y)I p(x) = I p(y) ⇏x = y出错条件:固定p | (I(x) −I(y))26算法二Knuth, Morris, Pratt利用有限状态自动机模式匹配算法Introduction to Algorithms运行时间:O(m+n)算法三随机算法设计思想:设X(j) = xjx j+1 …x j+m-1改造算法一不是比较每个X(j) (j = 1, 2, …, n-m+1) 与Y,而是将Ip (Y) 与I p(X(j)) 比较其他算法34时间复杂度W p, I p(Y), I p(X(1)) 计算O(m) 时间从Ip(X(j)) 计算I p(X(j+1)) 总共需要O(n)时间总时间为O(m+n)出错条件:∏≠−⇔=∧≠)}(|{|))(()(| |))(()( )(jXYj ppjXIYIp jXIYIjXY算法分析38例7素数测试•求x的m次幂•求a的模n的m次幂•Fermart小定理•测试算法分析40算法的问题Fermat小定理的条件是必要条件,不是充分条件,满足这个条件的也可能是合数.对所有与n互素的正整数a,都满足上述条件的合数n称为Carmichael 数,如561,1105,1729,2465等。

Carmichael数非常少,小于108的只有255个。

如果n为合数,但不是Carmichael数,算法Ptest2 测试n为合数的概率至少为1/2. 但是这个算法不能解决Carmichael数的问题。

4647定理2 如果n 为素数,则方程x 2≡1(mod n )的根只有两个,即x = 1,x = −1(或x = n −1).证明x 2(mod n ) ≡1⇔x 2−1 ≡0(mod n )⇔(x +1)(x −1) ≡0(mod n )⇔x +1 ≡0 或x −1 ≡0(域中没有零因子)⇔x = n −1 或x =1称x ≠±1 的根为非平凡的.定理2: 如果方程有非平凡的根,则n 为合数. 例如:x 2(mod 5) ≡1 ⇔x = 1 或x = 4x 2(mod 12) ≡1 ⇔x = 1 或x = 11 或x = 5 或x =75和7是非平凡的根素数的另一个必要条件48设n 为奇素数,存在q, m 使得n -1=2q m , (q ≥1). 序列)(mod ),...,(mod ),(mod ),(mod 242n a n a n a n a m m m m q 的最后一项为a n -1(mod n ), 而且每一项是前面一项的平方. 对于任意i (i =0,1,…q -1), 判断)(mod 2n a m i 是否为1 和n -1, 且它的后一项是否为1.如果其后项为1,但本项不等于1 和n -1, 则它就是非平凡的根,从而知道n 不是素数.随机选择a ∈{2,3,…, n -2}, 进行上述测试. 基于定理2的测试原理49例如n =561, n -1=560=24⋅ 35, 假设a =7, 构造的序列为 1)561(mod 7)561(mod 7,67)561(mod 7)561(mod 7,166)561(mod 7)561(mod 7,298)561(mod 7)561(mod 7,241)561(mod 756035228035214035270352354321========= 第5项为1,但是第4项等于67,它既不等于1也不等于560,是个非平凡的根,因此可以判定n 为合数.根据这个思想设计的计算机算法称为Miller-Rabin 算法,它随机选择正整数a ∈{2,3,…, n -1}, 然后进行上述测试.实例。

相关文档
最新文档