现代设计方法习题答案

合集下载

现代工程设计制图习题集(第四版)参考答案

现代工程设计制图习题集(第四版)参考答案
强化了实践应用
第四版习题集更加注重实践应用,增加了大量来自于实际工程案例 的题目,帮助学生更好地将理论知识应用于实践中。
提高了题目质量
第四版习题集的题目经过了精心的设计和筛选,质量更高、更具代表 性,能够更好地帮助学生掌握工程设计制图的核心技能。
习题集使用方法和建议
系统性使用
建议学生按照章节顺序,系统性地完成习题集中的题目, 以全面掌握工程设计制图的知识和技能。
透视图的分类
根据观察者和物体之间的相对位置关系以及投影面的选择不同,透视图可分为一点透视、 两点透视和三点透视三种类型。其中,一点透视和两点透视是常用的透视图类型。
06
工程图样的表达方法
视图表达方法
基本视图 向视图 局部视图 斜视图
根据正投影法绘制出物体的六个基本视图,即主视图、俯视图 、左视图、右视图、仰视图和后视图。
三视图的投影规律
长对正、高平齐、宽相等。即主视图与俯视图长度相等且对正,主视图与左视 图高度相等且平齐,俯视图与左视图宽度相等。
基本几何体的三视图
平面立体的三视图
棱柱、棱锥等平面立体的三视图,要 注意各视图的形状和尺寸标注。
回转体的三视图
圆柱、圆锥、圆球等回转体的三视图 ,要注意各视图的形状、尺寸标注和 截交线、相贯线的画法。
AutoCAD软件的操作界面及 工具栏介绍
AutoCAD软件的基本操作技 巧与快捷键使用
二维图形绘制与编辑命令
尺寸标注、文字标注等
二维图形标注命令
移动、旋转、缩放、镜像等
二维图形编辑命令
直线、圆、圆弧、多边形等
二维图形绘制命令
三维建模与渲染技术
三维建模命令
拉伸、旋转、放样、布尔运算等
三维渲染技术

C语言程序设计现代方法第2版课后习题答案

C语言程序设计现代方法第2版课后习题答案

C语⾔程序设计现代⽅法第2版课后习题答案C语⾔程序设计:现代⽅法[美]K. N. King 著课后习题答案C语⾔的经典之作“近10年来*好的⼀部C语⾔著作”讨论了标准C和C标准库的全部特性强调扫⼀扫⽂末在⾥⾯回复答案+C语⾔程序设计:现代⽅法⽴即得到答案软件⼯程和现代编程理念突出⼯业界的**实践、实际经验和编程风格已被包括哈佛⼤学、⿇省理⼯学院、斯坦福⼤学等全球200多所学校采⽤为教材时⾄今⽇,C语⾔仍然是计算机领域的通⽤语⾔之⼀,但今天的C语⾔已经和初的时候⼤不相同了。

本书主要的⼀个⽬的就是通过⼀种“现代⽅法”来介绍C语⾔,书中强调标准C,强调软件⼯程,不再强调“⼿⼯优化”。

这⼀版中紧密结合了C99标准,并与C89标准进⾏对照,补充了C99中的*特性。

本书分为C语⾔的基础特性、C语⾔的⾼级特性、C语⾔标准库和参考资料4个部分。

每章末尾都有⼀个“问与答”⼩节给出⼀系列与该章内容相关的问题及答案,此外还包含适量的习题。

本书是为⼤学本科阶段的C语⾔课程编写的教材,同时也⾮常适合作为其他课程的辅助⽤书。

K. N. King 世界知名的计算机程序设计教育家,现为佐治亚州⽴⼤学数学与计算机科学系副教授。

他拥有耶鲁⼤学计算机科学硕⼠学位,加州⼤学伯克利分校计算机科学博⼠学位,曾任教于佐治亚理⼯学院。

除本书外,他还撰写了⼴受欢迎的著作Modula-2: A Complete Guide 和Java Programming: From the Beginning,并在Dr.Dobb's Journal等权威杂志上发表了许多⽂章。

业余时间,King教授还在多部电影中扮演过⾓⾊。

⽬ 录第1章 C语⾔概述 11.1 C语⾔的历史 11.1.1 起源 11.1.2 标准化 11.1.3 基于C的语⾔ 21.2 C语⾔的优缺点 31.2.1 C语⾔的优点 31.2.2 C语⾔的缺点 31.2.3 ⾼效地使⽤C语⾔ 4问与答 5第2章 C语⾔基本概念 7显⽰全部信息“我完全沉浸在阅读的过程中,我迫切地想⽤这本书作为授课教材。

现代设计方法课后习题答案第三章

现代设计方法课后习题答案第三章

3.1 可靠性:产品在规定的条件下和规定的时间内,完成规定功能的能力。

可靠度:产品在规定的条件下和规定的时间内,完成规定功能的概率。

可靠度计算方法:R(t)=(N-n(t))/N3.2失效率:产品工作t 时刻尚未失效(或故障)的产品,在该时刻t 以后的下一个单位时间内发生失效(或故障)的概率。

λ(t )=0lim N t →∞∆→()()[()]n t t n t N n t t+∆--∆ 关系: R(t)= ()t t dt o e λ-⎰ 3.3早期失效期:失效率开始由很高的数值急剧地下降到一个稳定的数值。

正常运行期:失效率低且稳定,近似为常数。

损耗失效期:失效率随工作时间增加而上升。

常用分布函数:二项分布 F(r ≤k)=0k r n r c =∑r n r p q -泊松分布 F(t ≤k) =0!r k r r e μμ-=∑指数分布 F(t)=1-t eλ- 正态分布F(x)= 22()2()x x dx x e μσ---∞-∞<<∞⎰对数正态分布F(x)=21()20(0)1y y y dx x μσ-->⎰ 威布尔分布 F(x)=1-()x e βγη--3.4(1)可靠性设计和常规设计的主要区别在于,可靠性设计把一切设计参数都视为随机变量(1)传统设计方法是将安全系数作为衡量安全与否的指标,但安全系数的大小并没有同可靠度直接挂钩,这就有很大的盲目性,可靠性设计与之不同,她强调在设计阶段就把可靠度直接引进到零件中去,即由设计直接确定固有的可靠度。

(2)传统设计方法是把设计变量视为确定性的单值变量并通过确定性的函数进行运算,而可靠性设计则把设计变量视为随机变量并运用随机方法对设计变量进行描述和运算。

(3)在可靠性设计中,由于应力s 和强度c 都是随机变量,所以判断一个零件是否安全可靠,就以强度c 大应力s 的概率大小来表示。

(4)传统设计与可靠性设计都是以零件的安全或失效作为研究内容,两者兼有密切的联系,可靠性设计是传统设计的延伸与发展3.5 (1)最大可能的工作应力都要小于零件的可能的极限强度。

现代设计方法习题集及答案

现代设计方法习题集及答案

现代设计方法习题集及答案《现代设计方法》课程习题集【说明】:本课程《现代设计方法》(编号为02200)共有单选题,填空题1,计算题,简答题等多种试题类型,其中,本习题集中有[单选题,填空题1,计算题,简答题]等试题类型未进入。

一、单选题1.在CAD使用中,为了方便定义图形通常采用不同坐标系,在以下坐标系中,坐标系的定义域是连续且无界的是()A.世界坐标系B.显示器坐标系C.规格化设备坐标系D.绘图仪坐标系2.工程数据处理中,使用线性插值法完成()A.一元插值B.二元插值C.曲线拟合D.曲线绘制3.三维几何造型是CAD中的一种()A.图形处理技术B.工程分析技术C.文档处理技术D.软件设计技术4. CAD系统中,支撑用户进行CAD工作的通用性功能软件是()A.系统软件B.支撑软件C.专用操作软件D.专用应用软件5.若在CAD系统中,固定窗口参数,同时缩小视区高度和宽度,则视图内图形A.比例增大B.比例缩小C.左右移动D.上下移动6. CAD系统中不是按其描述和存储内容的特征划分的几何模型()A.线框几何模型B.表面几何模型C.实体几何模型D.曲面几何模型7. 世界坐标系、设备坐标系、规格化坐标系的转换关系是()A .WC→DC→NDCB .NDC→DC→WC C .WC→NDC→DCD .DC→WC→N DC8. 参数化绘图在定义图形时关键是利用了图形的()A .相似性B .多样性C .个别性D .特殊性9.下列设备不属于CAD 作业输入设备的,有()A .绘图仪B .键盘C .数字化仪D .光笔10.为使窗口—视区变换后的图形在视区中输出而不失真,则()A .yb xl W W =ybxl V V B .yt xr W W =yt xr V Vyb yt xl xr W W W W --=yb yt xlxr V V V V -- D .yt xr yb xl V V W W --=ytxr yb xl W W V W --11. 平面问题的弹性矩阵与材料的()A.弹性模量有关,泊松比无关B.弹性模量无关,泊松比有关C.弹性模量和泊松比都无关D.弹性模量和泊松比都有关12. 三维图形变换矩阵=s nmlr j i h q f e dp c b aT ,中l 表示产生的() A.比例变换 B.对称变换 C.错切变换 D.平移变换13.二维图形比例变换矩阵中??=d a T 00,可有()A.a=0,d=1 B. a=1,d=0 C. a=d=1 D. a=d=014.已知变换矩阵=100020001T ,则图形将在() A .X 方向放大2倍 B .Y 方向放大2倍C .X 方向平移2D .Y 方向平移215. 三维图形变换矩阵=s nmlr j i h q f e dp c b a T 中,[l m n ]表示产生() A .比例变换 B .对称变换C .错切变换D .平移变换16.一个多元函数F(X)在点x*附近偏导数连续,则该点为极小点的充分条件是()A.0*)(=?x FB.0*)(=?x F ,H(x*)正定C.H(x*)=0D.0*)(=?x F ,H(x*)负定17. 内点罚函数法的特点是()A.能处理等式约束问题B.初始点必须在可行域内C. 初始点可以在可行域外D.后面产生的迭代点序列可以在可行域外18. 对于一个无约束优化问题,若其一阶、二阶偏导数易计算,且计算变量不多(n≤20),宜选用的优化方法是()A.拟牛顿法B.变尺度法C.0.618法D.二次插值法19. 设计体积500cm 3的圆柱形包装盒,按用料最省的原则要确定其高度H 和直径D ,其设计变量是()A.重量B.直径C.面积D.体积20. 多元函数F(X)在点x*附近偏导数连续,0*)(=?x F ,H(x*)负定,则该点为F(X)的()A.极大值点B. 极小值点C.鞍点D.不连续点21. 在单峰搜索区间[x 1, x 3](x 1<="" 4="" bdsfid="181" p="">内,若x 2>x 4,并且函数F(x 4)<="" x4]="" )="">22.下列特性中,梯度法不具有的是()A.二次收敛性B.要计算一阶偏导数C.对初始点的要求不高D.只利用目标函数的一阶偏导数值构成搜索方向23.对于极小化F(x),而受限于约束g μ(x)≤0(μ= 0,1,2,…,m)的优化问题,其内点罚函数表达式为()A.∑=-=Φmk k X g rX F rX 1)()()(/1)(),(μμ B.∑=+=Φmk k X g rX F r X 1)()()(/1)(),(μμ C.∑=-=Φmk k X g rX F r X 1)()()](,0max [)(),(μμ D.∑=-=Φmk k X g rX F r X 1)()()](,0min[)(),(μμ 24.设X =(X 1, X 2,…, X n ),R n 为维欧氏空间,则下述正确的是()A .设计空间是 n 维欧氏空间R nB .设计空间是 n 维欧氏空间R n 中落在可行域内的部分C .设计变量在具体设计问题中的迭代值是唯一的D .设计变量是指设计对象中用到的所有变量25. 函数22),(1323121+-+=x x x x x F 在点Tx }2,1{=处的梯度是()A. T }12,1{B.T }1,8{C. T}3,1{ D.T}8,0{26. 对于 n 维正定二次函数,沿一组共轭方向依次作一维搜索,当达到极值点时,最多需要搜索()A .n +1 次B .n 次C .n -1次D .2n 次27. 函数F (X )为在区间[10,20]内有极小值的单峰函数,进行一维搜索时,取两点13和16,若F (13)<F (16),则缩小后的区间为()A .[13,16]B .[10,13]C .[10,16]D .[16,20]28. 梯度法与变尺度法所具有的收敛性分别为()A .一次收敛性.一次收敛性B .二次收敛性.二次收敛性C .一次收敛性.二次收敛性D .二次收敛性.一次收敛性29.设F (X )为区间(0,3)上的单峰函数,且F (1)=2、F (2)=1.5,则可将搜索区间(0,3)缩小为()A .(0,2)B .(1,2)C .(2,3)D .(1,3)30. 求f(x 1,x 2)=2x 12-8x 1+2x 22-4x 2+20的极值及极值点()A. x*=[1,1]T 12B.x*=[2,1]T 10 C. x*=[2,2]T 12 D. x*=[1,0]T 1431. 串联系统的失效模式大多服从()A.正态分布B.对数正态分布C.指数分布D.威布尔分布32. 抽取100只灯泡进行实验,灯泡工作到50小时有12只损坏,工作到70小时有20只损坏,从50小时到70小时这段时间内灯泡的平均失效密度是() A.0.006 B.0.004 C.0.01 D.0.1233. 由三个相同的元件组成的并联系统,系统正常工作的条件是至少有两个元件处于正常工作状态,每个元件的可靠度为R=0.9,则系统的可靠度为() A.0.972 B.0.99 C.0.999 D.0.999734. 当转换开关的可靠度为1时,非工作冗余系统的可靠度为R1, 工作冗余系统的可靠度为R2,则R1与R2之间的关系为()A. R1<R2B. R1>R2C. R1= R2D. R1≤R235. 下列可靠性指标关系式不正确的是()A .dtt dF t f )()(= B .1)()(=+t F t R C .?∞=tdt t tf t R )()( D .?∞=0)(dt t tf T36. 正态分布中的标准差是()A.表征随机变量分布的离散程度B.表征随机变量分布的集中趋势C.决定正态分布曲线的位置D.影响正态分布曲线的对称性37.若知某产品的失效密度f(t),则其平均寿命T 可表为()A.?t dt t f 0)( B.?∞tdt t f )( C.?∞tdt t f t f )()( D.?∞)(dt t tf38.随机变量A 和B 均服从正态分布,即A=N(μ1,σ1);A=N(μ2,σ2),则随机变量A在(μ1-2σ1)~(μ1-σ1)之间分布的百分数与随机变量 B 在(μ2+σ2)~(μ2+2σ2)之间分布的百分数()A.之比为-σ1/σ2B.之比为σ1/σ2C.之比为-σ2/σ1D.相等39. 标准正态分布是定义为()A.μ=1,σ=0.5的正态分布B.μ=1,σ=1的正态分布C.μ=0,σ=1的正态分布D.μ=0.5,σ=1的正态分布40. 零件的强度和应力均服从正态分布,即N(μr ,σr ); N(μs ,σs ),且知μr >μs ,当σr 增大时,零件的可靠度()A.提高B.降低C.不变D.不定41. 某产品的寿命服从指数分布,若知其失效率λ=0.002,则该产品的平均寿命为()A.200B.1000C.500D.200042. 要提高可靠性的置信度,不应()A.增加强度的样本容量B.加大强度的标准差C.减少应力的均值D.增加应力的样本容量43.N 台具有相同可靠度为R 的设备组成系统,若系统允许 r 台设备失效仍认为正常工作,则该系统的可靠度函数R S 为() A .R S =∑=---ri iin i n n R R C )1( B .R S =∑=--ni r rn r n R RC)1(C .R S =rr n r nR R C )1(-- D .R S =∑=---ri r rn r n R RC)1(144.N 台具有相同可靠度为R 的设备组成系统,若系统允许 r 台设备失效仍认为正常工作,则该系统的可靠度函数R S 为() A .R S =∑=---nri iin i n n R R C )1( B .R S =∑=--nn r n R RC)1(C .R S =rr n r nR R C )1(-- D .R S =∑=---ri r rn r n R RC)1(145. 对于2/3表决系统,下列情况中,系统不能正常工作的是()A .a 、b 失效,c 正常B .a 失效,b 、c 正常C .a 、b 、c 正常D .a 、b 正常,c 失效46.N 台具有相同可靠度为R 的设备组成系统,恰好有r 台设备失效时系统的可靠度为() A .R S =∑=--ri rr n r n R R C 0)1( B .R S =∑=--ni r rn r n R RC)1( C .R S =rrn r n R R C )1(-- D .R S =∑=---ri r rn r n R RC)1(147. 根据强度—应力干涉理论可以判定,当强度均值 r 等于应力均值s 时,则零件可靠度R 的值()A .小于0.5B .大于0.5C .等于0.5D .等于148.N 个产品进行可靠性试验,在t ~t +△t 时间内的失效数为N f (t ),t 时刻的累积失效数N f (t ),则t 时刻的存活频率为()A .Nt N N f )(- B .Nt N f )( C .t N t N f ??)( D .t t N N t N ff ??)]([)(-49.在t ~t +△t 的时间间隔内的平均失效密度f (t )表示()A .平均单位时间的失效频数B .平均单位时间的失效频率C .产品工作到t 时刻,单位时间内发生失效的概率D .产品工作到t 时刻,单位时间内发生的失效数与仍在正常工作的数之比50.设试验数为N 0,累积失效数为N f (t),仍正常工作数N s (t),则存活频率是指()A .0)(N t N f B .0)(N t N s C .)()(t N t N f s D .)()(t N t N s f二、填空题1 51.计算机辅助设计(CAD)是指人们在计算机的辅助下,对产品或工程进行设计、绘图、分析计算或编写技术文件以及显示、输出的一种设计方法。

c语言程序设计现代方法(第二版)习题答案

c语言程序设计现代方法(第二版)习题答案

Chapter 2Answers to Selected Exercises2. [was #2] (a) The program contains one directive (#include) and four statements (three calls of printf and one return).(b)Parkinson's Law:Work expands so as to fill the timeavailable for its completion.3. [was #4]#include <stdio.h>int main(void){int height = 8, length = 12, width = 10, volume;volume = height * length * width;printf("Dimensions: %dx%dx%d\n", length, width, height);printf("Volume (cubic inches): %d\n", volume);printf("Dimensional weight (pounds): %d\n", (volume + 165) / 166);return 0;}4. [was #6] Here's one possible program:#include <stdio.h>int main(void){int i, j, k;float x, y, z;printf("Value of i: %d\n", i);printf("Value of j: %d\n", j);printf("Value of k: %d\n", k);printf("Value of x: %g\n", x);printf("Value of y: %g\n", y);printf("Value of z: %g\n", z);return 0;}When compiled using GCC and then executed, this program produced the following output:Value of i: 5618848Value of j: 0Value of k: 6844404Value of x: 3.98979e-34Value of y: 9.59105e-39Value of z: 9.59105e-39The values printed depend on many factors, so the chance that you'll get exactly these numbers is small.5. [was #10] (a) is not legal because 100_bottles begins with a digit.8. [was #12] There are 14 tokens: a, =, (, 3, *, q, -, p, *, p, ), /, 3, and ;.Answers to Selected Programming Projects4. [was #8; modified]#include <stdio.h>int main(void){float original_amount, amount_with_tax;printf("Enter an amount: ");scanf("%f", &original_amount);amount_with_tax = original_amount * 1.05f;printf("With tax added: $%.2f\n", amount_with_tax);return 0;}The amount_with_tax variable is unnecessary. If we remove it, the program is slightly shorter:#include <stdio.h>int main(void){float original_amount;printf("Enter an amount: ");scanf("%f", &original_amount);printf("With tax added: $%.2f\n", original_amount * 1.05f);return 0;}Chapter 3Answers to Selected Exercises2. [was #2](a) printf("%-8.1e", x);(b) printf("%10.6e", x);(c) printf("%-8.3f", x);(d) printf("%6.0f", x);5.[was #8] The values of x, i, and y will be 12.3, 45, and .6, respectively. Answers to Selected Programming Projects1. [was #4; modified]#include <stdio.h>int main(void){int month, day, year;printf("Enter a date (mm/dd/yyyy): ");scanf("%d/%d/%d", &month, &day, &year);printf("You entered the date %d%.2d%.2d\n", year, month, day);return 0;}3. [was #6; modified]#include <stdio.h>int main(void){int prefix, group, publisher, item, check_digit;printf("Enter ISBN: ");scanf("%d-%d-%d-%d-%d", &prefix, &group, &publisher, &item,&check_digit);printf("GS1 prefix: %d\n", prefix);printf("Group identifier: %d\n", group);printf("Publisher code: %d\n", publisher);printf("Item number: %d\n", item);printf("Check digit: %d\n", check_digit);/* The five printf calls can be combined as follows:printf("GS1 prefix: %d\nGroup identifier: %d\nPublishercode: %d\nItem number: %d\nCheck digit: %d\n",prefix, group, publisher, item, check_digit);*/return 0;}Chapter 4Answers to Selected Exercises2.[was #2] Not in C89. Suppose that i is 9 and j is 7. The value of (-i)/j could be either –1 or –2, depending on the implementation. On the other hand, the value of -(i/j) is always –1, regardless of the implementation. In C99, on the other hand, the value of (-i)/j must be equal to the value of -(i/j).9. [was #6](a) 63 8(b) 3 2 1(c) 2 -1 3(d) 0 0 013. [was #8] The expression ++i is equivalent to (i += 1). The value of both expressions is i after the increment has been performed.Answers to Selected Programming Projects2. [was #4]#include <stdio.h>int main(void){int n;printf("Enter a three-digit number: ");scanf("%d", &n);printf("The reversal is: %d%d%d\n", n % 10, (n / 10) % 10, n / 100);return 0;}Chapter 5Answers to Selected Exercises2. [was #2](a) 1(b) 1(c) 1(d) 14. [was #4] (i > j) - (i < j)6. [was #12] Yes, the statement is legal. When n is equal to 5, it does nothing, since 5 is not equal to –9.10. [was #16] The output isonetwosince there are no break statements after the cases.Answers to Selected Programming Projects2. [was #6]#include <stdio.h>int main(void){int hours, minutes;printf("Enter a 24-hour time: ");scanf("%d:%d", &hours, &minutes);printf("Equivalent 12-hour time: ");if (hours == 0)printf("12:%.2d AM\n", minutes);else if (hours < 12)printf("%d:%.2d AM\n", hours, minutes);else if (hours == 12)printf("%d:%.2d PM\n", hours, minutes);elseprintf("%d:%.2d PM\n", hours - 12, minutes);return 0;}4. [was #8; modified]#include <stdio.h>int main(void){int speed;printf("Enter a wind speed in knots: ");scanf("%d", &speed);if (speed < 1)printf("Calm\n");else if (speed <= 3)printf("Light air\n");else if (speed <= 27)printf("Breeze\n");else if (speed <= 47)printf("Gale\n");else if (speed <= 63)printf("Storm\n");elseprintf("Hurricane\n");return 0;}6. [was #10]#include <stdio.h>int main(void){int check_digit, d, i1, i2, i3, i4, i5, j1, j2, j3, j4, j5, first_sum, second_sum, total;printf("Enter the first (single) digit: ");scanf("%1d", &d);printf("Enter first group of five digits: ");scanf("%1d%1d%1d%1d%1d", &i1, &i2, &i3, &i4, &i5);printf("Enter second group of five digits: ");scanf("%1d%1d%1d%1d%1d", &j1, &j2, &j3, &j4, &j5);printf("Enter the last (single) digit: ");scanf("%1d", &check_digit);first_sum = d + i2 + i4 + j1 + j3 + j5;second_sum = i1 + i3 + i5 + j2 + j4;total = 3 * first_sum + second_sum;if (check_digit == 9 - ((total - 1) % 10))printf("VALID\n");elseprintf("NOT VALID\n");return 0;}10. [was #14]#include <stdio.h>int main(void){int grade;printf("Enter numerical grade: ");scanf("%d", &grade);if (grade < 0 || grade > 100) {printf("Illegal grade\n");return 0;}switch (grade / 10) {case 10:case 9: printf("Letter grade: A\n");break;case 8: printf("Letter grade: B\n");break;case 7: printf("Letter grade: C\n");break;case 6: printf("Letter grade: D\n");break;case 5:case 4:case 3:case 2:case 1:case 0: printf("Letter grade: F\n");break;}return 0;}Chapter 6Answers to Selected Exercises4.[was #10] (c) is not equivalent to (a) and (b), because i is incremented before the loop body is executed.10. [was #12] Consider the following while loop:while (…) {…continue;…}The equivalent code using goto would have the following appearance:while (…) {…goto loop_end;…loop_end: ; /* null statement */}12. [was #14]for (d = 2; d * d <= n; d++)if (n % d == 0)break;The if statement that follows the loop will need to be modified as well:if (d * d <= n)printf("%d is divisible by %d\n", n, d);elseprintf("%d is prime\n", n);14. [was #16] The problem is the semicolon at the end of the first line. If we remove it, the statement is now correct:if (n % 2 == 0)printf("n is even\n");Answers to Selected Programming Projects2. [was #2]#include <stdio.h>int main(void){int m, n, remainder;printf("Enter two integers: ");scanf("%d%d", &m, &n);while (n != 0) {remainder = m % n;m = n;n = remainder;}printf("Greatest common divisor: %d\n", m);return 0;}4. [was #4]#include <stdio.h>int main(void){float commission, value;printf("Enter value of trade: ");scanf("%f", &value);while (value != 0.0f) {if (value < 2500.00f)commission = 30.00f + .017f * value;else if (value < 6250.00f)commission = 56.00f + .0066f * value;else if (value < 20000.00f)commission = 76.00f + .0034f * value;else if (value < 50000.00f)commission = 100.00f + .0022f * value;else if (value < 500000.00f)commission = 155.00f + .0011f * value;elsecommission = 255.00f + .0009f * value;if (commission < 39.00f)commission = 39.00f;printf("Commission: $%.2f\n\n", commission);printf("Enter value of trade: ");scanf("%f", &value);}return 0;}6. [was #6]#include <stdio.h>int main(void){int i, n;printf("Enter limit on maximum square: ");scanf("%d", &n);for (i = 2; i * i <= n; i += 2)printf("%d\n", i * i);return 0;}8. [was #8]#include <stdio.h>int main(void){int i, n, start_day;printf("Enter number of days in month: ");scanf("%d", &n);printf("Enter starting day of the week (1=Sun, 7=Sat): "); scanf("%d", &start_day);/* print any leading "blank dates" */for (i = 1; i < start_day; i++)printf(" ");/* now print the calendar */for (i = 1; i <= n; i++) {printf("%3d", i);if ((start_day + i - 1) % 7 == 0)printf("\n");}return 0;}Chapter 7Answers to Selected Exercises3. [was #4] (b) is not legal.4.[was #6] (d) is illegal, since printf requires a string, not a character, as its first argument.10.[was #14] unsigned int, because the (int) cast applies only to j, not j * k.12. [was #16] The value of i is converted to float and added to f, then the result is converted to double and stored in d.14. [was #18] No. Converting f to int will fail if the value stored inf exceeds the largest value of type int.Answers to Selected Programming Projects1.[was #2] short int values are usually stored in 16 bits, causing failure at 182. int and long int values are usually stored in 32 bits, with failure occurring at 46341.2. [was #8]#include <stdio.h>int main(void){int i, n;char ch;printf("This program prints a table of squares.\n");printf("Enter number of entries in table: ");scanf("%d", &n);ch = getchar();/* dispose of new-line character following number of entries *//* could simply be getchar(); */for (i = 1; i <= n; i++) {printf("%10d%10d\n", i, i * i);if (i % 24 == 0) {printf("Press Enter to continue...");ch = getchar(); /* or simply getchar(); */}}return 0;}5. [was #10]#include <ctype.h>#include <stdio.h>int main(void){int sum = 0;char ch;printf("Enter a word: ");while ((ch = getchar()) != '\n')switch (toupper(ch)) {case 'D': case 'G':sum += 2; break;case 'B': case 'C': case 'M': case 'P':sum += 3; break;case 'F': case 'H': case 'V': case 'W': case 'Y': sum += 4; break;case 'K':sum += 5; break;case 'J': case 'X':sum += 8; break;case 'Q': case 'Z':sum += 10; break;default:sum++; break;}printf("Scrabble value: %d\n", sum);return 0;}6. [was #12]#include <stdio.h>int main(void){printf("Size of int: %d\n", (int) sizeof(int));printf("Size of short: %d\n", (int) sizeof(short));printf("Size of long: %d\n", (int) sizeof(long));printf("Size of float: %d\n", (int) sizeof(float));printf("Size of double: %d\n", (int) sizeof(double));printf("Size of long double: %d\n", (int) sizeof(long double));return 0;}Since the type of a sizeof expression may vary from one implementation to another, it's necessary in C89 to cast sizeof expressions to a known type before printing them. The sizes of the basic types are small numbers, so it's safe to cast them to int. (In general, however, it's best to cast sizeof expressions to unsigned long and print them using %lu.) In C99, we can avoid the cast by using the %zu conversion specification.Chapter 8Answers to Selected Exercises1.[was #4] The problem with sizeof(a) / sizeof(t) is that it can't easily be checked for correctness by someone reading the program. (The reader would have to locate the declaration of a and make sure that its elements have type t.)2. [was #8] To use a digit d (in character form) as a subscript into the array a, we would write a[d-'0']. This assumes that digits have consecutive codes in the underlying character set, which is true of ASCII and other popular character sets.7. [was #10]const int segments[10][7] = {{1, 1, 1, 1, 1, 1},{0, 1, 1},{1, 1, 0, 1, 1, 0, 1},{1, 1, 1, 1, 0, 0, 1},{0, 1, 1, 0, 0, 1, 1},{1, 0, 1, 1, 0, 1, 1},{1, 0, 1, 1, 1, 1, 1},{1, 1, 1},{1, 1, 1, 1, 1, 1, 1},{1, 1, 1, 1, 0, 1, 1}};Answers to Selected Programming Projects2. [was #2]#include <stdio.h>int main(void){int digit_count[10] = {0};int digit;long n;printf("Enter a number: ");scanf("%ld", &n);while (n > 0) {digit = n % 10;digit_count[digit]++;n /= 10;}printf ("Digit: ");for (digit = 0; digit <= 9; digit++)printf("%3d", digit);printf("\nOccurrences:");for (digit = 0; digit <= 9; digit++)printf("%3d", digit_count[digit]);printf("\n");return 0;}5. [was #6]#include <stdio.h>#define NUM_RATES ((int) (sizeof(value) / sizeof(value[0]))) #define INITIAL_BALANCE 100.00int main(void){int i, low_rate, month, num_years, year;double value[5];printf("Enter interest rate: ");scanf("%d", &low_rate);printf("Enter number of years: ");scanf("%d", &num_years);printf("\nYears");for (i = 0; i < NUM_RATES; i++) {printf("%6d%%", low_rate + i);value[i] = INITIAL_BALANCE;}printf("\n");for (year = 1; year <= num_years; year++) {printf("%3d ", year);for (i = 0; i < NUM_RATES; i++) {for (month = 1; month <= 12; month++)value[i] += ((double) (low_rate + i) / 12) / 100.0 * value[i]; printf("%7.2f", value[i]);}printf("\n");}return 0;}8. [was #12]#include <stdio.h>#define NUM_QUIZZES 5#define NUM_STUDENTS 5int main(void){int grades[NUM_STUDENTS][NUM_QUIZZES];int high, low, quiz, student, total;for (student = 0; student < NUM_STUDENTS; student++) {printf("Enter grades for student %d: ", student + 1);for (quiz = 0; quiz < NUM_QUIZZES; quiz++)scanf("%d", &grades[student][quiz]);}printf("\nStudent Total Average\n");for (student = 0; student < NUM_STUDENTS; student++) {printf("%4d ", student + 1);total = 0;for (quiz = 0; quiz < NUM_QUIZZES; quiz++)total += grades[student][quiz];printf("%3d %3d\n", total, total / NUM_QUIZZES);}printf("\nQuiz Average High Low\n");for (quiz = 0; quiz < NUM_QUIZZES; quiz++) {printf("%3d ", quiz + 1);total = 0;high = 0;low = 100;for (student = 0; student < NUM_STUDENTS; student++) {total += grades[student][quiz];if (grades[student][quiz] > high)high = grades[student][quiz];if (grades[student][quiz] < low)low = grades[student][quiz];}printf("%3d %3d %3d\n", total / NUM_STUDENTS, high, low); }return 0;}Chapter 9Answers to Selected Exercises2. [was #2]int check(int x, int y, int n){return (x >= 0 && x <= n - 1 && y >= 0 && y <= n - 1);}4. [was #4]int day_of_year(int month, int day, int year){int num_days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int day_count = 0, i;for (i = 1; i < month; i++)day_count += num_days[i-1];/* adjust for leap years, assuming they are divisible by 4 */if (year % 4 == 0 && month > 2)day_count++;return day_count + day;}Using the expression year % 4 == 0 to test for leap years is not completely correct. Centuries are special cases: if a year is a multiple of 100, then it must also be a multiple of 400 in order to be a leap year. The correct test isyear % 4 == 0 && (year % 100 != 0 || year % 400 == 0)6. [was #6; modified]int digit(int n, int k){int i;for (i = 1; i < k; i++)n /= 10;return n % 10;}8. [was #8] (a) and (b) are valid prototypes. (c) is illegal, since it doesn't specify the type of the parameter. (d) incorrectly specifies that f returns an int value in C89; in C99, omitting the return type is illegal.10. [was #10](a)int largest(int a[], int n){int i, max = a[0];for (i = 1; i < n; i++)if (a[i] > max)max = a[i];return max;}(b)int average(int a[], int n){int i, avg = 0;for (i = 0; i < n; i++)avg += a[i];return avg / n;}(c)int num_positive(int a[], int n){int i, count = 0;for (i = 0; i < n; i++)if (a[i] > 0)count++;return count;}15. [was #12; modified]double median(double x, double y, double z) {double result;if (x <= y)if (y <= z) result = y;else if (x <= z) result = z;else result = x;else {if (z <= y) result = y;else if (x <= z) result = x;else result = z;}return result;}17. [was #14]int fact(int n){int i, result = 1;for (i = 2; i <= n; i++)result *= i;return result;}19. [was #16] The following program tests the pb function:#include <stdio.h>void pb(int n);int main(void){int n;printf("Enter a number: ");scanf("%d", &n);printf("Output of pb: ");pb(n);printf("\n");return 0;}void pb(int n){if (n != 0) {pb(n / 2);putchar('0' + n % 2);}}pb prints the binary representation of the argument n, assuming that n is greater than 0. (We also assume that digits have consecutive codes in the underlying character set.) For example:Enter a number: 53Output of pb: 110101A trace of pb's execution would look like this:pb(53) finds that 53 is not equal to 0, so it callspb(26), which finds that 26 is not equal to 0, so it calls pb(13), which finds that 13 is not equal to 0, so it calls pb(6), which finds that 6 is not equal to 0, so it callspb(3), which finds that 3 is not equal to 0, so it callspb(1), which finds that 1 is not equal to 0, so it callspb(0), which finds that 0 is equal to 0, so it returns, causingpb(1) to print 1 and return, causingpb(3) to print 1 and return, causingpb(6) to print 0 and return, causingpb(13) to print 1 and return, causingpb(26) to print 0 and return, causingpb(53) to print 1 and return.Chapter 10Answers to Selected Exercises1. [was #2] (a) a, b, and c are visible.(b) a, and d are visible.(c) a, d, and e are visible.(d) a and f are visible.Answers to Selected Programming Projects3. [was #4]#include <stdbool.h> /* C99 only */#include <stdio.h>#include <stdlib.h>#define NUM_CARDS 5#define RANK 0#define SUIT 1/* external variables */int hand[NUM_CARDS][2];/* 0 1____ ____0 |____|____|1 |____|____|2 |____|____|3 |____|____|4 |____|____|rank suit*/bool straight, flush, four, three;int pairs; /* can be 0, 1, or 2 *//* prototypes */void read_cards(void);void analyze_hand(void);void print_result(void);/********************************************************** * main: Calls read_cards, analyze_hand, and print_result * * repeatedly. * **********************************************************/ int main(void){for (;;) {read_cards();analyze_hand();print_result();}}/********************************************************** * read_cards: Reads the cards into the external variable * * hand; checks for bad cards and duplicate * * cards. * **********************************************************/ void read_cards(void){char ch, rank_ch, suit_ch;int i, rank, suit;bool bad_card, duplicate_card;int cards_read = 0;while (cards_read < NUM_CARDS) {bad_card = false;printf("Enter a card: ");rank_ch = getchar();switch (rank_ch) {case '0': exit(EXIT_SUCCESS);case '2': rank = 0; break;case '3': rank = 1; break;case '4': rank = 2; break;case '5': rank = 3; break;case '6': rank = 4; break;case '7': rank = 5; break;case '8': rank = 6; break;case '9': rank = 7; break;case 't': case 'T': rank = 8; break;case 'j': case 'J': rank = 9; break;case 'q': case 'Q': rank = 10; break;case 'k': case 'K': rank = 11; break;case 'a': case 'A': rank = 12; break;default: bad_card = true;}suit_ch = getchar();switch (suit_ch) {case 'c': case 'C': suit = 0; break;case 'd': case 'D': suit = 1; break;case 'h': case 'H': suit = 2; break;case 's': case 'S': suit = 3; break;default: bad_card = true;}while ((ch = getchar()) != '\n')if (ch != ' ') bad_card = true;if (bad_card) {printf("Bad card; ignored.\n");continue;}duplicate_card = false;for (i = 0; i < cards_read; i++)if (hand[i][RANK] == rank && hand[i][SUIT] == suit) { printf("Duplicate card; ignored.\n");duplicate_card = true;break;}if (!duplicate_card) {hand[cards_read][RANK] = rank;hand[cards_read][SUIT] = suit;cards_read++;}}}/********************************************************** * analyze_hand: Determines whether the hand contains a * * straight, a flush, four-of-a-kind, * * and/or three-of-a-kind; determines the * * number of pairs; stores the results into * * the external variables straight, flush, * * four, three, and pairs. * **********************************************************/ void analyze_hand(void){int rank, suit, card, pass, run;straight = true;flush = true;four = false;three = false;pairs = 0;/* sort cards by rank */for (pass = 1; pass < NUM_CARDS; pass++)for (card = 0; card < NUM_CARDS - pass; card++) {rank = hand[card][RANK];suit = hand[card][SUIT];if (hand[card+1][RANK] < rank) {hand[card][RANK] = hand[card+1][RANK];hand[card][SUIT] = hand[card+1][SUIT];hand[card+1][RANK] = rank;hand[card+1][SUIT] = suit;}}/* check for flush */suit = hand[0][SUIT];for (card = 1; card < NUM_CARDS; card++)if (hand[card][SUIT] != suit)flush = false;/* check for straight */for (card = 0; card < NUM_CARDS - 1; card++)if (hand[card][RANK] + 1 != hand[card+1][RANK])straight = false;/* check for 4-of-a-kind, 3-of-a-kind, and pairs bylooking for "runs" of cards with identical ranks */card = 0;while (card < NUM_CARDS) {rank = hand[card][RANK];run = 0;do {run++;card++;} while (card < NUM_CARDS && hand[card][RANK] == rank); switch (run) {case 2: pairs++; break;case 3: three = true; break;case 4: four = true; break;}}}/********************************************************** * print_result: Prints the classification of the hand, * * based on the values of the external * * variables straight, flush, four, three, * * and pairs. * **********************************************************/ void print_result(void){if (straight && flush) printf("Straight flush");else if (four) printf("Four of a kind");else if (three &&pairs == 1) printf("Full house");else if (flush) printf("Flush");else if (straight) printf("Straight");else if (three) printf("Three of a kind");else if (pairs == 2) printf("Two pairs");else if (pairs == 1) printf("Pair");else printf("High card");printf("\n\n");}5. [was #6]#include <stdbool.h> /* C99 only */#include <stdio.h>#include <stdlib.h>#define NUM_RANKS 13#define NUM_SUITS 4#define NUM_CARDS 5/* external variables */int num_in_rank[NUM_RANKS];int num_in_suit[NUM_SUITS];bool straight, flush, four, three;int pairs; /* can be 0, 1, or 2 *//* prototypes */void read_cards(void);void analyze_hand(void);void print_result(void);/********************************************************** * main: Calls read_cards, analyze_hand, and print_result * * repeatedly. * **********************************************************/ int main(void){for (;;) {read_cards();analyze_hand();print_result();}}/********************************************************** * read_cards: Reads the cards into the external * * variables num_in_rank and num_in_suit; * * checks for bad cards and duplicate cards. * **********************************************************/void read_cards(void){bool card_exists[NUM_RANKS][NUM_SUITS];char ch, rank_ch, suit_ch;int rank, suit;bool bad_card;int cards_read = 0;for (rank = 0; rank < NUM_RANKS; rank++) { num_in_rank[rank] = 0;for (suit = 0; suit < NUM_SUITS; suit++) card_exists[rank][suit] = false;}for (suit = 0; suit < NUM_SUITS; suit++)num_in_suit[suit] = 0;while (cards_read < NUM_CARDS) {bad_card = false;printf("Enter a card: ");rank_ch = getchar();switch (rank_ch) {case '0': exit(EXIT_SUCCESS); case '2': rank = 0; break;case '3': rank = 1; break;case '4': rank = 2; break;case '5': rank = 3; break;case '6': rank = 4; break;case '7': rank = 5; break;case '8': rank = 6; break;case '9': rank = 7; break;case 't': case 'T': rank = 8; break;case 'j': case 'J': rank = 9; break;case 'q': case 'Q': rank = 10; break; case 'k': case 'K': rank = 11; break; case 'a': case 'A': rank = 12; break; default: bad_card = true;}suit_ch = getchar();switch (suit_ch) {case 'c': case 'C': suit = 0; break;。

现代电路设计理论习题答案

现代电路设计理论习题答案

电路理论练习参考解答§3、线性电阻电路1)、对第一小节中的电路,假定g1=g2=…=g10=1s,求节点1、3与地之间形成的二端口(不包括图中的电流源)的开路阻抗矩阵。

解:将各g 的值代入节点电压方程,先在节点1注入单位电流源,有:[]100000Tn n Y V ⋅=其中210100021100012001100310100031001013n Y −−⎡⎤⎢⎥−−⎢⎥⎢⎥−−=⎢⎥−−⎢⎥⎢⎥−−⎢⎥−−⎣⎦解出上述方程,得[0.8833 0.3500 0.2833 0.4167 0.3667 0.2167]n V =T , 因此0.8833,0.2833。

再在节点3注入单位电流源,节点电压方程成为:11z =21z =[]001000Tn n Y V ⋅=解[0.45 0.65 1.05 0.25 0.30 0.45]n V =T 故0.45, 1.05,从而12z =22z =0.88330.28330.451.05oc Z ⎡⎤=⎢⎥⎣⎦2)、试推导二端口从y 参数到传输参数的转换式。

解:⎥⎥⎥⎥⎦⎤⎢⎢⎢⎢⎣⎡−Δ−−−=⎥⎦⎤⎢⎣⎡−⎥⎦⎤⎢⎣⎡⎥⎦⎤⎢⎣⎡−−=⎥⎦⎤⎢⎣⎡⇒⎥⎦⎤⎢⎣⎡−⎥⎦⎤⎢⎣⎡−=⎥⎦⎤⎢⎣⎡⎥⎦⎤⎢⎣⎡−⇒=⎥⎥⎥⎥⎦⎤⎢⎢⎢⎢⎣⎡−⎥⎦⎤⎢⎣⎡−⇒=⎥⎥⎥⎥⎦⎤⎢⎢⎢⎢⎣⎡−⎥⎦⎤⎢⎣⎡−⇒⎥⎦⎤⎢⎣⎡⎥⎦⎤⎢⎣⎡=⎥⎦⎤⎢⎣⎡−21112121212222221212111112222121121112211222112112121222112112122211211211100110010100101001y y y y y y y i v y y y y i v i v y y i v y y i v i v y y y y i i v v y y y y v v y y y y i i ;即得传输参数表达,其中,11221221y y y y y Δ=−。

现代设计方法第1阶段练习题江大考试题库及答案一科共有三个阶段,这是其中一个阶段。答案在最

现代设计方法第1阶段练习题江大考试题库及答案一科共有三个阶段,这是其中一个阶段。答案在最

江南大学网络教育第一阶段练习题考试科目:《现代设计方法》第章至第章(总分100分)__________学习中心(教学点)批次:层次:专业:学号:身份证号:姓名:得分:一单选题 (共17题,总分值17分,下列选项中有且仅有一个选项符合题目要求,请在答题卡上正确填涂。

)1. 对于多元函数的无约束优化问题,判断其最优点可以根据()。

(1 分)A. 目标函数的梯度判定B. 目标函数的性态判定C. 目标函数的凹凸性判定D. 目标函数值的大小判定2. 如果两个随机变量A和B均服从正态分布,即A=N(100,0.05),B=N(200,0.02),则随机变量A在 0.05之间分布的百分数与随机变量B在 0.02之间分布的百分数()。

(1 分)A. 之比为2.5B. 之差为0.5C. 之比为0.4D. 相等3. 决定正态分布曲线形状的参数是()。

(1 分)A. 正态变量B. 均值和标准差C. 均值D. 标准差4. 多元函数F(X)在X*处存在极大值的充分必要条件是:在X*处的Hessian矩阵()。

(1分)A. 等于零B. 大于零C. 负定D. 正定5. 对于函数F(x)= ,从初始点x(0)={1,1}T出发,沿方向s(0)={-1,-2}T进行一维搜索,最优步长因子为()。

(1 分)A. 10/16B. 5/9C. 9/34D. 1/26. 根据强度—应力干涉理论,可以判定,当强度均值μr大于应力均值μs时,则零件可靠度R的值()。

(1 分)A. 小于0.5B. 等于0.5C. 大于0.5D. 等于17. 图示三角形单元非节点载荷的节点等效载荷为()。

(1 分)A. F yi=-100KN F yj=-50KN F yk=0B. F yi=-80KN F yj=-70KN F yk=0C. F yi=-70KN F yj=-80KN F yk=0D. F yi=-50KN F yj=-100KN F yk=08. 在有限元分析中,划分单元时,在应力变化大的区域应该()。

c语言程序设计:现代方法(习题答案)

c语言程序设计:现代方法(习题答案)

勘误内‎容补充‎说明‎2010-‎09-29‎旸谷‎全书的s‎t dio.‎h文件名中‎间的.都应‎该是半角的‎后面无空格‎。

P‎63第14‎-15行,‎应缩进两个‎英文字母,‎代码段改为‎:if‎(lin‎e_num‎== M‎A X_LI‎N E) {‎lin‎e_num‎= 0;‎pag‎e_num‎++;‎}第2‎2-26行‎应为:‎i f (l‎i ne_n‎u m ==‎MAX_‎L INE)‎{‎l ine_‎n um =‎0;‎p age_‎n um++‎;} ‎第29‎-33行应‎该为:‎if (‎l ine_‎n um =‎= MAX‎_LINE‎){ ‎line‎_num ‎= 0; ‎page‎_num+‎+;}‎第3‎6-40行‎应该为:‎if (‎l ine_‎n um =‎= MAX‎_LINE‎){ ‎line‎_num ‎= 0; ‎page‎_num+‎+;}‎P7‎0倒数第4‎行前去掉项‎目符号,应‎该为代码行‎,且在{前‎另起一行。

‎P7‎4第18行‎和第29行‎的prin‎t f语句中‎,i前面漏‎掉一个,号‎。

P‎75第14‎行的pri‎n tf语句‎中,i前面‎漏掉一个,‎号。

‎P82第7‎行的/*签‎名的分号应‎该在*/的‎后面。

‎P120‎倒数第12‎行的:应为‎=。

‎P126正‎数第14行‎的is R‎1LLY应‎该是15 ‎R1LLY‎。

P‎133正数‎第7行的b‎后面漏一个‎分号。

倒数‎第8行的p‎r intf‎语句中的i‎f应为is‎。

P‎134第2‎行的pri‎n tf语句‎括号前多一‎个空格,括‎号中的:应‎为!。

‎P158‎第一个代码‎段中倒数第‎3和4行的‎p rint‎f语句结尾‎的分号前多‎一个空格。

‎P1‎73中间代‎码段的三行‎,每一条语‎句后面都漏‎了一个分号‎。

P‎176第一‎段代码第一‎行的最后多‎一个;。

第‎24行的结‎尾分号前多‎一个空格。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

3.用梯度法求下列无约束优化问题:MinF(X)=x12+4x22,设初始点取为X(0)={2,2}T,以梯度模为终止迭代准则,其收敛精度为5。

1)求初始点梯度▽F(X)
▽F(X)={2x1,8x2}T▽F(X(0))={4,16}T
(2)第一次搜索
|▽F(X(0))|=16.5,S(0)=- ▽F(X(0))/16.5=-{0.243,0.97}T
α(0)=2.157
X(1)=X(0)+α(0)S(0)={1.476,-0.923}T
▽F(x(1))={2.952,-0.738}T
|▽F(x(1))|=3.043<5.0
故满足要求,停止迭代。

最优点X*={1.476,-0.0923}T
最优值F(X*)=2.21
4.
5.
6.
用外点法求解约束优化问题:
()()12211221min ..0()0
f X x x s t
g X x x g X x =+=-≤=-≤ , 收敛准则:(1)
()0.10.01k k X
X εδ+-≤=,约束容限= 解:(1)利用外点法惩罚法构造无约束优化问题
()
(
)
12()22()212121(min ,()()
k k k x x X r
x x r x x r x +⎧⎪Φ=⎨++-+-⎪⎩可行域内)(可行域外)
(2)此例只是为了说明外点法的思路,用微分法求解上述无约束优化问题。

用极值条件求解:
在可行域内:偏导数不可能等于0,即可行域内无极值
在可行域外,令:
()2()11211
()2122
14()2012()0k k k r x x x r x x r x x x ∂Φ
=+-+=∂∂Φ
=--=∂
从上面两式解得 12()()2()
1
11
,
2(1)
4(1)2k k k x x r r r =-
=
-
++ 可见,对于不同的惩罚因子值,可以得到不同的极小点。

【令()
k r
→∞,即可得到原问题的最优解**(0,0),()0T X f X ==】
(3)取(0)(1)()()1,10k k k r r Cr r +===进行迭代计算,迭代结果如下:
(1)(1)(1)(2)(2)(2)(2)(1)(3)(3)(3)(3)(2)1(0.25,0.4375),()0.6875
10,(0.0455,0.0479),()0.0934,0.44100(0.00495,0.00498),()0.00993,0.059T T r X f X r X f X X X r X f X X X εε
==--=-==--=--=>==--=--=<当时,当时当时, 点(3)
X
满足点距收敛准则,同时,它在约束容限范围内,因此,终止迭代!输出结果
7.
已知一轴的危险断面上,同时作用有弯矩M 和转矩T ,如图所示。

弯矩M =(1.5×105±4.2×104)N·m ,转矩T =(1.2×105±3.6×103)N·m ,轴材料的抗拉强度为σb =N (μσb ,σσb )=(935MPa, 18.75MPa)。

设轴径d = N (μd ,σd ),其制造公差为±0.005μd 。

要求可靠度为R =0.9999,试设计该轴直径d 。

(注:当R =0.9999时,可靠性系数为u =3.719)
题3图
T
解:(1)计算给定参数的均值和标准差
轴径的标准差 d d d μμσ00167.0005.03
1
==
弯矩的均值和标准差5
105.1⨯=M μN·m ,3
102.44
⨯=M σN·m=1.4×104 N·m
因此有
()()mm N 104.1mm,N 105.1,78⋅⨯⋅⨯=M M σμ
转矩的均值和标准差5
102.1⨯=T μN·m ,3
106.33
⨯=T σN·m=1.2×103 N·m
因此有
()()mm N 102.1mm,N 102.1,68⋅⨯⋅⨯=T T σμ
(2)计算弯曲应力、扭转应力和合成应力
1)弯曲应力 W M =
σ,即()()()
W W M M σμσμσμσσ,,,= 式中,抗弯截面系数332
d W π
=
,从而
33098175.032
d d W μμπ
μ==
3
22
000492.0)00167.03(32
)3(32
d d d d d W μμμπ
σμπ
σ=⨯=
=
将弯矩和抗弯截面系数是的特征参数代入弯曲应力表达式,可得到弯曲应力的均值和标
准差为
3
9
3810527889.1098175.0105.1d
d μμμσ⨯=⨯= ()
()()()()
3
8
232
72
32
82
310428084.1098175.0104.1000492.0105.1098175.01
d
d
d
d
μμμμσσ⨯=
⨯+⨯=
2)扭转切应力 ()()
T
T W W T T T W T σμσμτ,,==
式中,抗扭截面系数W W T 2=,故
()()
3
300098.0,19635.0,d
d W W T T
μμσμ
= 将转矩和抗扭截面系数的特征参数代入扭转切应力表达式,可得到扭转切应力的均值和标准差为
3
83810111555.619635.0102.1d
d μμμτ⨯=⨯= ()
()()()()
3
6
232
6232
82
310836065.619635.0102.100098.0102.119635.01
d
d
d
d
μμμμστ⨯=
⨯+⨯=
3)合成应力计算。

根据变形强度理论知道,合成应力为223τσσ+=F
计算σ2:
()()σσσσσσμμσμσ2,,2
22==
代入数据有
()
⎪⎪⎭

⎝⎛⨯⨯=6166182
2
10363906.4,10334444.2,d d μμσμσ
σ
计算3τ2: ()()
τττττσμμσμτ2,3,3322
2== 代入数据有
()
⎪⎪⎭

⎝⎛⨯⨯=616618232
310506739.2,10120533.1,d d μμσ
μ
τ
τ
计算合成应力的平方 222
3τσσ+=F





值,计算可得:
()
⎪⎪⎭

⎝⎛⨯⨯=6176182
2
10371099.4,10454977.3,d d F
F
μμσμ
σσ 上式经正态分布的开方运算,即可得到合成应力的特征参数()
21
2F
F σ
σ=
32
1618
6172618109
855027.110441125.310371099.4210454977.34212
1d d d d F
μμμμμσ
⨯=⎪⎪⎭
⎫ ⎝
⎛⨯=⎪⎪⎪⎭⎫


⨯-⎪⎪⎭⎫ ⎝⎛⨯=
38
618
618
10177.110441125.310454977.32
1d d d F
μμμσσ
⨯=⎪⎪⎭
⎫ ⎝
⎛⨯-⨯= (3)代入联接方程计算可靠度R=0.9999的轴径尺寸
2
2F
b
F
b
u σ
σσ
σσσμμ+-=
即 2
382
39
10177.175.1810855027.1935719.3⎪⎪⎭

⎝⎛⨯+⨯-
=
d d
μμ
解得,
23.109=d μmm
轴径的标准差为
182.000167.0==d d μσmm
轴径的公差为 55.03=±=∆d d σmm
故可靠度要求为R=0.9999时,该轴直径应取为d=(110±0.55)mm 。

直径尺寸需要圆整。

相关文档
最新文档