




























































































Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!





























































































Numerical Methods in Finance
and Economics
Second Edition
Politecnico di Torino Torino, Italy
A JOHN WILEY & SONS, INC., PUBLICATION
Copyright 0 2006 by John Wiley & Sons, Inc. All rights reserved.
Published by John Wiley & Sons, Inc., Hoboken, New Jersey. Published simultaneously in Canada.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or^ authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4470, or on the web at www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-601 1, fax (201) 748-6008, or online at http:l/www.wiley.com/go/permission.
Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives or written sales materials. The advice and strategies contained herein may not be suitable for your situation. You should consult with a professional where appropriate. Neither the publisher nor author shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages. For general information on our other products and services or for technical support, please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic format. For information about Wiley products, visit our web site at www.wiley.com.
Library of Congress Cataloging-in-Publication Data: Brandimarte, Paolo. Brandimarte.-2nd ed.
Numerical methods in finance and economics : a MATLAB-based introduction / Paolo p. cm. Rev. ed. of: Numerical methods in finance. 2002. Includes bibliographical references and index. ISBN-10: 0-471-74503-0 (cloth)
ISBN-13: 978-0-47 1-74503-7 (Cloth)
Numerical methods in finance. 11. Title.
Printed in the United States of America. 10 9 8 7 6 5 4 3 2 1
Preface to the Second Edition
From the Preface to the First Edition
Part I Background
Contents
1 Motivation 1.1 Need for numerical methods 1.2 Need for numerical computing environments: why MATLAB? 1.3 Need for theory For further reading References
2 Financial Theory 2.1 Modeling uncertainty 2.2 Basic financial assets and related issues 2.2.1 Bonds 2.2.2 Stocks
xvii
xxiii
3 4
9 13 20 21
30 30 31 V i i
CONTENTS ix
2.8 An outlook on interest-rate derivatives 2.8.1 Modeling interest-rate dynamics 2.8.
For further reading References
Incomplete markets and the market price of risk
Part 11 Numerical Methods
3 Basics of Numerical Analysis 3.1 Nature of numerical computation 3.1.1 Number representation, rounding, and
3.1.2 Error propagation, conditioning, and
3.1.
Solving systems of linear equations 145 3.2.1 Vector and matrix norms 146 3.2. 3.2.
3.2.4 Tridiagonal matrices 3.2.
truncation
instability 141 Order of convergence and computational complexity 143
Condition number for a matrix 149 Direct methods for solving systems of linear equations
Iterative methods for solving systems of linear equations
3.3.1 Ad hoc approximation 3.3.2 Elementary polynomial interpolation 3.3.3 Interpolation b y cubic splines 3.3.
3.3 Function approximation and interpolation
Theory of function approximation b y least squares 3.4 Solving non-linear equations 3.4.1 Bisection method 3.4.2 Newton’s method 3.4.3 Optimization-based solution of non-linear equations 3.4.4 Putting two things together: solving a functional equation b y a collocation method
177
183
x CONTENTS
3.4.5 Homotopy continuation methods 204 For further reading 206 References 207
4 Numerical Integration: Deterministic and Monte Carlo Methods 4.1 Deterministic quadrature 4.1.1 Classical interpolatory formulas 4.1.2 Gaussian quadrature 4.1.3 Extensions and product rules 4.1.4 Numerical integration in M A T L A B 4.2 Monte Carlo integration 4.3 Generating pseudorandom variates 4.3.1 Generating pseudorandom numbers 4.3.2 Inverse transform method 4.3.3 Acceptance-rejection method 4.3.
Setting the number of replications
4.5.1 Antithetic sampling 4.5.2 Common random numbers 4.5.3 Control variates 4.5.4 Variance reduction b y conditioning 4.5.5 Stratified sampling 4.5.6 Importance sampling 4.6 Quasi-Monte Carlo simulation 4.6.1 Generating Halton low-discrepancy sequences 4.6.2 Generating Sobol low-discrepancy sequences For further reading References
Generating normal variates by the polar approach
4.5 Variance reduction techniques
5 Finite Diflerence Methods f o r Partial Digerential Equations 5.1 Introduction and classification of PDEs 5.2 Numerical solution by finite diflerence methods 5.2.1 Bad example of a finite diflerence scheme 295
209 21 1 212 214 219 220 221 225 226 230 233
235 24 0 244 244 251 252 255 260 261 267
269
281 286 287
289 290 293
xi; CONTENTS
6.4.3 Duality in linear programming 6.4.4 Interior point methods
6.5.1 Linear programming in M A T L A B
management 6.5.3 Using quadratic programming to trace evgicient portfolio frontier 6.5.4 Non-linear programming in M A T L A B
6.5 Constrained optimization in MATLAB
6.6 Integrating simulation and optimization S6.1 Elements of convex analysis S6.1.1 Convexity in optimization S6.1.2 Convex polyhedra and polytopes For further reading References
Part 111 Pricing Equity Options
7 Option Pricing b y Binomial and Thnomial Lattices 7.1 Pricing b y binomial lattices 7.1.1 Calibrating a binomial lattice 7.1.
7.1.
Pricing American options by binomial lattices
Putting two things together: pricing a pay-later option An improved implementation of binomial lattices
4 01 4 02 4 03
410
411 414 7.3 Pricing bidimensional options b y binomial lattices 41 7 7.4 Pricing b y trinomial lattices 422 7.5 Summary 425 For further reading 426 References 426
8 Option Pricing b y Monte Carlo Methods 429 8.1 Path generation 430
8.1.2 Simulating hedging strategies 435 8.1.3 Brownian bridge 439 8.2 Pricing an exchange option 443
8.1.1 Simulating geometric Brownian motion 431
CONTENTS xiii
8.3 Pricing a down-and-out put option 8.3.1 Crude Monte Carlo 8.3.2 Conditional Monte Carlo 8.3.3 Importance sampling Pricing an arithmetic average Asian option 8.4.1 Control variates 8.4.2 Using Halton sequences Estimating Greeks b y Monte Carlo sampling For further reading References
8.
9 Option Pricing b y Finite Diflerence Methods 9.
9.
Applying finite diflerence methods t o the Black- Scholes equation Pricing a vanilla European option b y an explicit method 9.2.1 Financial interpretation of the instability of the explicit method 481 Pricing a vanilla European option b y a fully implicit method Pricing a barrier option b y the Crank-Nicolson method
For further reading References
9.
9.
9.5 Dealing with American options
Part I V Advanced Optimization Models and Methods
10 Dynamic Programming 10-1 The shortest path problem 10.2 Sequential decision processes 10.2.1 The optimality principle and solving the functional equation 10.3 Solving stochastic decision problems b y dynamic programming 10.4 American option pricing b y Monte Carlo simulation 10.4.1 A M A T L A Bimplementation of the least squares approach
44 6 44 6 44 7 450 4 54 4 55 458 468 4 72
4 75
4 78
482
485 486 4 91 4 91
4 95 496 500
501
504
511
51 7
CONTENTS xv
Part V Appendices
Appendix A Introduction to MATLABProgramming 603 A.l MATLABenvironment 603
A.3 MATLABprogramming 616
Appendix B Refresher on Probability Theory and Statistics 623
A.2 MATLABgraphics 614
B.l Sample space, events, and probability B.2 Random variables, expectation, and variance B.2.1 Common continuous random variables B.3 Jointly distributed random variables B.4 Independence, covariance, and conditional expectation B.5 Parameter estimation B.6 Linear regression For further reading References
Appendix C Introduction to AMPL C. 1 Running optimization models in AMPL C.2 Mean variance eficient portfolios in AMPL C.3 The knapsack model in AMPL C.4 Cash pow matching For further reading References
Index
xviii PREFACE
at least acquainted with topics from Operations Research, such as stochastic programming and integer programming. Hence, the “and economic^" part of the title suggests potential use of the book as a complement, and by no means as a substitute.
The book has been reorganized in order to ease its use within standard courses on numerical methods for financial engineering. In the first edition, optimiza- tion applications were dealt with extensively, in chapters preceding those re- lated to option pricing. This was a result of my personal background, which is mainly Computer Science and Operations Research, but it did not fit very well with the common use of a book on computational finance. In the present edition, advanced optimization applications are left to the last chapters, so they do not get into the way of most financial engineering students. The book consists of^ twelve chapters and three appendices. 0 Chapter 1 provides the reader with motivations for the use of numerical methods, and for the use of MATLAB as well. 0 Chapter 2 is an overview of financial theory. It is aimed at students in Engineering, Mathematics, or Operations Research, who may be inter- ested in the book, but have little or no financial background. 0 Chapter 3 is devoted to the basics of classical numerical methods. In some sense, this is complementary to chapter 2 and it is aimed at peo- ple with a background in Economics, who typically are not exposed t o numerical analysis. To keep the book to a reasonable size, a few clas- sical topics were omitted because of their limited role in the following chapters. In particular, I do not cover computation of eigenvalues and eigenvectors and ordinary differential equations. 0 Chapter 4 is devoted to numerical integration, both by quadrature for- mulas and Monte Carlo methods. In the first edition, quadrature for- mulas were dealt with in the chapter on numerical analysis, and Monte Carlo was the subject of a separate chapter. I preferred giving a unified treatment of these two approaches, as this helps understanding their re- spective strengths and weaknesses, both for option pricing and scenario generation in stochastic optimization. Regarding Monte Carlo as a tool for integration rather than simulation is also helpful to properly frame the application of low-discrepancy sequences (which is also known un- der the more appealing name of quasi-Monte Carlo simulation). There is some new material on Gaussian quadrature, an extensive treatment of variance reduction methods, and some application to vanilla options to illustrate simple but concrete applications immediately, leaving more complex cases to chapter 8. 0 Chapter 5 deals with basic finite difference schemes for partial differ- ential equations. The main theme is solving the heat equation, which
PREFACE xix
is the prototype example of the class of parabolic equations, to which Black-Scholes equation belongs. In this simplified framework we may understand the difference between explicit and implicit methods, as well as the issues related to convergence and numerical stability. With re- spect to the first edition, I have added an outline of the Alternating Direction Implicit method to solve the two-dimensional heat equation, which is useful background for pricing multidimensional options.
a Chapter 6 deals with finite-dimensional (static) optimization. This chapter can be safely skipped by students interested in the option pric- ing applications described in chapters 7, 8, and 9. However, it may be useful to students in Economics. It is also necessary background for the relatively advanced optimization models and methods which are covered in chapters 10, 11, and 12.
0 Chapter 7 is a new chapter which is devoted to binomial and trinomial lattices, which were not treated extensively in the first edition. The main issues here are proper implementation and memory management.
a Chapter 8 is naturally linked to chapter 4 and deals with more advanced applications of Monte Carlo and low-discrepancy sequences to exotic options, such as barrier and Asian options. We also deal briefly with the estimation of option sensitivities (the Greeks) by Monte Carlo methods. Emphasis is on European-style options; pricing American options by Monte Carlo methods is a more advanced topic which must be analyzed within an appropriate framework, which is done in chapter 10.
a Chapter 9 applies the background of chapter 5 to option pricing by finite difference methods.
a Chapter 10 deals with numerical dynamic programming. The main rea- son for including this chapter is pricing American options by Monte Carlo simulation, which was not covered in the first edition but is gain- ing more and more importance. I have decided to deal with this topic within an appropriate framework, which is dynamic stochastic optimiza- tion. In this chapter we just cover the essentials, which means discrete- time and finite-horizon dynamic programs. Nevertheless, we try to offer a reasonably firm understanding of these topics, both because of their importance in Economics and because understanding dynamic program- ming is helpful in understanding stochastic programming with recourse, which is the subject of the next chapter.
a Chapter 11 deals with linear stochastic programming models with re- course. This is becoming a standard topic for people in Operations Research, whereas people in Economics are much more familiar with dynamic programming. There are good reasons for this state of the matter, but from a methodological point of view I believe that it is very