Academia.eduAcademia.edu

Computational Methods Option Pricing

AI-generated Abstract

The book delves into modern numerical techniques for option pricing, focusing primarily on finite difference and finite element methods. It seeks to address the computational complexities arising from the application of the Black-Scholes model and provides insights into how these methods can be utilized effectively for simulations in finance. The discussion is geared towards practical implementations while acknowledging the limitations and challenges associated with more traditional approaches such as Monte-Carlo and tree methods.

Computational Methods for Option Pricing This page intentionally left blank 1 F R O N T I E R S IN APPLIED MATHEMATICS The SIAM series on Frontiers in Applied Mathematics publishes monographs dealing with creative work in a substantive field involving applied mathematics or scientific computation. All works focus on emerging or rapidly developing research areas that report on new techniques to solve mainstream problems in science or engineering. The goal of the series is to promote, through short, inexpensive, expertly written monographs, cutting edge research poised to have a substantial impact on the solutions of problems that advance science and technology. The volumes encompass a broad spectrum of topics important to the applied mathematical areas of education, government, and industry. EDITORIAL BOARD H.T. Banks, Editor-in-Chief, North Carolina State University Richard Albanese, U.S. Air Force Research Laboratory, Brooks AFB Belinda A. Batten, Oregon State University Carlos Castillo-Chavez, Arizona State University Doina Cioranescu, Universite Pierre et Marie Curie (Paris VI) Marie Csete, Emory University School of Medicine Lisa Fauci,Tulane University Pat Hagan, Bear Stearns and Co., Inc. Jeffrey Sachs, Merck Research Laboratories, Merck and Co., Inc. Ralph C. Smith, North Carolina State University AnnaTsao, AlgoTek, Inc. BOOKS PUBLISHED IN FRONTIERS IN A P P L I E D MATHEMATICS Achdou.Yves, and Pironneau, Olivier, Computational Methods for Option Pricing Smith, Ralph C., Smart Material Systems: Model Development lannelli, M.; Martcheva, M.; and Milner, F.A., Gender-Structured Population Modeling: Mathematical Methods, Numerics, and Simulations Pironneau, O. and Achdou,Y, Computational Methods in Option Pricing Day, William H. E. and McMorris, F. R., Axiomatic Consensus Theory ;n Group Choice and Biomathematics Banks, H.T. and Castillo-Chavez, Carlos, editors, 8/oterror/sm: Mathematical Modeling Applications in Homeland Security Smith, Ralph C. and Demetriou, Michael, editors, Research Directions in Distributed Parameter Systems Hollig, Klaus, Finite Element Methods with B-Splines Stanley, Lisa G. and Stewart, Dawn L, Design Sens/tiV/tyAno/ys/s: Computational Issues of Sensitivity Equation Methods Vogel, Curtis R., Computational Methods for Inverse Problems Lewis, F. L.; Campos,].; and Selmic, R., Neuro-Fuzzy Control of Industrial Systems with Actuator Nonlinearities Bao, Gang; Cowsar, Lawrence; and Masters, Wen, editors, Mathematical Modeling in Optical Science Banks, H.T.; Buksas, M.W; and Lin.T, Electromagnetic Material Interrogation Using Conductive Interfaces and Acoustic Wavefronts Oostveen, Job, Strongly Stabilizable Distributed Parameter Systems Griewank,Andreas, Evaluating Derivatives:Principles andTechniques ofA/gor/thm/c Differentiation Kelley, C.T., Iterative Methods for Optimization Greenbaum.Anne, Iterative Methods for Solving Linear Systems Kelley, C.T., Iterative Methods for Linear and Nonlinear Equations Bank, Randolph E., PLTMC: A Software Package for Solving Elliptic Partial Differential Equations. Users'Guide 7.0 More, Jorge J. and Wright, Stephen J., Optimization Software Guide Rude, Ulrich, Mathematical and Computational Techniques for Multilevel Adaptive Methods Cook, L Pamela, Transonic Aerodynamics: Problems in Asymptotic Theory Banks, H.T., Control and Estimation in Distributed Parameter Systems Van Loan, Charles, Computational Frameworks for the Fast Fourier Transform Van Huffel, Sabine and Vandewalle, Joos, TheTotal Least Squares Problem: Computational Aspects and Analysis Castillo, Jose E., Mothemotico/Aspects of Numerical Grid Generation Bank, R. E., PLTMG: A Software Package for Solving Elliptic Partial Differential Equations. Users' Guide 6.0 McCormick, Stephen P., Multilevel Adaptive Methods for Partial Differential Equations Grossman, Robert, Symbolic Computation: Applications to Scientific Computing Coleman,Thomas F. and Van Loan, Charles, Handbook for Matrix Computations McCormick, Stephen F., Muhigrid Methods Buckmaster, John D., The Mathematics of Combustion Ewing, Richard E., The Mathematics of Reservoir Simulation Computational Methods for Option Pricing Yves Achdou Universite Denis Diderot Paris, France Olivier Pironneau Universite Pierre et Marie Curie Institut Universitaire de France Paris, France slam. Society for Industrial and Applied Mathematics Philadelphia Copyright © 2005 by the Society for Industrial and Applied Mathematics. 1098765432 I All rights reserved. Printed in the United States of America. No part of this book may be reproduced, stored, or transmitted in any manner without the written permission of the publisher. For information, write to the Society for Industrial and Applied Mathematics, 3600 University City Science Center, Philadelphia, PA 19104-2688. Library of Congress Cataloging-in-Publication Data Achdou.Yves. Computational methods for option pricing /Yves Achdou, Olivier Pironneau. p. cm.~(Frontiers in applied mathematics) Includes bibliographical references and index. ISBN 0-89871-573-3 (pbk.) I. Options (Finance)—Prices—Mathematical models. I. Pironneau, Olivier. II.Title. III. Series. HG6024.A3A26 2005 322.64'53'OI5l9--dc22 2005046506 EiHJlL is a registered trademark. To Juliette and Raphael Firm theory, assured significance, Appeared as frauds upon Time's credit bank Or assets valueless in Truth's treasury. From Sri Aurobindo 's epic, Savitri Contents List of Algorithms xiii Preface xv 1 Option Pricing 1.1 Orientation 1.2 A Brief Introduction to Options 1.3 Constant Coefficients. The Black-Scholes Formula 1.4 Monte-Carlo Methods " 1.5 Other Options 1.6 Complement: Binomial Trees 1 1 1 6 8 15 17 2 The Black-Scholes Equation: Mathematical Analysis 2.1 Orientation 2.2 The Partial Differential Equation 2.3 Mathematical Analysis of the Black-Scholes Equation with Local Volatility 2.4 Barrier Options 2.5 LeVy Driven Assets 2.6 Options on a Basket of Assets 2.7 Stochastic Volatility 23 23 24 3 Finite Differences 3.1 Finite Differences in Logarithmic Prices 3.2 Upwinding 3.3 Finite Differences in the Primitive Variables 3.4 Numerical Results 3.5 Which Variable Is Better? 3.6 Options on a Basket of Two Assets 3.7 An Asian Put with Fixed Strike 57 57 71 76 81 83 83 85 4 The Finite Element Method 4.1 Orientation 4.2 A Generic Problem 4.3 The Black-Scholes Equation with Local Volatility ix 27 43 44 46 48 95 95 96 104 x Contents 4.4 4.5 4.6 4.7 4.8 4.9 A Black-Scholes Equation Solver in C++ 107 A Transparent Boundary Condition 110 Levy Driven Assets 114 Programs for Two-Dimensional Cases 126 Programming in Dimension d > 2 141 High Dimensions: An Introduction to Galerkin Methods with Sparse Tensor Product Spaces 142 4.10 Appendix: The Full Program for Two-Dimensional Black-Scholes . . . .146 5 Adaptive Mesh Refinement 5.1 The Black-Scholes Equation and Some Discretizations 5.2 Error Indicators for the Black-Scholes Equation 5.3 Conclusion 5.4 A Taste of the Software 5.5 Results 5.6 Mesh Adaption for a Put on a Basket of Two Assets 5.7 Appendix: Proofs 151 152 156 159 159 165 172 174 6 American Options 6.1 Introduction 6.2 The Variational Inequality 6.3 The Exercise Boundary 6.4 Discrete Approximations to the Variational Inequality 6.5 Solution Procedures 6.6 Results 6.7 More Complex American Options 185 185 186 189 192 198 208 209 7 Sensitivities and Calibration 7.1 Introduction 7.2 Automatic Differentiation of Computer Programs 7.3 Computation of Greeks 7.4 An Introduction to the Calibration of Volatility 7.5 Finite-Dimensional Differentiable Optimization 7.6 Application: Calibration on a Basis of Solutions 7.7 Appendix 219 219 219 223 228 230 234 236 8 Calibration of Local Volatility with European Options 8.1 The Least Squares Problem 8.2 Which Space for TJ and Which Tychonoff Functional? 8.3 Existence of a Minimizer 8.4 The Gradient of J 8.5 The Discrete Problem 8.6 A Taste of the Program 8.7 Results 8.8 A Stochastic Control Approach 243 243 245 247 248 249 251 254 257 Contents 9 Calibration of Local Volatility with American Options 9.1 The Calibration Problem 9.2 A Penalized Problem 9.3 Necessary Optimality Conditions 9.4 Differentiability 9.5 Algorithm 9.6 Results xi 263 263 265 268 274 275 277 Bibliography 287 Index 295 This page intentionally left blank List of Algorithms Algorithm 1.1 Algorithm 1.2 Algorithm 1.3 Algorithm 1.4 Algorithm 1.5 Algorithm 1.6 Algorithm 1.7 Algorithm 1.8 Algorithm 3.1 Algorithm 3.2 Algorithm 3.3 Algorithm 3.4 Algorithm 3.5 Algorithm 3.6 Algorithm 4.1 Algorithm 4.2 Algorithm 4.3 Algorithm 4.4 Algorithm 4.5 Algorithm 4.6 Algorithm 4.7 Algorithm 4.8 Algorithm 4.9 Algorithm 4.10 Algorithm 4.11 Algorithm 4.12 Algorithm 4.13 Algorithm 4.14 Algorithm 5.1 Algorithm 5.2 Algorithm 5.3 Algorithm 5.4 Algorithm 5.5 Algorithm 6.1 GSL function calls Black-Scholes formula using the GSL Black-Scholes formula by a naive method Pricing by Monte-Carlo Gaussian function using the GSL Variance reduction by control variate European call by binomial tree Binary tree for an American put Euler explicit scheme Crank-Nicolson Time step Matrix assembly 1 Matrix assembly 2 Right-hand side CN-scheme Time step Matrix assembly Right-hand side Transparent boundary conditions An elementary program x CGMY 1 CGMY 2 Two-dimensional Black-Scholes Stochastic volatility Compressed sparse row storage Matrix-vector product Two-dimensional Black-Scholes Euler_scheme Time step Right-hand side Error indicator for the time mesh Refinement strategy Time step XIII 7 7 8 9 12 14 19 20 66 88 89 89 91 92 107 108 108 109 112 116 119 120 122 129 134 138 141 146 160 161 162 164 166 202 XIV Algorithm 6.2 Algorithm 6.3 Algorithm 7.1 Algorithm 7.2 Algorithm 7.3 Algorithm 7.4 Algorithm 7.5 Algorithm 7.6 Algorithm 7.7 Algorithm 7.8 Algorithm 7.9 Algorithm 7.10 Algorithm 7.11 Algorithm 8.1 Algorithm 8.2 Algorithm 8.3 Algorithm 9.1 List of Algorithms Free boundary localization Primal-dual active set algorithm Automatic differentiation AD AD++ A class for an unconstrained minimization problem Computation of the gradient by automatic differentiation Armijo's rule Auxiliary function for Armijo's rule Conjugate gradient with Armijo's rule The ddouble library for automatic differentiation The file ddouble.cpp An example of automatic differentiation Gradient Backward loop: Adjoint problem Formula (8.23) Backward loop for the adjoint problem 204 207 220 221 221 232 232 233 233 233 236 238 241 252 252 253 276 Preface Mathematical finance is an old science but has become a major topic for numerical analysts since Merton [97], Black-Scholes [16] modeled financial derivatives. An excellent book for the mathematical foundation of option pricing is Lamberton and Lapeyre's [85]. Since the Black-Scholes model relies on stochastic differential equations, option pricing rapidly became an attractive topic for specialists in the theory of probability, and stochastic methods were developed first for practical applications, along with analytical closed formulas. But soon, with the rapidly growing complexity of the financial products, other numerical solutions became attractive. Applying the Monte-Carlo method to option pricing is very natural and not difficult, at least for European options, but speeding up the method by variance reduction may become tricky. Similarly, tree methods are very intuitive and fast but also rapidly become difficult as the complexity of the financial product grows. Focusing on the Black-Scholes model, a partial differential equation is obtained by Ito's calculus. It can be approximated and integrated numerically by various methods, to which a very clear and concise introduction may be found in the book by Wilmott, Howison, and Dewynne [117]: the basic idea is to approximate the partial differential equation by a system of equations with a finite number of unknowns, which may be solved numerically to obtain a discrete solution. The discrete problems can be computationally intensive. The aim of this book is neither to present financial models nor to discuss their validity; we must be very modest in this perspective, since our expertise is not here. This book is not a recipe book either, and although we have tried to be broad, many financial products such as bonds are not covered. The purpose is rather to discuss some modern numerical techniques which we believe to be useful for simulations in finance. We are not going to dwell on Monte-Carlo and tree methods, because these have been studied very well elsewhere (see [60,116]). We essentially focus on the finite difference (Chapter 3) and the finite element methods (Chapter 4) for the partial differential equation, trying to answer the following three questions: • Are these methods reliable? • How can their accuracy be controlled and improved? • How can these methods be implemented efficiently? Several applications to financial products with programs in C++ are proposed. In this book, we stress the notions of error control and adaptivity: the aim is to control a posteriori the accuracy of the numerical method, and if the desired accuracy is not reached, xv xv i Preface to refine the discretization precisely where it is necessary, i.e., most often where the solution exhibits singularities. We believe that mesh adaption based on a posteriori estimates is an important and practical tool because it is the only existing way to certify that a numerical scheme will give the solution within a given error bound. It is therefore a road for software certification. Mesh adaption greatly speeds up computer programs because grid nodes are present only where they are needed; it is particularly important for American options, because the option price as a function of time and the spot price exhibits a singularity on a curve which is itself unknown. A posteriori error estimates are the subject of Chapter 5, and adaptive methods are also used for pricing American options in Chapter 6. Controlling the accuracy of a numerical method requires a rather complete mathematical analysis of the underlying partial differential equation: this motivates partially the theoretical results contained in Chapters 2 and 6. The Black-Scholes model is by many aspects too simple to fit the market prices, and several more elaborate models were proposed: • Assume that the volatility is itself a stochastic process [70, 110, 51 ]. This is discussed in Chapters 2 and 4. • Generalize the Black-Scholes model by assuming that the spot price is a Levy process [31]. We discuss the pricing of Levy driven options in Chapters 2 and 4. • Use local volatility; i.e., assume that the volatility in the Black-Scholes model is a function of time and of the prices of the underlying assets. In the latter case one has to calibrate the volatility from the market data, i.e., find a volatility function which permits one to recover the prices of the options available on the market. This means solving an inverse problem with a partial differential equation. Inverse problems are used in many fields of engineering: for instance, in the oil industry, people try to recover underground properties from seismic data. Such problems are usually ill-posed in the sense that a very small variation of the data may cause huge changes in the computed volatility. This unstable character of inverse problems is a well-known fact, and the best-known cure is least square with Tychonoff regularization: calling («,-),e/ the prices of a family of options available on the market, a the local volatility function, and (w«(cr)) ie / the prices computed with the local volatility model, the least squares approach solves the minimization problem where /C is a closed subset of a suitable function space W. This problem is ill-posed; the Tychonoff regularization replaces by where || • || is a suitable norm on W. One has to choose properly the space W, the set fC, and the norm || • ||. For that, one has to study first the sensitivity of the options' prices with respect to the local volatility. Here also the careful analysis of the partial differential equations and inequalities done in Chapters 2 and 6 proves useful. We discuss Preface xvii volatility calibration with European options and American options. To our knowledge, calibration with American options is not discussed elsewhere. We also treat computational methods in order to evaluate the Greeks, i.e., the sensitivity of the options' prices with respect to various parameters: for that, we describe the method of automatic differentiation of computer codes. We think that this idea is also new in the field of computational finance. The book is organized as follows: Chapter 1 contains an introduction to option pricing, and to the numerical methods not based on partial differential equations. Chapter 2 deals with the mathematical analysis of partial differential equations in finance: it is the cornerstone for the numerical analysis performed in the rest of the book. Chapter 3 contains the description and the numerical analysis of some finite difference methods. Chapter 4 is devoted to the finite element method: we insist on practical implementation rather than on numerical analysis. This chapter is a rather long one, since the finite element method is not too well known in finance. We apply the finite element method to many kinds of options, including Levy driven options, basket options, and the case where the volatility is also a stochastic process. We also survey recent works where partial differential equation based methods have been applied successfully for pricing options on baskets with several assets (say ten or twenty). In Chapter 5, we discuss a posteriori error estimates and adaptive mesh refinement. American options are studied in the separate Chapter 6, which goes from mathematical and numerical analysis to computational algorithms. Chapter 7 deals with the use of automatic differentiation of computer programs for evaluating the Greeks. It is also an introduction to the calibration of volatility. In Chapter 8, we describe two ways of calibrating the volatility with European options: the first one is based on least squares and Dupire's equation, and the second one uses techniques of stochastic optimal control. Finally, Chapter 9 is devoted to calibration with American options. This book is for anyone who wishes to become acquainted with the modern tools of numerical analysis for some computational problems arising in finance. Although some important aspects of finance modeling are reviewed, the main topic is numerical algorithms for fast and accurate computations of financial derivatives and for calibration of parameters. While some parts of this book are written at a graduate level, this book aims also at being useful to Ph.D. students and professional scientists in the field of finance. In particular it contains rigorous results on the mathematical regularity of solutions, on modern algorithms with adaptive mesh refinement, and on the calibration with European and American options which do not seem to be available anywhere else. In particular, we believe that adaptive methods are not popular enough in the field of computational finance and that promoting them is useful. Except in Chapter 1, the book deals mostly with partial differential equations. It goes from mathematical and numerical analysis to practical computational algorithms. It is application oriented and does not contain any theoretical development which is not used elsewhere for a practical purpose. The computer programs are given, partially in the book in order to point out the important ideas, fully on the web site www.ann.jussieu.fr/~achdou. They are written in C++ but do not require a thorough knowledge of the language. They run on most platforms. Our interest in this topic originated from a numerical challenge posed to us by Nicolas Di Ce'sare' and Jean-Claude Hontand at the bank Natexis-Banques Populaires. Later we xviii Preface offered two courses at the graduate level, one at University Pierre et Marie Curie (Paris 6) for students of numerical analysis wishing to know more about numerical mathematical finance, and the other at University Denis Diderot (Paris 7) for teaching numerical methods to students more familiar with finance and statistics. The book grew out of this experience. Being computational applied mathematicians we are indebted to a number of colleagues for their counseling in mathematical finance: H. Berestycki, R. Cont, J. Di Fonseca, L. Elie, N. El Karoui, D. Gabay, M. Lezmi, C. Martini, G Papanicolaou, C. Schwab, and A. Sulem. We thank also C. Bemardi for having revised part of the manuscript. The first author also acknowledges very fruitful cooperation with N. Tchou and B. Franchi. We have also borrowed some C++ classes from F. Hecht. Chapter 1 Option Pricing 1.1 Orientation After a brief introduction to options and option pricing, we briefly discuss two pricing methods which will not be used in the other chapters of the book: the Monte-Carlo simulations and the binomial tree methods. Since this book is devoted to deterministic techniques for partial differential equations in finance, we shall not dwell on these two methods; however, they are important alternatives used often in practice and so it is necessary to know them to appreciate the advantages (and limitations) of deterministic methods. 1.2 A Brief Introduction to Options 1.2.1 The European Vanilla Call Option Quoting Cox and Rubinstein [36], a European vanilla call option is a contract giving its owner the right to buy a fixed number of shares of a specific common stock at a fixed price at a certain date. The act of making the transaction is referred to as exercising the option: note that the owner of the option may or may not exercise it. • The specific stock is called the underlying asset or the underlying security. For simplicity, we will assume that the fixed number of shares is one. The price of the underlying asset will be referred to as the spot price and will be denoted by 5 or St. • The fixed price is termed the strike, the striking price, or the exercise price. We will often use the notation K for the strike. • The given date is termed the maturity date, the maturity, or the date of expiration. It will often be denoted by T. The term vanilla is used to signify that this kind of option is the simplest one: there are more complicated contracts, some of which will be described later. An option has a value. We wish to solve the following problem: is it possible to evaluate the market price Ct of the call option at time t, 0 < t < T? 1 Chapter 1. Option Pricing 2 For that, we have to make assumptions on the market: we assume that the transactions have no cost and are instantaneous and that the market rules out arbitrage; it is impossible to make an instantaneous benefit without taking any risk. Pricing the option at maturity is easy. If ST is the spot price at maturity, then the owner of the call option will make a benefit of (5j- — K)+ = max(£7 — K, 0) by exercising the option and immediately selling the asset. Thus, assuming that there is no arbitrage, the value of the call on the expiration date is 1.2.2 Option Pricing: The Black-Scholes Model Definitions. Before describing the model, let us recall very briefly some notions of probability: Let £2 be a set, A a or-algebra of subsets of £2, and P a nonnegative measure on £2 such that P(Q) = 1. The triple (£2, A, P) is called a. probability space. Recall that a real-valued random variable X on (£2, A, P) is an ,4-measurable realvalued function on £2; i.e., for each Borel subset B of R, X~1(B) e A Also, a rea/valued stochastic process (Xt)t>o on (£2, .4, P) assigns to each time t a random variable Xt on (£2, .4, P). The process Xt is continuous if for P-almost every u> € £2, the function f H-> X, (co) is continuous. More generally, it is possible to define similarly random variables and stochastic processes with values on separable complete metric spaces, for example, finite-dimensional vector spaces. Recall that afiltration Ft = (.4,)/>o is an increasing family of <r-algebras At\ i.e., for t > r, we have AT C At C A. The a -algebra At usually represents a certain past history available at time?. A stochastic process (X,),>o is Ft-adapted if for each t > 0, Xt is At-measurable. Following, e.g., [85], we will consider only filtrations Ft such that for all t > 0, At contains the set jV of all the subsets A e A with P(A) = 0. For a given stochastic process Xt on (£2, A, P), it is possible to construct a filtration Ft — (At)t>o by taking At as the smallest a-algebra such that Xr for all r < / and all the negligible subsets of A for P are At -measurable (we say that At is the a-algebra generated by (X T ) T <, and by A/")- The obtained filtration is called the natural filtration of the process Xt. For a filtration F, = (At)t>o, we call stopping time a random variable r with value in R+ U {+00} such that, for all t, the event {r < t} e At. For a filtration Ft(At)t>o, an F,-adapted stochastic process (Af,),>o is called a martingale if • E(|M,|) <+oo, • for all T < /, E(M,|Fr) = Mr. Notions on Ito's stochastic integral and stochastic differential equations are necessary for the following. We refer the reader, for example, to [79, 85, 104, 48]. The Black-Scholes Model. The Black-Scholes model [16, 97] is a continuous-time model involving a risky asset (the underlying asset) whose price at time t is 5, and a 1.2. A Brief Introduction to Options 3 risk-free asset whose price at time / is 5,°: the evolution of Sf is found by solving the ordinary differential equation where r ( t ) is an instantaneous interest rate. Setting S® = 1, we find that For simplicity, we suppose here that r is constant. The Black-Scholes model decomposes the return on the asset ^- as a sum of a deterministic term jjidt (hence ^JL is an average rate of growth of the asset price), called the drift, and a random term which models the price variations in response to external effects. More precisely, the Black-Scholes model assumes that the price of the risky asset is a solution to the following stochastic differential equation: where Bt is a standard Brownian motion on a probability space (£2, A, P), i.e., a real-valued continuous stochastic process whose increments are independent and stationary, with BQ = 0 P-almost surely, E(B/) = 0, and E(5r2) = t. It can be proved that, in the limit 8t ->• 0, the law of Bt+st — Bt is a Gaussian random variable with zero mean and variance St. We call Ft the natural filtration associated to Bt. Here at is a real process adapted to Ft. The number a, is called the volatility. It is assumed that 0 < g_ < at < a for all t e [0, T]. The accurate mathematical meaning of (1.1) can be found in [79, 85, 104,48]. For simplicity here, we assume that at is constant: at = a,Q<t<T. The value of 5, can be deduced from that of Bt by Pricing the Option. The Black-Scholes model yields a formula for pricing the option at t < T. There are many ways to derive formula (1.4)-(1.5). We choose to follow the arguments of Harrison and Pliska [67] (see also Bensoussan [12]), presented in the book by Lamberton and Lapeyre [85]: Girsanov's theorem tells us that there exists a probability P* equivalent to P such that the price 5, satisfies the stochastic differential equation where Wt — Bt + JQ ^-ds is a standard Brownian motion under P*. In other words, under probability P*, the discounted price St = Ste~rt satisfies dSt = aStdWt, so it is a martingale; see [79, 85,104,48]. Then, it can be proved that it is possible to simulate the option by a self-financed portfolio containing Ht shares of the underlying asset and H® shares of the risk-free asset, i.e., to find a pair of adapted processes H® and Ht such that 4 Chapter 1. Option Pricing and Then since arbitrage is ruled out, the option's price must be given by It is also possible to see that for a self-financed portfolio, one has This implies that //,° -f HtSt is a square integrable martingale under P", and from (1.3), we have The essential argument for proving that the option can be simulated by a self-financed portfolio is a representation theorem for Brownian martingales, which states that for every square integrable martingale Mt for the filtration F,, there exists an adapted process H, such that^M, = HtdWt andE*(/# r 2 dr) < +00. All the arguments above can be generalized when a, = cr(St, t) and when r, = r(r), with, for example, r and a continuous functions such that 5 h-> So-(S, t) is a Lipschitz regular function of 5 with a Lipschitz constant independent of t, and a is bounded from above and away from 0 uniformly in t, and the Black-Scholes formula is When the volatility at is a function of t and 5,, we will speak of local volatility. The Black-Scholes model with uniform coefficients is often too rough to recover the prices of the options on the market, so a current practice is to calibrate the volatility surface (5, t) (->• a(S, 0 to fit the market prices. Remark 1.1. The argument used in the original paper by Black and Scholes [16] and presented in the book by Wilmott, Howison, andDewynne [117] is slightly different. After postulating that Ct = C(St, t\ one constructs an instantaneously risk-free portfolio with one option and A, shares of the underlying asset: the choice of A, is called hedging. From ltd's formula, the hedging factor A, is shown to be Then one obtains a partial differential equation for C, with the infinitesimal generator of the Markov process St. Finally (1.5) is obtained. This remark shows why precisely computing the derivatives ofC is important. 1.2. A Brief Introduction to Options 1.2.3 _5 Other European Options European Vanilla Put Options. A wide variety of contracts can be designed. Analogous to the vanilla call options are the vanilla put options: quoting [36], a European vanilla put option is a contract giving its owner the right to sell a share of a specific common stock (whose price is St at time t) at a fixed price K at a certain date T. It is clear that the value of the put option at maturity is Using the Black-Scholes model for pricing the put option, we obtain The Put-Call Parity. Subtracting (1.7) from (1.5), we obtain that which yields since the discounted price e hr(T)dr St is a martingale under P*. The relation (1.8) is called the put-call parity. Dividends. Pricing options on assets which yield dividends will be discussed in Chapter 2. General European Options. Let Q° : R+ -> R+ be a function bounded on the bounded subsets of M+ and such that ^p is bounded as S -> +00. It is possible to design a contract that gives its owner the payoff Q°(Sr) at maturity T. The function Q° is called the payoff Junction. Following the arguments above, the value of this option at maturity is Q°(Sr), and at time t, 0 < t < T, the value of the option is For example, the cash or nothing call option, with strike K, is the right to buy the asset at the price ST — E if ST > K at. maturity T. The payoff function of this option is Q° (5) = Els>K. Similarly, the cash or nothing put option is the right to sell the asset at the price ST + E if ST < K at maturity T. Its payoff function is Q°(S) = E\S<KBarrier Options. A barrier option with payoff Q° and maturity T is a contract which yields a payoff Q°(Sr) at maturity T, as long as the spot price St remains in the interval (a(t), b(t)} for all time t e [0, T]. For simplicity, we assume that a and b do not depend on time. The option is extinguishable in the sense that its value vanishes as soon as St leaves the interval (a,b). With the Black-Scholes model, one obtains a formula for the option's price: where the expectation is computed under the risk neutral probability. Chapter 1. Option Pricing 6 European Options on a Basket of Assets. Consider a basket containing / assets, whose prices Sj,, i = 1, . . . , / , satisfy the system of stochastic differential equations where B\t,..., Bjt are 7 independent standard Brownian motions under probability P, and where the correlation coefficients p,)7 satisfy Pij = py,,, 1 < i < j < I. The process ,1+ * ?, (Bit + Y~V,,, }f pi j B n ) is a standard Brownian motion, so V £;/.A , For a function Q° : (IR+)7 —>• R+, the European option on this basket of assets of maturity T and payoff Q° can be exercised at t = T for a payoff of Q°(S\r, • •., 5/7-). As for the options on a single asset, it is possible to find a risk neutral probability P* under which the price of the option is 1.3 Constant Coefficients. The Black-Scholes Formula Calling Q(S, t) thepriceof an option with maturity T and payoff function Q°, and assuming that r and a are constant, the Black-Scholes formula is and since under P*, WT — Wt is a centered Gaussian distribution with variance T — t, When the option is a vanilla European option (noting C the price of the call and P the price of the put), a more explicit formula can be deduced from (1.13). Take, for example, a call where 1.3. Constant Coefficients. The Black-Scholes Formula 7 Finally, introducing the upper tail of the Gaussian function and using the new variable x + a \/T — t instead of x, we obtain the Black-Scholes formula. Proposition 1.1. When a and r are constant, the price of the call is given by and the price of the put is given by where d\ and d2 are given by (1.15) and N is given by (1.16). Remark 1.2. Ifr is a Junction of time, (1.15) must be replaced by Remark 1.3. For vanilla barrier options with constant volatility, and when b = oo or a = 0 (see the paragraph on barrier options above), there are formulas similar to (1.17) and (1.18); see, for example, [117]. The Black-Scholes Formula Programmed with the GSL. There is a function in the GNU Scientific Library (GSL) [59] for computing N(d): it is based on approximate formulas that can be found in Abramowitz and Stegun; see [1]. The GSL is a very nice public domain package written in C for scientific computing. It includes programs for special functions, linear algebra, approximate integration, fast Fourier transform, polynomials and interpolation, random variables, etc. Here, we shall make use of two of these. ALGORITHM i.i. GSL function calls. int gsl_sf_erf_Q_e (double x, gsl_sf_result * result); double gsl_sf_erf_Q(double x); The program for computing a vanilla European call is as follows. ALGORITHM 1.2. Black-Scholes formula using the GSL. #include <iostream> #include<gsl/gsl_sf_erf.h> using namespace std; // file exactBSgsl.cpp // .' Call premium double Call(double S, double K, double r, double Vol, double theta) Chapter 1. Option Pricing 8_ // !S: Stock price -- K: Strike -- r: riskless interest rate // !Vol: volatility -- theta: time to maturity { if(S>0) { double standard_deviation= Vol*sqrt(theta); double dl = (log(S/K)+r*theta)/standard_deviation + 0. 5*standard_deviatiort; double d2 = dl - standard_deviation; return S*gsl_sf_erf_Q(-dl) - K*exp(-r*theta)* gsl_sf_erf_Q(-d2); } else return 0; } int m a i n { ) { cout«Call (111, 100, 0 .1, 0 .1,1) «endl;} On Linux machines (and cygwin and MacOS X) this is compiled, linked, and executed by g++ -c exactBSgsl.cpp g++ exactBSgsl.o -Igsl . . . /a.out Remark 1.4. The program below also computes the value of the Black-Scholes formula. Integrals are replaced by sums on quadrature points. The reader can check that this is much slower than with the GSL, which uses special Junctions. ALGORITHM 1.3. Black-Scholes formula by a naive method. double BSformula(double t, double S, double sig, double r, double K) { double dS=0.01, sig2=2*sig*sig*t, r2=r*t-sig2/4, aux=0; for(double Sp=0.001; Sp<500; Sp+=dS) aux += ((K-Sp)>0?K-Sp:0)*exp(-pow(log(Sp/S)-r2,2)/sig2)*dS/Sp; return aux * exp(-r*t)/sqrt(8*atan(l)*t)/sig; } 1.4 Monte-Carlo Methods For a complete survey of Monte-Carlo methods in finance, a good reference is the book by Glasserman [60]. The book by Lyuu [91] also contains a lot of practical information. 1.4.1 Numerical Random Variables In the C-library stdl ib. h, there is a function rand () which returns an integer value (of type long int) uniformly distributed in [ 0 , RAND__MAX]. To obtain a Gaussian random variable one does the following. 9 1.4. Monte-Carlo Methods First make the change of scale so that w e [0, 1]. Now let wi, W2 be two independent random variables uniformly distributed in [0, 1]; then is a Gaussian random variable N(0, 1) (with zero mean value, unit variance, and density 1 _*2 /— -j=-e i ). Therefore x\f8t may be used to simulate Wt+st — Wt. V2jr The C program (with a touch of C++) which uses these two ideas for S, and Ct is as follows. ALGORITHM 1.4. Pricing by Monte-Carlo. #include <iostream> ^include <math.h> ^include <stdlib.h> #include <fstream.h> using namespace std; const const const const const const const const int M=500; // nb of time steps of size dt int N=50000; // nb of stochastic realization int L=40; // nb of sampling point for S double K = 100; // the strike double left=0, right=130; // the barriers double sigmap=0.2, r=0.1; // vol., rate double pi2 =8*atan(l), dt=l./M, sdt =sqrt(dt), eps=l.e-50; double er=exp(-r); double gauss(); double EDOstoch(const double x, int m) ; double EDOstoch_barrier(const double x, int m, const double Smin, const double Smax); double payoff(double s) ; double gauss() { return sqrt (eps-2 . *log (eps+rand() / (double)RAND_MAX) ) *cos (randO *pi2/RAND_MAX) ; } double EDOstoch(const double x, int m) { double S= x; for(int i=0;i<m;i++) S += S*(sigmap*gauss()*sdt+r*dt); return S; } double EDOstoch_barrier(const double x, int m, const double Smin, const double Smax) { // gives S(x, t=m*dt) 10 Chapter 1. Option Pricing if ((x<=Smin)||(x>=Smax)) return -1000; double S= x; for(int i=0;i<m;i++) { if ( (S<=Smin) | | (S>=Smax)) return -1000; S += S*(sigmap*gauss()*sdt+r*dt) ; } return S; } double payoff(double s) { if(s>K) return s-K; else return 0,-} int main( void ) { ofstream ff ("stoch.dat"); for(double x=0. ;x<2*K;x+=2*K/L) { double value =0; double y,S ,for(int i=0;i<N;i++) // sampling values for x=S { S=EDOstoch(x,M); // S=EDOstoch_barrier(x,M, left, right); //for barrier options double y=0; if (S>= 0) y = er*payoff(S) ; value += y; } ff « x «"\t" « value/N « endl; } return 0; } The program stores the result in a file called stoch.dat in a format that gnuplot can use for graphics (see www.gnuplot.org). For barrier options, one has just to replace the line EDOstoch(x,M) ; by EDOstoch-barrier ( x , M , l e f t , r i g h t ) ; . In Figure 1.1, we have plotted the price of the vanilla call option with payoff K = 100 one year to maturity, as a function of ^. The prices have been computed using Algorithm 1.4. In Figure 1.2, we have plotted the price of the barrier vanilla call option one year to maturity with a = 0, b = 130 in Algorithm 1.4. Project 1.1. Adapt the Monte-Carlo program above to compute a basket option with two assets and run some tests. Implement one variance reduction method (see below) to speed up the program. One can estimate the accuracy of the Monte-Carlo method by using the law of large numbers. 11 1.4. Monte-Carlo Methods Figure 1.1. Computation of the call price one year to maturity by using the MonteCarlo algorithm above. The curve displays C versus S. It has been obtained from the file "stoch.dat," which contains the values shown in Table 1.1, by using the public domain program gnuplot (and the command plot "stoch .dat" w 1). Table 1.1. Content of the file stoch. dat generated by Algorithm 1.4. For clarity we have broken the single column into 5, so the numbers must be read left to right and down as usual. 0 0 0 0 0.00657661 0.0295531 1.54013 2.77273 13.1792 17.1289 35.0933 39.847 59.5088 64.5122 84.3937 89.3514 0 0 0.0975032 4.62055 21.1632 44.8094 69.5124 94.3428 0 0 0.298798 7.06252 25.7196 49.4797 74.3284 99.6568 0~ 7.02358e-05 0.748356 9.73593 30.1016 54.7059 79.4387 104.677 Theorem 1.2 (central limit). Let x be a random variable with probability density p, expectation E(JC), and variance The approximation satisfies, for all c\ < 0 < c%, where P(y e Y) stands for the probability that y belongs to Y. Chapter 1. Option Pricing 12. Figure 1.2. The price of a barrier vanilla call option one year to maturity (K = 100, a = 0, b = 130, a = 0.2, r = 0.1), computed by the Monte-Carlo method. 1.4.2 Random Variables Using the GSL Users should know that rand () is never perfect and that after many calls there is some periodicity in the answer. There are dedicated libraries which do a better and quicker job in the case of Gaussian variables. The GSL [59] implements a number of different functions to generate random variables. We give below a better implementation of the C-function gauss () by the GSL with a slight modification in that it returns a Gaussian variable of variance dt instead of variance 1. ALGORITHM 1.5. Gaussian function using the GSL. ttinclude <gsl/gsl_rng.h> ^include <gsl/gsl_randist.h> const gsl_rng_type *Tgsl=gsl_rng_default; gsl_rng_env_setup(); gsl_rng *rgsl=gsl_rng_alloc(Tgsl); double gauss (double dt) 1.4.3 { return gsl_ran_gaussian(rgsl, dt) ; } Variance Reduction From the central limit theorem we see that the accuracy of the Monte-Carlo method for simulating the expectation of X is controlled by ^/vai(X)/N. Thus the computing time for a given accuracy € behaves like vaJ}W. Therefore, any change of variables which decreases a will be valuable. There are several such transformations but no really general technique. 1.4. Monte-Carlo Methods 13 Control Variates. To compute E(X) with a better precision one may instead compute E(X - X ' ) , where X' is a random variable with E(X') known and var(X - X') < var(X). Indeed E(X) = E(X - X'} + E(X') and E(X - X') will be known with better precision. To achieve var(X — X') < var(X') one must choose X' "close" to X. The difficulty is to choose X'\ we present below a method proposed in Glasserman [60]. Obviously, the problem of estimating the mean X of a random variable X with variance var(X) can be shifted to that of estimating the mean Z of Z = X — b(Y — F), for a given constant b, and for any given random variable Y for which Y is known. A quick calculation shows that is minimized when where {X,-}7 (resp., {F,-1?) is a set of n samples of X (resp., Y}. Then To apply this idea to the pricing of a European vanilla call at time t = 0 by Black-Scholes formula (1.5), we take Let [SiY[ be n samples of ST obtained by integrating (1.1); then C0 = E*(X r ) = E*(Zr) with ZT = XT- b(YT - E*(Fr)), which yields As seen in Figure 1.3, the convergence of the Monte-Carlo method is much improved with b chosen as above, when K -C SQ, and not so much otherwise (see Glasserman [60]). Antithetic Variates. Consider the stochastic ordinary differential equation with a change of sign in the term containing the Brownian motion and the process f, given by Then Chapter 1. Option Pricing 14 Figure 1.3. Errors on the price of the vanilla call option one year to maturity (K = 100, r = 0.1,CT= 0.2) with the standard Monte-Carlo method and with variance reduction methods. because 5, and 5, have the same law, and since the function x \-> (x — K)+ is monotone and the two variables St and 5, are negatively correlated. Therefore we have obtained a new process with the same expectation and with a smaller variance. To simulate S~ one reuses the same random variables used for 5,, so the additional operation count is small. Note that this technique needs a monotone payoff function. A Program. The control variates (variable Y below) and the antithetic variates (variable Z below) are implemented and compared to the standard Monte-Carlo method. ALGORITHM 1.6. Variance reduction by control variate. int main( void ) { const int M=100; const int N=10000; // // nb of time steps of size dt nb of stochastic realization 1.5. Other Options 1_5 const int L=100; // rub of sampling point for 5 const double K = 100, sigmap=0.2, r=0.1; const double dt=l./M, sdt =sqrt(dt), er = exp(r); double X, Y, Z; ofstream ff("comp.dat"); for(double x=70.;x<130;x+=2*K/L) { double meanY=x*er, meanX =0,meanZ=0, barY=0; double varX=0, varY=0, Exy=0; for(int i=0;i<N;i++) { double Sl=x,S2= x; for(int ii=0;ii<M;ii++) { double y = sigmap*gauss()*sdt; 51 += SI*(y+r*dt); 52 += S2*(-y+r*dt); } Y = SI; Z =(phi_T(Sl)+phi_T(S2))/(2*er); X = phi_T(Sl)/er; meanX += X; meanZ += Z; barY+=Y; Exy+=X*Y; varX+=X*X; varY+=Y*Y; } meanX /=N; meanZ /= N; barY/=N; varX = varX/N - meanX*meanX; varY = varY/N-2*meanY*barY + meanY*meanY; Exy = Exy/N - meanX*barY; double b = Exy/varY, C=meanX -b*(barY-meanY); double exact = Call(x, K, r, sigmap, 1.); ff « x «"\t" « meanX-exact« '\t' « meanZ-exact «'\t' «C-exact «endl; } return 0; } 1.5 1.5.1 Other Options American Options An American vanilla call (resp., put) option is a contract giving its owner the right to buy (resp., sell) a share of a specific common stock at a fixed price K before a certain date T. More generally, for a payoff function Q°, the American option with payoff Q° and maturity T can be exercised at any t < T, yielding the payoff Q°(St). In contrast to European options, American options can be exercised anytime before maturity. Since the American option gives its owner more rights than the corresponding European option, its price should be higher. Consider, for example, an American vanilla put: if Pt were less than K — St, then one could buy a put and a share of the underlying asset and immediately exercise the option, making a risk-free immediate benefit of K — St — Pt > 0; this is ruled out by the no-arbitrage assumption, so we see that Pt > K — St. More generally, the value at time t of an American option with payoff Q° is always larger than Q°(St). 16 Chapter 1. Option Pricing Using the notion of strategy with consumption, the Black-Scholes model leads to the following formula for pricing an American option with payoff Q°: under the risk neutral probability, where 77,r denotes the set of stopping times in [t, T] (see [85] for the proof of this formula). For an American vanilla put, with a and r constant, this gives It can be seen that for an American vanilla call, the formula (1.25) coincides with (1.5), so American and European vanilla calls have the same price. This means that an American vanilla call should not be exercised before maturity. For a Monte-Carlo simulation of an American option, one performs the same type of Monte-Carlo simulation as for European options but then takes the sup for all times r e [t, T] so as to obtain a realization of Pt. Then by doing this N times and taking the average, one obtains Pt for one value of S. In practice this is quite expensive and one may prefer binomial trees (see below) or finite difference or finite element methods (see Chapter 6). Project 1.2. Program a Monte-Carlo method for American options. Study the influence of N: plot the results. Apply a method of variance reduction and program it (see, for example, Lapeyre and Sulem [87]| 1.5.2 Asian Options A typical example of an Asian option is a contract giving its owner the right to buy an asset for its average price over some prescribed period. Depending on how the average is computed, there can be many kinds of Asian options. For example, one can use arithmetic averaging or geometric averaging A simple example of an Asian option is the call (resp., put) with floating strike which gives its holder the right to buy (resp., sell) the underlying asset at A(T) at maturity T. At maturity, the price of the call (resp., put) option is (SV — AT)+ (resp., (Sr — AT}-). Another example is that of a call (resp., put) which gives its holder the right to buy (resp., sell) the underlying asset at K — AT + ST at maturity T, for a fixed strike K. At maturity, the price of the call (resp., put) option is (AT — K)+ (resp., (K — AT)-). Such an option is termed Asian option with fixed strike. More generally, for a function Q°\ M+ -> R+, it is possible to define the Asian option with payoff Q°(ST,AT). 1.6. Complement: Binomial Trees 17 The Black-Scholes model yields the formula for the price of the Asian option at time /, where the expectation is computed under the risk neutral probability. A Monte-Carlo simulation to price an Asian option with arithmetic averaging is as follows. • SQ given, set A — 0. • For(r = 0;t < T; t = t + 8t) - call the random generator to simulate Wt+&t - Wt; - compute St+st = S,(l + r8t + Wt+St - Wt); - doA = A + £(St + St+St). • Compute e~rTQ°(S, A). • Repeat the above to obtain M values and average them. Another class of Asian options involves the extremal values of the asset price for t < T: they are called lookback options. The floating strike lookback call has a payoff of (Sr — mino<T<r ST)+, whereas the lookback put has a payoff of (maxo<T<r ST — ST)+. Similarly, the fixed strike lookback call (resp., put) has a payoff of (maxo<T<r 5r — K)+ (resp., (K — mino^T^r Sr)+). One can also define lookback options on averages. For a function Q° : ]R+ -> R+, for m? = mino< r <r ST and Mj = maxo<r<r Sr, it is possible to define Asian options with payoff Q°(ST, AT, mT, MT), and the price of the option at t is 1.6 Complement: Binomial Trees The second most popular numerical method for pricing options is akin to Bellman's dynamic programming and uses a tree of possible events, the so-called binomial option pricing model. It leads to quite a good numerical method which is also easy to understand. 1.6.1 The Tree for S Consider the very simple situation where the underlying asset (i.e., Sn = St, t = n8t) can evolve in only two ways: • either it goes up by a factor u > 1: Sn+i = uSn with probability p, or • it goes down by a factor d < 1: Sn+i = dSn with probability 1 — p. So if we denote by S™ one of the possible values of 5 at stage n, at the next stage we can have 18 Chapter 1. Option Pricing Note that at n = 0, SQ is known; then at n = 1, Si € {wSo, ^-$b}, at {«2So, udSo, d2So} with probability p2, 2p(l — p), (1 — p) 2 , and so forth. At n = 2 the mean value of 5? is n — 2, 52 6 The factor 2 is because the middle state can be reached either by So -> U$Q ->• wdSo or by SQ -> dSo —>• udSo with the same probabiUty p(\ — p). Similarly, the variance of 52 is After N steps, we have the state &• = uN~jdj occurring with probability ( J N ) p N ~ j ( l - p)j, where (}N) = are the binomial factors. The problem now is to see what are the conditions necessary on d, u, p for Sn —^ 5, with t = nSt, N = T/St ->• CXD, and dS, = 5,(rd/ + adWt). Note first that the expectation of Sn+i knowing Sn is (up + d(\ — p})Sn, and its variance is When dS/ = S,(rd/ + ardWt), under the risk neutral probability P*, the mean and variance of 5, are SnerSt and S2le(-2r+a )St, and therefore it is necessary that r&t and We have two equations for three variables, so there remains to add a third arbitrary equation: a popular choice is which implies Another choice is which yields and 1.6. Complement: Binomial Trees 1.6.2 19 The Tree for C By definition, the price of the European vanilla call option can be approximated by Although (1.27) could be programmed directly, it is much faster to give a name to the intermediate states of S and C and use a backward induction relation. Let S™ = dmun-mS0 be the mth possible value of Sn. Then It is not difficult to see that Cn — (Sn — K)+ att = n8t also has only two possible changes, a growth or a decrease, and that a two-stage change "up-down" is the same as a "down-up." Thus let C™, m = 0 , . . . , n, be the possible values of Cn. Because C™ increases to C^1 with probability p or decreases to C™+1 with probability 1 — p, the expected value of Cn+\ knowing Cn = C™ is pC^ffto (1.5) is + (1 - p)C™ +1 , so the analogue Since the values C# are known from the payoff function, this recurrence can be used with decreasing n. Notice that it is not necessary to store all the intermediate values, and one can use the same memory for C™ and C™+1. ALGORITHM 1.7. European call by binomial tree. double binomial(const double SO) { double disc = exp(-r*dt); double u = (1+sqrt(exp(sigmap*sigmap*dt)-1))/disc; double d=(1-sqrt(exp(sigmap*sigmap*dt)-1))/disc, p = 0 . 5 ; S[0] = SO; f o r ( i n t m=l; m<M; m++) { for(int n=m; n>0; n - - ) S[n] = u*S[n-l] ; S[0] = d*S[0] ; } f o r ( i n t n=0,-n<M,-n++) C[n] = S[n] >K?S[n] - K : 0 ; for(int m = M - l ; m > 0 ; m - - ) f o r ( i n t n=0; n<m,-n++) C[n] = (p*C[n+l] + (l-p) *C[n] )*disc; return C [ 0 ] ; 20 Chapter 1. Option Pricing Figure 1.4. Results for the call price one year to maturity by using the binomial tree method with p = 0.5 and 500 time steps. The curve displays C versus S. It has been obtained by Algorithm \ .7. For comparison we have also plotted the results with a stochastic method using only 500 samples (the dashed line). void m a i n ( ) { for(int i=0;i<nx;i++) { double x = ( 2 . * K * i ) / n x ; cout « "C_0("«x«") = "«binomial (x) «endl; } } In Figure 1.4 we have plotted the price of a vanilla call option with strike K = 100 one year to maturity, as a function of the spot price. The prices have been computed by the binomial tree method of Algorithm 1.7. Remark 1.5. Note that the algorithm has O(M2) operations and can be slow for large M. There are implementations which are O(M) (see, e.g., [91]). Trees can be used for pricing American options; see [36, 117, 91]. The principle is the same but in the backward induction one must check that the expected profit is higher than the current one Soun~mdm. An American put can be implemented as follows. ALGORITHM 1.8. Binary tree for an American put. double binomial(const double SO) { double disc = exp(-r*dt); double u = (1+sqrt(exp(sigmap*sigmap*dt)-1))/disc; double d=(1-sqrt(exp(sigmap*sigmap*dt)-1))/disc, p=0.5; 1.6. Complement: Binomial Trees 21 S [ 0 ] = SO; urn [0] =1; d u [ 0 ] = l ; f o r ( i n t m = l ; m<M; m + + ) { f o r ( i n t n=m; n > 0 ; n - - ) S[n] = u*S[n-l] ; S [ 0 ] = d*S[0] ; um[m] =u*um[m-l] ; du [m] =d*du [m-1] /u; } for(int n = 0 / n < M ; n + + ) P[n] = S[n] > K ? 0 : K - S [ n ] ; for(int m=M-l;tn>0;m--) f o r ( i n t n = 0 ;n < m ; n + + ) { P [ n ] = (p*P[n+l] + ( l - p ) * P [ n ] ) *disc; double gain=K-SO*um[m]*du[n]; // pow(u,m-n) *pow(d,n) / i f ( P [ n ] < a u x ) P[n]=gain; } return P [ 0 ] ; } Notice that to save computing time, um and dm are precomputed and stored and u ~ d is written as um(d/u)n. There are ways to reduce the computing time by eliminations of trivial branches in the algorithms, but the method remains inherently O(M2), i.e., slow for large values of M. m n n Project 1.3. Study the influence of the choice ofp, u, d on the results. Plot a convergence curve for the Li-norm of the error as a function of St. Present the results of error estimations (search the literature, [87] in particular). Study the case of American options and adapt the programs to the case where a depends on S. Adapt the programs to the case of a dividend paying stock (see §2.3). This page intentionally left blank Chapter 2 The Black-Scholes Equation: Mathematical Analysis 2.1 Orientation The Black-Scholes model introduced in Chapter 1 gives the option prices as expectations of random variables computed from the solution to a stochastic differential equation. Ito's calculus allows the derivation of a partial differential equation of parabolic type for such mean quantities. We shall first recall how the partial differential equation associated to the Black-Scholes model is derived; then we shall study it in detail by variational methods and solve the following problems: • What are the conditions for the parabolic problem to be well-posed? • What are the qualitative properties of the solutions to the parabolic boundary value problems? In particular, is there a singularity at the origin 5 = 0? What is the regularity of the solutions? Is there a comparison principle between solutions to the partial differential equation? Next, we consider the price of a vanilla European option as a function of the strike K and of maturity T, for a fixed spot price: it turns out this function is a solution to a partial differential equation in the variables K and T, known as Dupire's equation [41]. We will use this equation later for calibration. The chapter ends with similar considerations for other options: • barrier options, • basket options, • options with stochastic volatilities, • options built on LeVy processes. The Black-Scholes model involves a risk-free asset whose price 5° satisfies the differential equation dS° = r(t)S°, and a risky asset under a probability P and a filtration Ft, whose price St satisfies the stochastic differential equation dSt = St(^dt + crdBt), where Bt is a standard Brownian motion. Here the volatility a may depend on time and on 23 24 Chapter 2. The Black-Scholes Equation the price of the underlying asset, i.e., a = a(St, /). We assume that the functions a(S, t) and r(0 are continuous nonnegative and bounded, respectively, on R+ x R+ and R+, and that S i-> Sa(S, /) is Lipschitz continuous with a constant independent of t, which ensure the existence and uniqueness of a square integrable 5,. As seen in Chapter 1, under the Black-Scholes assumption, there exists a probability P* equivalent to P (the risk neutral probability) such that W, = Bt + /0' ^-^-ds is a standard Brownian motion, and the price of a European option with payoff PQ and maturity T is given by (Ft is the natural filtration of Wt). In the case of vanilla calls and puts with constant interest rate r, we have 2.2 2.2.1 The Partial Differential Equation Infinitesimal Generator of the Diffusion Process It is possible to relate the function 0 in (2.1) to the solution of a parabolic partial differential equation. The operator corresponding to this partial differential equation appears in a natural way in the following result. Proposition 2.1. Assume that the functions cr(S, t) and r(t) are continuous nonnegative and bounded, respectively, on R+ x [0, T] and [0, T], and that S h-> Sa(S, t) is Lipschitz continuous with a constant independent of t. Then, for any function u : (5,0 (->• u(S,t) continuous in R+ x [0, T], Cl-regular with respect to t and C2-regular with respect to S in R+ x [0, T), and such that \Sj&\ < C(l + 5) with C independent of t, the process is a martingale under Ft, where L, is the differential operator The differential operator Lt is called the infinitesimal generator of the Markov process St. Proof. From the assumptions on r andCT,we know that 5, is a square integrable process, i.e., E*(S,2) < +00. Thanks to Ito's formula, 2.2. The Partial Differential Equation 25 which yields, from the definition of M,, Therefore, M, is a martingale, because from the assumptions on a and u, andE*(M r |F,) = Mr. Theorem 2.2. Assume that a and r are continuous nonnegative and bounded, and that S i-» Scr(S, t) is Lipschitz continuous with a constant independent oft. Consider a function P : R+ x [0, T] -» R, continuous in R+ x [0, T] and Cl-regular with respect to t and C2-regular with respect to S in R+ x [0, T), such that |S|j|<C(l+S) with C independent oft. Assume that P satisfies and then, with <f> given by (2.1), we have <j) = P. Proof. Aoolvine Pronosition 2.1 to u — P. the solution to (2.3X (2.4 Y we eet which is exactly the desired result. The problem (2.3), (2.4) is a backward-in-time parabolic boundary value problem, with a terminal Cauchy condition. Henceforth, we shall refer to (2.3) as the Black-Scholes equation. We are going to study in detail a weak formulation of the boundary value problem. Before that, we give some considerations on the asymptotics of the solutions to (2.3), (2.4) for large values of 5, and on the Black-Scholes equation written in the variables (log(S), ?)• 2.2.2 Vanilla Options: Behavior for Extremal Values of S We give here heuristic considerations which will be fully justified in §2.3. For simplicity, we assume that the interest rate r is constant. By construction we have that Furthermore if the financial model is reasonable, the call option should always be less than the underlying asset: Ct < St. Applied at S = 0 this gives C(0, t) = 0 for all t. Then the put-call parity implies P(0, t) = Ke~r(T~t}. On the other hand, when S is very large, the put option becomes useless, so we expect P(S, 0 to vanish as 5 -> oo, and by the put-call parity, C « S - Ke~r(T~t}. 26 Chapter 2. The Black-Scholes Equation From a mathematical point of view, it is important to understand that the behavior of P or C for small and large values of 5 need not be imposed in order to have a well-posed problem. We shall see later that along with the Black-Scholes partial differential equation, the terminal condition at T and a very weak growth condition for large values of S (namely, C(5, 0 is negligible compared to e*1^ (5) for any rj > 0) suffice to determine completely the price of the option. Similarly, in the numerical simulations, it will not be necessary to impose explicitly the value of the option at S = 0. 2.2.3 The Black-Scholes Equation in Logarithmic Prices We consider the vanilla European call. It is convenient to set Notice that So, for a call, (2.3) becomes The advantage of (2.7) is that it has constant coefficients, so we shall be able to recast it into the heat equation, after suitable changes of variables. We set <p(x, 0) = \lr(x, 6}eae+bx, with b = \ - £ and a = -r - ^b2. We obtain that \jr satisfies and the growth of ty at infinity is known thanks to (2.7). Therefore, because is the fundamental solution to (2.7). This representation formula is another way of obtaining (1.17). 2.3 Mathematical Analysis 2.3 27 Mathematical Analysis of the Black-Scholes Equation with Local Volatility We consider the Black-Scholes equation for a European option with a local volatility, i.e., a is a function of 5 and t, and with a variable interest rate. In this section, it will be convenient to replace the time variable t by the time to maturity T — t; doing so, we get a forward parabolic equation: for S > 0 and t e (0, T], with the Cauchy data where PQ is the payoff function. Remark 2.1. It is easy to see that for all a e R, b € R, the function P(S, t) = aS+ be~ fo r^dT is a solution to (2.9), and it is also clear that such a junction cannot satisfy the Cauchy condition (2.10) when PQ is not an affine function. Dividends. Discretely paid dividends cause jumps on the price of the underlying asset: if a dividend D is paid at time to maturity t, then the process S, satisfies because arbitrage is ruled out. On the other hand, the option price must not jump at t, because the option's owner does not get any benefit from the dividend, and because the dividend and date are known in advance. Therefore, the pricing function P(S, t) (here t is the time to maturity) should satisfy This means that the pricing function jumps at t: one has to integrate (2.9) in the time interval (0, t), implement the jump condition (2.11), and integrate again (2.9) till the next dividend. This means that, when using a discrete method to compute P with a subdivision (t{);€{O,...,M} of the time interval [0, T], then the date of a discretely paid dividend should coincide with some t{, so that (2.11) above can be implemented. Note that if, for each time t, the asset pays out a dividend q(t)Stdt in dt, then the equation becomes This equation is of the same nature as (2.9), and if q is sufficiently well behaved, then (2.12) does not imply any additional mathematical difficulties. Thus, in most cases, we will assume that q = 0, and that there are no discretely paid dividends. 28 Chapter 2. The Black-Scholes Equation Strong Solutions to (2.9), (2.10). The Cauchy problem (2.9), (2.10) has been very much studied: it is proved, for example, in [55] that if • the function (S, t) t->- Scr(S, t) is Lipschitz continuous on R+ x [0, T] (this condition can be weakened by considering only Holder regularity), • the function a (5, t) is bounded on R+ x [0, T] and bounded from below by a positive constant, • the function t (->• r(t) is bounded and Lipschitz continuous (this assumption can be relaxed), • the Cauchy data PQ satisfies 0 < Po(S) < C(l + 5) for a given constant C, then there exists a unique function P € C°(R+ x [0, T]), C1-regular with respect to t in R+ x (0, r] and C2-regular with respect to S in R+ x (0, T], which is solution to (2.9), (2.10) and which satisfies 0 < P(S, t) < C'(l + S) for a given constant C'. The function P is called a strong solution to the Cauchy problem. In what follows, we present the concept of weak solutions to (2.9), (2.10), which is fundamental for the development of many numerical methods presented in this book. General Orientation. In what follows, we are going to present mathematical results about the Cauchy problem (2.9), (2.10): the concept of weak solutions to parabolic equations, as in [90, 21], will be central. The idea behind it is that there is a natural energy associated to (2.9). This leads us to introduce a suitable Sobolev space (the space of functions for which the above-mentioned energy is defined), and to define the concept of weak solutions to (2.9), (2.10). Then the abstract theory of [90] will yield the existence and uniqueness of such a weak solution, yet without giving much information on its regularity. The next step will consist in obtaining regularity results depending on the regularity of the payoff function. We will also present the weak maximum principle, which will permit us to compare various solutions to (2.9), and to obtain bounds and qualitative results. For instance, the put-call parity will be proved as a consequence of the maximum principle. Finally, we shall treat the case of an option on a basket of assets, showing that the theory extends very naturally to this case. Note also that in addition to being a very general mathematical tool, the weak or variational formulation to (2.9), (2.10) will be the ground for the finite element method for the numerical approximation of (2.9), (2.10). 2.3.1 Some Function Spaces We denote by L2 (R+) the Hilbert space of square integrable functions on R+, endowed with thenorm||u||L2(K+) = ( j ^ v ( x ) 2 d x ) ^ and the inner product (u, uOz,2(R+) = L v(x)w(x)dx. Calling £>(R+) the space of the smooth functions with compact support in R+, we know that £>(R+) is dense in L2(R+). Let us introduce the space 2.3 Mathematical Analysis 29 It is clear that the functions of W vanish at x — 0. The space W endowed with the norm \\w\\w = ||^||L 2 (E+) is aHilbert space, whichis topologically isomorphic to L 2 (R+)- Thus W is separable. Lemma 2.3. The space £>(R+) is dense in W. Proof. Consider a function w e W: w(x) = f* (j)(s)ds, with 0 e L 2 (R+). We know that D(E+) is dense in L 2 (R + ), so we can find a sequence of functions (<pm)m^, <Pm € £>(R+), converging to 0 in L 2 (R + ). Therefore, the sequence (w m ) m€ N : Wm(x) = JQ <j>m(s)ds converges to w in W. The function wm is smooth but its support may not be compact in R+. Let us modify it slightly by introducing a smooth nonnegative function \fr on R+, with total mass 1, and supported in the interval (1,2), and by setting, for a small positive parameter e, (f)m € ( x ) = <j)m(x) — e\lf(€x} JR (f>m(s}ds: this function is contained in £>(R+) and its total mass is 0. Now, if wm^(x) = f* (f)m^(s)ds, and JTO \}s2(€s)ds < j, so choosing m large enough, then € small enough, ||u> — tu m i ellw can be made as small as desired. The result is proved. U Lemma 2.4 (Hardy's inequality). Ifw e W, then ^ e L 2 (R+), and Proof. From Lemma 2.3, it is enough to prove (2.14) forw e D(R+). Clearly, lljll^d^.) = L -^(/Q w'(s)ds)2dx, and integrating by parts, we obtain that where the last estimate comes from the Cauchy-Schwarz inequality. From Lemma 2.4, we can define the space V: It is clear that a function v e V is continuous on R+, for xv is continuous on [0, +00). Lemma 2.5. We have the identity where the derivative must be understood in the sense of the distributions on 30 Chapter 2. The Black-Scholes Equation Proof. A function v e L 2 (R+) satisfies xv e W if and only if £(xv) definition of W. This is equivalent to x^ e L 2 (R+) because e L 2 (R+), by the From Lemma 2.5, we can endow V with the inner product (v, w)v = (v, w) + (x j±, x^j), and with the Euch'dean norm \\v\\v = -V(v, v)v, and one can check easily that V is a Hilbert space. Lemma 2.6. TTze space ^(M+) is dense in V. Proof. A function v e V if and only if xv e W. Using Lemma 2.3, let (u; w ) m€N be a sequence of functions in 2?(R+) converging to xv in W. The functions vm = ^ belong to £>(R+), and converge to v in L 2 (R+) by Lemma 2.4. Furthermore, * ^ = ^ - ^. The first term of this sum converges to j^(xv) in L 2 (R+), whereas the second one converges to v in L2 (R+). Therefore, x *jf converges to x £ in L2 (R+). Lemma 2.7 (Poincare's inequality). I f v e V , then Proof. From Lemma 2.6, it is enough to prove (2.17) for v e £>(R+): we have Using the Cauchy-Schwarz inequah'ty on the left-hand side of this identity, we deduce that which yields the desired estimate. From Lemma 2.7, we see that the seminorm \v\v = ||^^||L2(R+) is m fact a norm on V, which is equivalent to || • ||y. In the same manner, using the density of T>(R+) in L2(R+), one can prove the following result. Lemma 2.8. I f w e L2(R+), then the function v, v(x) = j J^ w(s)ds belongs to V, and there exists a positive constant C independent of w such that \\v\\y < \\w\\ L2(R+). We denote by V the topological dual space of V. For simplicity, we also denote by (•, •) the duality pairing between V and V, and we define || • || y> by 2.3 Mathematical Analysis 2.3.2 31 The Weak Formulation of the Black-Scholes Equation Let us multiply (2.9) by a smooth real-valued function </> on R+ and integrate in S on R+. Assuming that integrations by parts are permitted, we obtain This leads us to introduce the bilinear form at, We make some assumptions on a and r: we assume that the coefficients a and r > 0 are continuous (only for simplicity), and that a is sufficiently regular so that the following conditions make sense. Assumption 2.1. 1. There exist two positive constants, g_ and Zf, such that for all t e [0, T] and all SeR+, 2. There exists a positive constant Ca such that for all t e [0, T] and all S e Lemma 2.9. Under Assumption 2.1, the bilinear form at is continuous on V; i.e., there exists a positive constant /u such that for all v, w € V, 32 Chapter 2. The Black-Scholes Equation Proof. If u, w € V, then using (2.17), (2.20), (2.21) and calling R = max f€|0 .r] r(0, which yields (2.22) with It is possible to associate with the bilinear form a, the linear operator A,: V -> V; for all v, w e V, (A,i>, w) = at(v, w). The operator A, is bounded from V to V. We define C°([0, T]; L 2 (R+)) as the space of continuous functions on [0, T] with values in L 2 (R + ), and L2(0, 7; V) as the space of square integrable functions on (0, T) with values in V. Assuming that PQ e L 2 (R+), and following [90], it is easy to write a weak formulation for (2.9), (2.10). Weak Formulation of (2.9), (2.10). Find P e C°([0, T}\ L 2 (R+)) n L2(0, T; V), such that |f e L2(0, 7; V), satisfying In order to apply the abstract theory of Lions and Magenes [90], we need the following estimate. Lemma 2.10 (Garding's inequality). constant X such that for all v e V, Under Assumption 2.1, there exists a nonnegative Proof. If v e V, then using (2.17), (2.20), (2.21) and calling R = max,e[0,r] r(f), where X = (R + a + Caa)2/(CT2). This achieves the proof. 2.3 Mathematical Analysis 33 Theorem 2.11. If PQ e L 2 (R + ), and under Assumption 2.1, ?/ze weak formulation (2.23), (2.24) /i«5 a unique solution, and we have the estimate, for all t, 0 < t < T, Proof. The proof is given in [90]. The estimate (2.26) is obtained by taking v = P(t)e in (2.24), using (2.25) and integrating in time between 0 and t. 2Xt Note that Theorem 2.11 applies for any European option with a payoff function in L 2 (R + ), in particular to vanilla puts. It does not apply to vanilla calls, and we will come back to this later. 2.3.3 Regularity of the Weak Solutions If the interest rate, the volatility, and the payoff are smooth enough, then it is possible to prove additional regularity for the solution to (2.23), (2.24). Calling At the unbounded operator in L 2 (R+), it can be checked that for all / e [0, T] and for A. given in Lemma 2.10, the domain of At + A. is Assumption 2.2. There exist a positive constant C and 0 < a. < 1 such that for all ti,t2 € [0, T] and S € M+, With Assumptions 2.1 and 2.2, it is possible to prove what is called a smoothing effect: the solution to (2.23), (2.24) belongs to D at any time t > 0, for any Cauchy data PQ € L 2 (R + ). More precisely, Assumptions 2.1 and 2.2 ensure that • the domain of A, is D, which is dense in L2(R+) and independent of t; • we have the Garding's inequality (2.25); • if At = At + A/, there exists a constant L such that With these three facts, we can apply a general result of Kato on parabolic evolution equations (see [98, Theorem 5.6.8] and [25]) and obtain the following result. 34 Chapter 2. The Black-Scholes Equation Theorem 2.12. Under Assumptions 2.1 and 2.2, for all s, 0 < / < T, the solution P of (2.23), (2.24) satisfies P e C°([t, T]: D) and %- e C°([t, T]: L2(R+)), and there exists a constant C such that for all t, 0 < t < T, If PQ € D, then the solution P of (2.23), (2.24) belongs to C°([0, T}\ D} and |f C°([0, T]- L 2 (R+)). € Remark 2.2. Note that for the second part of Theorem 2.12, it is possible to relax Assumption 2.2. Let us give a mild regularity result when PQ e V. Proposition 2.13. If Assumption 2.1 is satisfied and if PQ e V, then the solution to (2.23), (2.24) belongs to C°([0, T]; V) n L2(0, T; D), |f e L2(0, T; L2(E+)), anJ f/iere exists a nonnegative constant A. such that the estimate holds. Proof. Consider first the case when the coefficients of (2.9) satisfy Assumptions 2.1 and 2.2: calling <2 = ff and taking the derivative of (2.9) with respect to 5, one obtains in the sense of distributions and by multiplying by 5, we obtain with W = SQ which can be written in the shorter form where Bt is given by Under Assumption 2.1, Bt is a linear operator from V to V, bounded uniformly with respect to t, and it is possible to prove Garding's inequality: there exists a nonnegative constant A. such that, for all v e V, 2.3 Mathematical Analysis 35 Under the assumptions of Theorem 2.12, the terms in (2.33) belong to L 2 (0, T\ V), so it is possible to take the duality product with W(S, t}e~2Kt and to integrate in time. One obtains and using Garding's inequality, and the fact that W = S|j, we find (2.30), i.e., With some technical arguments that can be skipped, it is possible to prove that the estimate (2.30) holds if P0 e V and if the volatility satisfies only Assumption 2.1. Indeed, • D is a dense subspace of V so it is possible to approximate P0 in V by a sequence of functions Po,e e D; • forp>l large enough, it is possible to approximate the interest rate r by nonnegative smooth functions re, uniformly bounded and such that re -> r in Lp((0, T)); it is possible to approximate the volatility a by nonnegative smooth functions cre, obeying Assumption 2.1 uniformly and Assumption 2.2 with a constant C€, and such that ae -» a and Sf| -> Sff in Z/(o>), for all compact a> of E+ x [0, T] and for all p < +00. We call P€ the solution to the Black-Scholes equation with payoff PO,O interest rate re, and volatility a€. Thanks to (2.30), it is possible to extract a subsequence still called Pe that converges weakly * in L°°(0, T; V) and weakly in L2(0, T; D) and such that ^ converges weakly in L2(R+ x (0, T)). The limit satisfies (2.30) a.e. in t. On the other hand, by passing to the limit as e -> 0, one sees that the limit of Pe must satisfy (2.9) in the sense of distributions and (2.10). Therefore, the limit is the unique solution P to (2.23), (2.24). Remark 2.3. As a consequence of Proposition 2.13, the solution to (2.23), (2.24) is continuous if Assumption 2.1 is satisfied and PQ e V. Note that Proposition 2.13 and Remark 2.3 apply to a European vanilla put: indeed, 2.3.4 The Maximum Principle We are going to give a maximum principle for weak solutions of (2.9). The solutions of (2.9) may not vanish for 5 —*• +00. Therefore, we are going to state the maximum principle for a class of functions much larger than V; see [102] for a reference book on the maximum principle. We define Note that the polynomial functions belong to V. 36 Chapter 2. The Black-Scholes Equation We are going to use the truncation method of Stampacchia. With this aim, we define, for v € V, u+(S) = u(S)l,,(S)>oLemma 2.14. I f v e V , then v+ e V and %*(S) = ^(S)lv(S)>o- In the same manner u_(5) = -v(S)\v(S)<o and %^(5) = --g(S)l V (S)<oTheorem 2.15 (weak maximum principle). Let u(S, t) be such that for all positive numbers €, • ue-€l°z2(S+2) £ C°([0, T]- L 2 (R+)) n L2(0, T; V), . |^-elog2(S+2) € L 2 (R+ x (Q>r))> • M|»=O > Oae., • |^ + A,M > 0 fin f/ie .sen^e of distributions); then u >0a.e. Proof. Consider the function H(s) = ^s2, (its derivative is H'(s) = —s..), and for two positive parameters z and ^, the function wnere It is easy to see that V e C°([0, T7]; R), and for all t, \HO > 0. We have also ^r(O) = 0. belongs Assume that in this case, 2 Therfore to L (0, T; V) and is such that L^O, r;R)anda.e., Calling with we have 2.3 Mathematical Analysis 37 We choose two values Si < 1 and £2 > 1 such that, for S e (0, Si) U (£2, +00), 4rmax R+x|0 ,ri |cr2 + Saff - r < ±| log(S)|. We define Si = (0, Si) U (S2, +00) and <S2 = [Si,S 2 ]: But 4T maxs Then, for z large enough, we have for all x e V, with a > 0. With these choices of (, and z, (2.35) implies and for all t e [0, T], ^r(r) = 0, i.e., w > 0. Remark 2.4. /? is possible to generalize Theorem 2.15: /or example, with Assumption 2.1, consider the weak solution to (2.9), (2.10) given by Theorem 2.11, vwY/z PQ e £ 2 (^+) #«^ PO > 0. We /lave P > 0 a.e. and for that we do not need any further assumptions on ^, because we can approximate PQ by a smooth function PQ^ e V, use Proposition 2.13 then Theorem 2.15 for the solution to (2.9) with Cauchy data PQ,€, and finally pass to the limit as e ->• 0. 2.3.5 Consequences of the Maximum Principle Various Bounds. The maximum principle is an extremely powerful tool for proving estimates on the solutions of elliptic and parabolic partial differential equations. Proposition 2.16. Under Assumption 2.1, let P be the weak solution to (2.9), (2.10), with PQ € L2(E+) a bounded function, i.e., 0 < PQ < P0(S) < ~PQ. Then, a.e. Proof. We know that /V~ /or^dl and P0e~ /or(T)dT are two solutions of (2.9). Therefore, we can apply the maximum principle (see Remark 2.4) to both P — PQC~ -/or^dr and -fye-flr(r)dr _p fj 38 Chapter 2. The Black-Scholes Equation Remark 2.5. In the case of a vanilla put option: Po(S) — (K — S)+, and Proposition 2.16 just says that 0 < P(S, t) < Ke~ J°r(r)dr, which is certainly not a surprise for people with a background in finance. For the vanilla put option as in Remark 2.5, we have indeed more information. Proposition 2.17. Under Assumption 2.1, let P be the weak solution to (2.9), (2.10), -with P0(S) = (K- S)+: and Proof. Observe that the function Ke~ /o r ( T ) d r - S is a solution to (2.9) and apply the maximum principle to P(S, 0 - (Ke~ /d r^dT - 5). We have Ke~ /o r^d* - S < P(S, t Then (2.37) is obtained by combining this estimate with the one given in Remark 2.5. Remark 2.6. Note that we have not imposed (2.38) a priori. Similarly, when we look for discrete solutions either by finite differences or by finite elements, it will not be necessary to impose (2.38) as a boundary condition. The Super-Replication Principle. Take two European put options with the same maturity and two different payoff functions PQ and Q0. Call P(S, t) and Q(S, t) their respective prices, which both satisfy (2.9). One easy consequence of the maximum principle is that, if for all 5, P0(S) < Qo(S), then for all t and S, P(S, t) < Q(S, t). This is called the super-replication principle in the finance community. The Put-Call Parity. Take again a vanilla put option as in Remark 2.5, and consider the function C(5, /) given by From the fact that P and 5 - Ke~ Jor^>dT satisfy (2.9), it is clear that C is a solution to (2.9) with the Cauchy condition C(0, 5) = (5 - K)+. This is precisely the boundary value problem for the European vanilla call option. On the other hand, from the maximum principle, we know that a well-behaved solution (in the sense of Theorem 2.15) to this boundary value problem is unique. Therefore, we can deduce the price of the call option from that of the put option: we recover the put-call parity seen in Chapter 1 and also well known to people trained in finance. Convexity of P in the Variable 5 Assumption 23. There exists a positive constant C such that 2.3 Mathematical Analysis 39 Proposition 2.18. Under Assumptions 2.1 and 2.3, let P be the weak solution to (2.9), (2.10), where PQ e V is a convex function such that ^j$- has a compact support. Then, for all t > 0, P(S, t) is a convex function of S. Proof. Assume first that the coefficients of (2.9) also satisfy Assumption 2.2, and that PQ e P(R+), so by Theorem 2.12, Q = 520 e C°([0, T]; L 2 (R+)). Deriving twice (2.9) with respect to S, and multiplying by S2, Thanks to Assumptions 2.1 and 2.3, a maximum principle analogue to Theorem 2.15 applies, because Q satisfies (2.41) and Q\t=Q > 0. Therefore Q > 0, which says that jjr > 0 for all t e [0, T] and a.e. in S. To prove the result for nonsmooth coefficients and Cauchy data, we approximate PO by a smooth convex function with compact support, we approach the coefficients by ones satisfying Assumption 2.2, and we pass to the limit as in the proof of Proposition 2.13. D As a consequence, we see that under Assumptions 2.1 and 2.3, the price of a vanilla European put option is convex with respect to S, and thanks to the call-put parity, this is also true for the vanilla European call. Remark 2.7. The assumption of the compact support of ^^ in Proposition 2.18 can of course be relaxed. More Bounds. We focus on a vanilla put, i.e., the solution to (2.9), (2.10) with Po(S) = (K — S)+. It is possible to compare P with prices of vanilla puts with constant volatilities. Proposition 2.19. Under Assumption 2.1, we have, for all t e [0, T] and for all x > 0, where P_ (resp., P) is the solution to (2.9), (2.10) with a = g_, (resp., a). Proof. Consider the difference E = P — P. It satisfies £|,=o = 0 and because P is convex. Then, the maximum principle leads to the upper bound in (2.42) and the lower bound is obtained in the same manner. Localization. Again, we focus on a vanilla put. For computing numerically an approximation to P, one has to limit the domain in the variable S, i.e., consider only S e (0, S) for S large enough, and impose some artificial boundary condition at S = S. Imposing 40 Chapter 2. The Black-Scholes Equation that the new function vanishes on the artificial boundary, we obtain the new boundary value problem with the Cauchy data P(S, 0) = (K — S)+ in (0, 5). The theory of weak solutions applies to this new boundary value problem, but one has to work in the new Sobolev space The results in §2.3.1, §2.3.2, and §2.3.3 can be transposed to problem (2.43). The question is to estimate the error between P and P. For that, we use a version of the maximum principle adapted to (2.43), the proof of which is omitted for brevity. Proposition 2.20. Let u(S, t) be a function such that then u > 0 in [0, S] x [0, T]. Proposition 2.21. Under Assumption 2.1, the error max/e[0 r] Se[0,5] \P(S* 0 ~~ P(S, 01 decays faster than any exponential exp(-nS) (rj > 0) as S —*• oo. Proof. From Proposition 2.20, we immediately see that P > P in (0, 5) x (Q,T), because P(S, 0 > P(S, t) =_0._ On the other hand, from Proposition 2.19, P < P, which implies that P(S, f) < P(S, /). Call 7t(S) = max,e[0,r] P(S, t), and consider the function E(S, 0 = TT - P(S, t) + P(S, t). It is easy to check that the function E satisfies the assumptions of Proposition 2.20, so n(S) > P — P in [0, 5] x [0, T]. At this point, we have proved that But ;r(5) can be computed semiexplicitly by the Black-Scholes formula (1.18), and it is easy to see that for all rj > 0, lim^^ 7r(5)e'?'s = 0. Therefore, max/e[0<T]i5e[0,5] I P(S, 0 — P(S, 01 decays faster than any exponential exp(—^5) as 5 —> oo. 2.3.6 Du pi re's Equation We reproduce the arguments in [6]. 2.3 Mathematical Analysis 41 We consider a vanilla European call, subject to the Black-Scholes equation with local volatility, where we have supposed that the underlying asset yields a distributed dividend. Let us call G ( S , t , t j , T ) the Green's function, i.e., the solution to As a function of T and £, G satisfies the adjoint equation (see [55]) To obtain (2.46), it suffices to rewrite (2.45) in the abstract form where L(S, t) stands for the Black-Scholes operator. This implies that for any smooth function 0(5, t), ijs(f, T) compactly supported in R+ x R, and calling £(5, t) a solution to L(5, t)T$(S, 0 = 0(5, 0, we have On the other hand, From the two previous identities, we get that -Lr(£, T)G(5, t, £, T) - (Ss <8> <5,)(£, T), which is exactly (2.46). 42 Chapter 2. The Black-Scholes Equation The price of the call (solution to (2.44)) is given by the representation formula so it is possible to compute the derivatives of C with respect to K: From the adjoint equation (2.46), we deduce and integrating twice with respect to K, we obtain Following Dupire [41], we assume that all the terms on-the left-hand side of (2.50) decay when K tends to +00, so A(T) = B(T) = 0. We have obtained that fixing the date t and the spot price 5, the price of the European vanilla call satisfies the partial differential equation with respect to the strike K and the maturity T. This equation is a forward parabolic equation resembling very much (2.44). It is known as Dupire's equation in the finance literature. We shall see later that (2.50) is very useful when trying to calibrate the local volatility from the prices of options on the market. Indeed, if the options for all strikes and maturities were on the market, then C(K, T) would be known for all K and T, and the local volatility in (2.44) would be given by (2.51), and, at least formally, Dupire versus Black-Scholes. It is interesting to compare P (S, 0, K, T) as a function of K, obtained either by solving numerically Dupire's equation or the Black—Scholes equations (in the variables 5 and t) for different strikes K, for a given volatility function. To do so, we compute several vanilla European puts by solving the Black-Scholes equations (in the variables S and 0 for different values of K, and we plot K i-> P (S,0, K, T) and compare to the plot of the K h-> v(S, 0, K, T) solution to Dupire's equation (in the variables K and T); the results are shown in Figure 2.1. We see that there is a noticeable difference for large values of K, but this is due to the localization in Dupire's equation at K = 2S(K = 105, for instance, would have given a better result). In Chapter 4, we propose a better boundary condition for localizing, which applies when the local volatility is constant for large values of S. 2.4. Barrier Options 43 Figure 2.1. P(S, 0, K, 7") ver5W5 K (S is fixed) for a family of European vanilla puts with a constant volatility computed by Dupire's equation, the Black-Scholes formula, and finite differences for the Black-Scholes partial differential equation. 2.4 Barrier Options As seen in Chapter 1, barrier options are options for which the right to exercise disappears out of a subregion of IR+ x (0, T} (the option becomes worthless out of this region). The boundary of this region is called a knockout boundary. The knockout boundary may or may not depend on time. Consider the case when the boundary does not depend on time: for example, a double knockout option is an option (a put or a call) which becomes worthless if the price of the underlying asset either rises to an upper barrier $2 or falls below a lower value S\ > 0. In (Si, £2) x (0, T), the price of the option satisfies the Black-Scholes equation (possibly with local volatility), and we have the boundary conditions P(Sl,t) = P(S2,t) = 0. If the volatility is constant, then it is possible to compute the price P semiexplicitly by the method of the images (see Wilmott, Howison, and Dewynne [117], for instance). In other cases, numerical computation is needed, and one can rely on a weak formulation: calling £2 = (Si, S2), and defining which is a Hilbert space with the norm we can reproduce the arguments of §2.3.2, except that the space V is now defined as the closure of X>(£2) into V (where U(Sl} is the space of smooth functions with compact support in £2). 44 Chapter 2. The Black-Scholes Equation Note that if Si ^ 0 (i.e., no lower constraint), then called HQ(&) in the mathematical literature. On the contrarv. if Si = 0. then With these modifications, all the arguments in § 2.3.2 can be carried over to the present case. If the barrier depends on time, then the boundary value problem can be seen as a parabolic problem in a domain which is not a cylinder in R+ x (0, T). In the simple cases, the mathematical analysis of such problems can be done by finding a change of variables which maps the noncylindrical domain to a cylindrical one, but this is beyond the scope of the present book. 2.5 Levy Driven Assets To improve the modeling one may consider assets described by exponentials of Le'vy processes, i.e., processes that have stationary independent increments; see, for example, [26,43,42, 44, 92], the book by Cont and Tankov [30], and the references therein. For a Le'vy process Xt on a filtered probability space with probability P*, the LevyKhintchine formula says that there exists a function ty : R -> C such that and for a, or € R and a measure v on R* such that JK min(l, y 2 )v(dy) < +00. The measure v is called the Levy measure of X. We consider the price of a financial asset St modeled as a stochastic process on a filtered probability space with probability P. There exists an equivalent probability P* under which the discounted price is a martingale. If St is modeled as an exponential of a Levy process, we have, under P*, and the correction parameter c is chosen such that the mean rate of return on the asset is risk neutrally r, i.e., e(c+z^)f = E*(ex'). The fact that the discounted price is a martingale is equivalent to 2.5. Levy Driven Assets 45 and to We will assume also that L,,>{ e2yv(dy) < oo, so the discounted price is a square integrable martingale. Consider an option with payoff P0 and maturity T: its price at time t is and it can be proved, if the payoff function PQ is in the domain of the infinitesimal generator of the semigroup (see [13]) when a > g_ > 0, and [99, 33] without this assumption, that P is the solution to the partial integrodifferential equation We shall assume that the Levy measure has a density k(y)dy, so (2.56) becomes, replacing t by the time to maturity, Many choices are possible for k(y): • The variance Gamma processes where rjn and rjp are positive and r]p is smaller than 1/2. The CGMY processes are a generalization of the variance Gamma processes where 0<Y<2andO<G,2<M. A simpler choice is Merlon's model with Gaussian jump in log price with LeVy density (see [321) 46 Chapter 2. The Black-Scholes Equation If the volatility is positive, it is possible to develop a theory on weak solutions to (2.57); see [95]. We will not cover this in the present book. When the volatility is 0, it is also possible to use semigroups (see [95]), but depending on k the semigroup may not be analytic. In this case, the notion of viscosity solutions (see [37]) is useful (see [32, 33, 99]), and it is possible to prove that even with nonsmooth payoffs, the function given by (2.55) is a viscosity solution to (2.57). Remark 2.8. Of course, it is possible to consider options on Levy driven assets with barriers; see [33]. 2.6 Options on a Basket of Assets We focus on a basket (see §1.2.3) containing two assets, whose prices are 5i and 52, but all that follows can be generalized. We assume that the prices of the underlying assets obey a system of stochastic differential equations: where W\+t and W2t are two independent standard Brownian motions. For simplicity, we assume that a\ and 02 are positive constants, but generalization to functions a\(S\, S2, 0 and (72(5i, 52, 0 can be considered. The parameter p is the correlation factor: — 1 < p < 1. Also for simplicity, we assume that the interest rate r of the risk-free asset is constant. Consider a European option on this two-asset basket, whose payoff function is PQ (5i, 52). As for the options on a single asset, it is possible to find a probability P* under which the price of the option is One can apply the two-dimensional Ito's formula, and find the partial differential equation for the price of the option P(Si, S2, 0- replacing the time with the time to maturity, The tensor 3, is clearly positive definite. Exactly as for the one-asset case, it is possible to study the weak solutions of (2.61). Noting Q = R+ and introducing the Hilbert space 2.6. Options on a Basket of Assets 47 with the norm one can check the following properties: • The space T)(.Q) of smooth and compactly supported functions in Q is dense in V. • V is separable. • The serninorm | • \v defined by \v\2v = H^lrll^co) + H^lf-ll^g) is in fact a norm on V equivalent to || • \\v because ||u||i2 ( g) < 2\v\v. Among the usual payoff functions, we can cite, for a put, Note that the payoff functions given by (2.64) and (2.65) belong to L2(Q), which is not true if PQ is given by (2.66). In what follows, we are going to outline the theory of the weak formulation to (2.61), which applies for P0 e L2(Q). We introduce the bilinear form One can prove that there exist two positive constants g_ < a and a nonnegative constant X such that for all i>, w € V, and Assuming that P0 e L2(Q), the weak formulation of (2.61) consists in finding P e C°([0, T]; L2(Q)} D L2(0, T; V) such that ^f e L2(0, T; V), satisfying The machinery of §2.3.2 applies and it is possible to prove that if PQ e L2(Q), the problem (2.70), (2.71) has a unique solution P and we have the estimate, for all t, 0 < t < T, 48 Chapter 2. The Black-Scholes Equation Furthermore, analyzing the domain of the operator in (2.61), one can prove that • for all t > 0, P € C°([t, T]- D) n C l ( [ t , T}\ L 2 (Q)), where • if PQ € D, then P e C°([0, T]; D) n C'tfO, T]; L 2 (0)); • if PO e V, then P e C°([0, T]; V) n L2(0, T; D). Also, it is possible to prove a maximum principle analogue to Theorem 2.15. This is the main tool for establishing that if P0 is given by (2.64) or by (2.65), then P(Si, 0, r) = (Ke~rt - SO+ and P(0, S2, 0 = (/s^'7"' - S2)+. Naturally, there may be barrier options on baskets of several assets. For two assets and a barrier independent of time, pricing the option then amounts to solving the boundary value problem for a domain Si of R^_. We restrict ourselves to domains whose boundaries are locally the graph of Lipschitz continuous functions. Then, the Sobolev space to work with is the closure of T>(&) in the space (v e L 2 (ft); SI^T e L 2 (£2); 52^ € L2(Q)} equipped with the norm If the domain is complex, simulations need some efforts, and computing techniques enabling one to describe the domain, like the finite element method, must be used. 2.7 Stochastic Volatility We consider a financial asset whose price is given by the stochastic differential equation where fj,Stdt is a drift term, (Wt) is a Brownian motion, and (a,) is the volatility. The simplest models take a constant volatility, but these models are generally too coarse to match real market prices. A more realistic model consists in assuming that (cr,) is a function of a mean reverting Orstein-Uhlenbeck process: 2.7. Stochastic Volatility 49 where a, m, and ft are positive constants, and where (Z,) is aBrownian motion. As explained in [51], the law of Y, knowing F0 is A/"(m + (Y0 - m)e~al', £(1 - e~2at)}. Therefore, m is the limit of the mean value of Yt as t -> +00, and £ is the characteristic time of mean o2 reversion. The parameter a is called the rate of mean reversion. The ratio ^- is the limit of the variance of Yt as / -> +00. For convenience, we introduce the parameter v The Brownian motion Z, may be correlated with Wt: it can be written as a linear combination of (W,) and an independent Brownian motion (Z,), where the correlation factor p lies in [—1, 1]. Consider a European derivative on this asset, with expiration date T and payoff function h(Sj}. Its price at the time t will depend on t, on the price of the underlying asset St, and on Yt. We denote by P(S,, Y,, t) the price of the derivative, and by r(t) the interest rate. By using the no-arbitrage principle and the two-dimensional Ito's formula, it is possible to prove that there exists a function y such that the pricing function P satisfies the partial differential equation where with the terminal condition P(S, y, T) = h(S). The function y(S, y, t) can be chosen arbitrarily. The no-arbitrage argument can be summarized as follows: We look for the pricing function P by trying to construct a hedged portfolio of assets. It is not sufficient to hedge only with the underlying asset because there are two independent sources of randomness: dWt and dZt. So the idea is to take a self-financing hedged portfolio containing at shares of the underlying asset, one option with expiration date TI whose price is and bt options with a larger expiration date T2 > T\ whose price is The value of the portfolio is ct. The no-arbitrage principle yields that for t < T\, 50 Chapter 2. The Black-Scholes Equation The two-dimensional Ito formula permits us to write dP,(1) and dP,{2) as combinations of dt, dWt, and dZt. The left-hand side of (2.80) does not contain dZ, so From the last equation and since the left-hand side of (2.80) does not contain dW,, we have also Comparing the dt terms in (2.80) and substituting the values of a, and b,, we obtain that In the equation above, the left-hand side does not depend on TI and the right-hand side does not depend on T\, so there exists a function of g(S, y, t) such that Choosing to write g(S, y, t) = a(y — m) + y3A.(5, y, t) permits us to make the infinitesimal generator of the Orstein-Uhlenbeck process appear explicitly in the last equation and to obtain (2.78), so that as explained in [51], we can group the differential operator in (2.78) as follows: The premium term is the market price of the volatility risk: the reason to decompose A as in (2.79) is that, in the perfectly correlated case (| p \ = 1), it is possible to find the equation satisfied by P by a simpler no-arbitrage argument with a hedged portfolio containing only the option and shares of the underlying assets. In this case, the equation found for P is The term ^TT-T^ is called the excess return-to-risk ratio. 2.7. Stochastic Volatility 51 Finally, with (2.78), the Ito formula, and (2.79) so we see that the function y is the contribution of the second source of randomness dZ, to the risk premium. There remains to choose the function /. In [110], E. Stein and J. Stein have considered the case when but it is also possible to make other choices; see [51, 74]. A closed form for the price of a vanilla call has been given in [70] for /(y) = \y\ and A = Ay 2 . The partial differential equation is studied in [5,3]. Here, we focus on the case (2.83), and for simplicity we consider only p — 0. Note that only in the other case, we may have to impose in addition the condition where To obtain a forward parabolic equation, we work with the time to maturity, i.e., T — t ->• t. Also, in order to use a variational method, we make the change of unknown where rj is a parameter such that 0 < rj < 1, because it can be seen very easily that if (y-m) A = 0, then the function e ^ satisfies (2.78), and we want to avoid such a behavior for large values of y. The parameter rj will not be important for practical computations, because in any case, we have to truncate the domain and suppress large values of y. With the notation r(f) = r(T - t), y(t) = y(T - t), and A(0 = A(T - t) the new unknown u satisfies the degenerate parabolic partial differential equation 2 52 Chapter 2. The Black-Scholes Equation or, by expanding A and by denoting by Ct the linear partial differential operator A(u) we obtain We denote by Q the open half plane Q = R+ x R. Let us consider the weighted Sobolev space V: This space with the norm is a Hilbert space, and it has the following properties: 1. V is separable. 2. Calling T)(Q) the space of smooth functions with compact support in Q, T)(Q) c V and T>(Q) is dense in V. 3. V isdenseinL 2 (0. The crucial point is point 2, which can be proved by an argument due to Friedrichs (Theorem 4.2 in [58]). We also have the following lemma. Lemma 2.22. Let v be a function in V. Then so the seminorm is in fact a norm in V, equivalent to \ \ \ • \ \ |. We call V the dual of V. For using the general theory, we need to prove first the following lemma. 2.7. Stochastic Volatility 53_ Lemma 2.23. The operator v —> jSSff is continuous from V into V. Proof. Call X and Y the differential operators The operators X and Y are continuous operators from V into L2(Q) and their adjoints are Consider the commutator [X, Y] = XY — YX: it can be checked that Therefore, for v € V and w e T>(Q), and from (2.92), there exists a constant C such that To conclude, we use the density of T>(Q) into V. Lemma 2.23 implies the following proposition. Proposition 2.24. Assume that r is a bounded function of time and that y is bounded by a constant. The operator £,t is a bounded linear operator from V into V with a constant independent oft. We need also a Girding inequality. Proposition 2.25. Assume that r is a bounded function of time and that y is bounded by a constant P. Assume that a > ft; then there exist two positive constants C and c independent oft and two constants 0 < 771 < 772 < 1 such that, for rj\ < 77 < r\i and for any v e V, From Propositions 2.24 and 2.25, we can prove the existence and uniqueness of weak solutions to the Cauchy problem with (2.89). 54 Chapter 2. The Black-Scholes Equation Theorem 2.26. Assume that a > ft and that rj has been chosen as in Proposition 2.25. Then, for any u0 e L 2 (0), there exists a unique u in L 2 (0, T: V)nC°([0, T]\ L2(Q}), with |f e L 2 (0, T; V) such that, for a.e. t e (0, T), and The mapping UQ^U is continuous from L2(Q) to L2(0, T\ V) n C°([0, T]; L2(Q)}. v2 Remark 2.9. 77ze ratio |y w exactly the ratio between the rate of mean reversion and the asymptotic variance of the volatility. The assumption in Theorem 2.26 says that the rate of mean reversion should not be too small compared with the asymptotic variance of the volatility. This condition is usually satisfied in practice, since a is often much larger than al the asymptotic variance £-. It is possible to prove a maximum principle similar to Lemma 2.14: as a consequence, in the case of a vanilla put, we see that the weak solution to Theorem 2.26 yields a solution to (2.82) with a financially correct behavior. Proposition 2.27. Assume that the coefficients are smooth and bounded, and that a > ft. IfP0(S, y) = (K - S)+, then the Junction where u is the solution to (2.99), (2.100) with UQ = e(l l?)JL $~ P0, satisfies and we have a put-call parity. In [3], it is shown that the domain of Ct does not depend on t; more precisely, the following result is proved. Theorem 2.28. If for all t, r(t) > 0, the domain Dt of Ct does not depend on t: D, = D. Moreover, if there exists a constant TO > 0 such that r(?) > ro a.e., and if jjjj- > 2, 2 " then for well-chosen values of ri (in particular such that 2 jir)(\ — rj) > 1), Then we can prove stronger regularity results on the solution to (2.99), (2.100). 2.7. Stochastic Volatility 55 Theorem 2.29. Assume that there exists £, 0 < f < 1, such that y e Cf ([0, T], L°°(0) and r is a Holder function of time with exponent £. Assume also that r (t) > rofor a positive constant rg and that |y > 2. Then for rj chosen as in Proposition 2.25 and Theorem 2.28, i/UQ belongs to D defined by (2.102), then the solution of (2.99), (2.100) given by Theorem 2.25 belongs also to ^((O, T); L 2 (0) n C°([0, T]; D) and satisfies the equation for each t € [0, T]. Furthermore, for UQ e L2(Q), the weak solution of (2.99), (2.100) given by Theorem 2.26 belongs also to CI((T, T); L 2 (0)) n C°([r, 71]; D) for all T > 0 and we /uzve f^f ||f (OllL2(Q) + IIAM(OllL2( G ) < 7/or r > 0. Project 2.1. Adapt the Monte-Carlo program in §1.4 to compute 1. a European put with a stochastic volatility model; 2. a basket put option with two assets. Run some tests with realistic data in both cases. Implement a variance reduction method to speed up the program. This page intentionally left blank Chapter 3 Finite Differences Historically (see Lax and Richtmyer [88], Richtmyer and Morton [105], and Courant, Friedrichs, and Lewy [35]), the finite difference method is the first family of local methods for discretizing partial differential equations. Arguably, it can be attributed to Richardson in the beginning of the twentieth century. We are going to present several finite difference schemes for solving (2.9). There are many choices: 1. Should it be done in the actual price variable S or should we use the logarithmic price? 2. Should we use a method explicit in time? 3. Should the first order terms be upwinded? To answer these we must first make sure that the question is understood. So we introduce first the simplest explicit scheme, then discuss two implicit schemes. As we shall see, a uniform mesh in logarithmic price is not the most accurate and efficient choice, so we will introduce a third scheme in the primitive variable with different proofs. 3.1 3.1.1 Finite Differences in Logarithmic Prices Basic Estimates from Taylor Expansions Lemma 3.1. Let u be a C4 function defined on a closed bounded interval I o/R. Then, for z and h such that z, z + h, z — h e /, Proof. A Taylor expansion gives 57 58 Chapter 3. Finite Differences with 0,0' € (0, 1). Adding the two identities above, The conclusion is straightforward. Remark 3.1. It can be proved in the same manner that ifu is only C*-regular, then for and h such that z, z + h, z — h e I, Ifu is only C2-regular, then for all z in the interior of I, It is equally easy to establish the following result. Lemma 3.2. Let u be a C2 function defined on a closed bounded interval I ofR. Then, for z and h such that z, z + h e 7, and ifu is C*-regular, 3.1.2 Euler Explicit Scheme Performing the chanee of variables x = loe S.t = T — t. leads to an equation of the form We have seen in the previous chapter that this partial differential equation has a semianalytical solution (2.7) when the volatility and the interest rate are constant. Localization. For simplicity, we assume that r and a are smooth functions, asymptotically constant when x is large. Consider, for example, a put of strike K. Let XQ be a real number such that — XQ <3C log K <3C XQ and let ty(x, t) be a function such that 1. ifr(x,t) = Ke-&r(T}dr - ex in [-00, -*0] x [0, T], 2. ifr(x, 0 = 0 in [JCQ, oo] x [0, T], 3. \ff is smooth. 3.1. Finite Differences in Logarithmic Prices 59 Setting <p = u — \js, one obtains and lim^i^oo (p(x, t} — 0, with a fast decay (see Proposition 2.21 for a partial justification). This permits us to truncate the domain in the variable x. Choose x > XQ, and consider the boundary value problem Discretization with the Euler Explicit Scheme. Given two positive integers N and M, we set h = -j^ and At = |^, and we consider the real numbers The points (Xj, tm) are the nodes of a uniform grid in the rectangle [—x, x] x [0, T]. Using Lemmas 3.1 and 3.2, we may consider the explicit scheme: Find<p™, m e {1,..., M}, j e {1,..., N}, such that for 0 < m < M, 1 < j < N, and where a™ = a(Xj, tm), P? = P(xjt O, rm = r(tm), and ff is either f ( X j , tm) or an approximation of it. It is crucial to understand that the value <p™ is not (p(Xj, tm); it is an approximation of <p(*j, tm} for well-chosen values of parameters h and At. For 0 < m < M, the values {(pf+l}o+1 can be computed from (3.7) in an explicit manner from {^?}^+1. This is why this scheme is called an explicit scheme. Abstract Results on Finite Difference Schemes. Let us reformulate what we have done so far in a general abstract setting with the following notation: let us call the operator which maps a function 0 to its values at the nodes of the grid, the boundary value problem (3.6), and the space of unknowns after discretization. 60 Chapters. Finite Differences We write the discrete system (3.7). SoQh.&t is obtained by taking the values of Q at (N + 2) x ( M + l ) points related to the nodes of the grid: Qh,At — Ih,At(Q)Remark 3.2. In the case of the boundary value problem (3.6), and With the Euler explicit scheme (3.7), (3.8), £/,,A, = /A,A/(£) = (,?7)o<;<A'+i,o<m<Af. where and Definition 3.3. The scheme £h,At(<Ph,&t) = h,&t(G} is said to be consistent for approximating C((p} = Q if there exists a functional space W (containing smooth functions oft and x), such that Ih, A/ and //,, Ar ° £ are well defined on W and, for all </> € W, The error £^,A/ ° J/J.AJ (</>) — A,Ar ° £(#) is called the consistency error of the scheme. If the scheme is consistent, let kt and kx be the largest nonnegative numbers such that, for any smooth function 0, there exists a positive constant C(0) with then the scheme is said to be of order kx with respect to the variable x, and kt with respect to the variable t. Definition 3.4. We denote by \\ • \\ a family (depending on M and N) of norms on £ A;A ,(<p AjA ,) = Ih,&t(G) is said to be stable with respect to the norms \\ • \\ if there exists a constant C independent ofh and At such that ||£^A, || < C. K (#+2)x(M+i) The scheme 3.1. Finite Differences in Logarithmic Prices 61 Definition 3.5. The scheme £/,, A/(#>/,, Ar) = lh^t(Q) is said to be convergent with respect to the norms II • II if provided <p is smooth enough. Theorem 3.6. Denote by \\ • \\ a family (depending on M and N) of norms on ]j£( Ar + 2 ) x ( M + 1 ) ) such that || • || < C|| • \\ocfor a constant C independent of M and N. If the scheme A,Ar(<Pfc,A/) = Ih,&t(G) is consistent and stable with respect to the norms || • ||, then it is convergent. If the scheme £/,,A/(<P/Z,A?) — Ih,&t(G) is of order k, (resp., kx) with respect to t (resp., x) and stable with respect to the norms \\ • \\, and if(p is smooth enough, then for a constant C(cp) independent ofh and Af, Proof. Calling £h,At the consistency error for <p, we have (ph,At ~ h,&t(<P) — £/j Ar&.A*The stability of the scheme implies that \\(ph,At — Ih,&t(<P)\\ < ll£/i,Arll for a constant C independent of h and At. The consistency of the scheme tells us that for <p smooth enough, linift^.o,Ar->o ll£/i,Arll = 0- The previous two observations yield the convergence. The proof of the second assertion is done in the same manner. D Consistency of the Euler Explicit Scheme. Calling €™ the entries of the consistency error £h A/ » we have From Lemmas 3.1 and 3.2, we know that if <p e C°([0, T]; C4[-x,x]) UC 2 ([0, T]; C°r-jc, jcl), then Therefore, the Euler explicit scheme is of order one with respect to t and of order two with respect to x. Stability of the Euler Explicit Scheme. For simplicity, we focus on the case when the coefficients cr, ft, and r are constant. The general case will be treated completely in §3.3. Let us consider a family of norms || • || on R^+2, such that, for a constant C independent of 62 ChapterB. Finite Differences Af, || • || < C\\ • Hoc. For this norm, we define the norm || • || on R<tf+2)x<M+i). From the proof of Theorem 3.6, we have to estimate \\Ch A ,£/,,A/ll» and since 6™ = e^+1 = e°=0, 0 < m < Af, 1 < j < N, it is enough to find a condition on A/ and h such that with V°A, = {V € V/,,A/; u™ = <+1 = y°=0, 0 < m < M, 1 < j < N}, holds for a constant C" independent of At and /z. Notation. For V e V^0A/\{0}, let us call We have where A e R yvxyv is the tridiagonal matrix With the notation defined above, Lemma 3.7. For all V e Vf^t\[Q}, we have, for U = C^V, Recall that we have, for any matrix B € RN*N, where p(B) is the spectral radius of B, i.e., and where ||fi|| = supVeRAr ^p^- From the previous lemma, we see that a necessary condition for (3.11) is that p(l — At A) is less than or equal to 1. It is possible to find the spectrum of the matrix A as follows. 3.1. Finite Differences in Logarithmic Prices 63 Lemma 3.8. / / f t ^ —qr-, we have Remark 3.3. As a consequence of Lemma 3.8, we see that if a2 = 2, ft — 0, r = 0, ?/ien ?/ze matrix A is symmetric and we have the discrete Poincare inequality Theorem 3.9. For the scheme to be stable in norm \\ • \\, a necessary condition is that or Proof. From (3.13) and Lemma 3.8, we see that, if ^- > ft, ||/-AfA|| > p ( l - A f A ) = max | l - A f A . / | /=!,..., N Therefore, from Lemma 3.7, a necessary condition for (3.11) is that ||7 — Af A|| < 1, and we obtain (3.16) in the case 2- > \ft\. Thus, Therefore, a necessary condition for (3.11) is (3.17). If 2- = | ft |, the matrix A has one eigenvalue, r + p-, so the claim holds in this case. Remark 3.4. The condition (3.16) was first found by Courant, Friedrichs, and Lewy [35] for similar problems. For that reason, it is classically called a CFL condition. 64 Chapters. Finite Differences The CFL condition (3.16) is quite restrictive. Indeed, it says that for small values of h, At must scale like h2, which means that the number of time steps must scale like the square of the number of steps in the *-direction. In practice, the CFL condition is responsible for very long CPU times when refining the grid in the ^-variable. For this reason, explicit schemes are seldom used for parabolic problems, except when the dynamic of the solution is very fast and justifies a very fine time discretization. We have given a necessary condition for stability. To find a sufficient condition, we have to compute or estimate the norm || / — At A \\. For example, if we choose for the norm in R^"1"2: -4= || • ||2, then we have to estimate ||7 — AtA\\2'. we see that and we see that if At is small enough compared to h2, then ||7 — AfA||2 < 1, so the CFL condition gives the correct scaling for a sufficient stability condition. Note that it is possible (but really tedious) to compute exactly ||7 — Af A||2, since ||7 — AMU 2 , = p((I — At A)T(I - At A)), and (7 — Af A) r (7 — AtA) is a pentadiagonal matrix with constant coefficients on the diagonals (except for the first and last diagonal coefficients), so a necessary and sufficient stability condition in the norm || • \\2 can be derived. Remark 3.5. Note that if ft = 0, then the matrix A is symmetric, and we have ||7 — A f A | J 2 = p (I — At A), so the necessary condition (3.16) is also sufficient for the stability in the 2-norm. Remark 3.6. Replacing rm<p™ by rm+1<p™+l in (3.7) still enables us to compute <p™+l in an explicit manner. This choice improves (often only slightly) the stability of the scheme. Convergence. From (3.9) and Theorem 3.9, we see that if the stability condition (3.11) holds and if <p is smooth enough, i.e., if <p e C°([0, T]; C4([-x, *]))nC2([0, T]; C°([-Jc, *])), then Note that, for vanilla options, for example, <p cannot be so regular, because <po does not even belong to C2([—Jc, Jc]). In order to obtain the convergence, one must first approximate (po by a smooth function (fa (such that <PQ(±X) = 0), then solve the boundary value problem For each 6 > 0, one can choose (fa in order to have 3.1. Finite Differences in Logarithmic Prices Then one approximates <p by the Euler explicit scheme and obtains (f>h,Aicondition (3.11) is satisfied, then it follows from the stability analysis that 65 If the CFL Finally, we have since <p is smooth enough, and h and At can be chosen small enough so that ||<^,A/ — Ih,At(<f>)\\ < £• From this, (3.19), and (3.20), we see that lim^A^o \\<Ph,At -h,&t((p}\\ - 0. It is also possible to find rates of convergence in weaker norms. Exercise 3.1. Modify the scheme (3.7), (3.8) to discretize the new boundary value problem obtained by replacing the second line of (3.6) by (p(—x, t) = 0; |^(x, t} = g(t). To discretize ff (*, t), one can use Lemma 3.2. Analyze the stability and the consistency of the scheme. Exercise 3.2. Prove the following assertion: let u be a C* function defined on a closed bounded interval I ofR. Then, for z and h such that z, z — h, z — 2h e /, Exercise 3.3. Deduce from Exercise 3.2 a new second order scheme for the boundary value problem in Exercise 3.1. Exercise 3.4. We consider the variable coefficients boundary value problem "in divergence form" (we assume that 0 < a* < a(x) < a* < +00 andO < a* < a(x) < a* < +00) Propose a scheme for (3.23) based on approximating by using a centered finite difference method to approximate f~(*/±i)Prove that if a is smooth enough, then this scheme is second order accurate with respect to x. 66 Chapter3. Finite Differences ALGORITHM 3.1. Euler explicit scheme. #include <iostream> #include <math.h> ^include <stdlib.h> ^include <fstream.h> #include<gsl/gsl_sf_erf. h> using namespace std; const int NT=10000; // number of time steps const int NX=201; // nb of space intervals const int L=200; // val max of x const int K = 100; // strike double sigmap=0.2, r=0.1; double * u=new double [NX] ; double phi_T(double s){ if(s>K) return s-K; else return 0;} void PDEfiniteDiff() { double dx= (double) L/(double) (NX-1) , dt = l . / N T , t = 0 ; for(int i=0;i<NX;i++) u [ i ] = phi_T(i*dx); // final condition for(int j=0;j<NT;j++) { t+=dt; for(int i=l;i<NX-l;i++) { double x=i*dx; u [ i ] += (0.5*sigmap*x*sigmap*x*(u[i+l]-2*u[i]+u[i-l])/dx/dx + r * x * ( u [ i + l ] - u [ i ] ) / d x - r * u [ i ] ) * dt; } u[NX-l]=L-K*exp(-r*t) ; u[0]=0; } } int mainO { ofstream ff("fd.dat"); PDEfiniteDiff () ,double dx= (double) L/(double) (NX-1) ,for(int i=0;i<NX;i++) { double x=i*dx; ff« x« " \ t " « u[i]«endl; } } We have plotted in Figure 3.1 the price of the vanilla call option computed with Algorithm 3.1. 3.1.3 The Euler Implicit Scheme We have seen above that the Euler explicit scheme becomes much too slow when the mesh is fine because stability requires Af = O(h2). 3.1. Finite Differences in Logarithmic Prices 67 Figure 3.1. The price of the European vanilla call option with K = 100, a = 0.2, r = 0.1 one year to maturity computed by Euler's explicit scheme and by the BlackScholes formula. One idea is to modify the scheme in the following way: Find (pf, m e {0,..., M}, j e {0, . . . , N + 1}, satisfying (3.8), and, for 1 < m < M, l<j<N, In order to obtain ( < p ™ , . . . , #>$)r from (<p™ l,..., <p™ 1)r, one has to solve a nontrivial system of linear equations with N unknowns. This is why the method is called implicit. The Euler implicit scheme (3.24), (3.8) can be recast in the abstract form as Consistency of the Euler Implicit Scheme. Calling e™ the entries of the consistency error £h,&t* we have 68 Chapters. Finite Differences From Lemmas 3.1 and 3.2, we know that (3.9) holds if Therefore, the Euler implicit scheme is of order one with respect to t and of order two with respect to jc. Stability of the Euler Implicit Scheme. For simplicity, we assume here that the coefficients are constant. We take the norm It is enough to show that (3.11) is satisfied. For V e V^^MO}, let us call At each time step, one has to solve the system of linear equations where A € ]&"*" is the tridiagonal matrix introduced in §3.1.2. Lemma 3.10. • The matrix I + At A is invertible. and the Euler implicit scheme (3.24) is stable in the norm \\ Proof. Let W be a vector in RN: we have from Remark 3.3 Therefore Wr (7+Af A) W > ||W|l2» which implies that/+Af A is invertible. Furthermore, if(/ + AfA)W = F, then which implies estimate (3.26). For all V e Vj£A/\{0}, we have thus 3.1. Finite Differences in Logarithmic Prices 69 Remark 3.7. The Euler implicit scheme (3.24) is unconditionally stable in norm \ • \\ with respect to At. Convergence of the Euler Implicit Scheme. It is possible to replicate the arguments used for Euler's explicit scheme, and prove that the Euler implicit scheme is convergent in norm || • ||. Exercise 3.5. Using Exercise 3.2, prove that the Gear scheme is second order with respect to both t and x. This is a two-step scheme, so it is not possible to use it for j = 1. Analyze the stability of this scheme. 3.1.4 The Crank-Nicolson Scheme One of the best one-step implicit schemes is the Crank-Nicolson scheme: Find <pf, m e {0,..., M}, j e {0, . . . , N + 1}, satisfying (3.8), and, for 1 < m < M, l<j<N, As we shall see, it is more accurate than Euler's schemes and has the same kind of stability as the Euler implicit scheme. Indeed, the Crank-Nicolson scheme (3.30), (3.8) can be recast in the abstract form where with 70 Chapters. Finite Differences and [A, A ,(0)]y = 0;m if j = 0, j = N + 1, or m = 0, for m = 1, . . . , M, 1 < j < N. Consistency of the Crank-Nicolson Scheme. From Lemmas 3.1 and 3.2, we know that if the solution to (3.6) is smooth enough, then the consistency error scales like A/2 + h1. Therefore, the Crank-Nicolson is of order two with respect to both x and t. Stability of the Crank-Nicolson Scheme. We assume that the coefficients a, ft, and r are constant, and we keep the notation as for the Euler schemes. It is enough to show that (3.11) is satisfied. For V e VjA,\{0}, let us call U = £j~ A , V and Um = (u^,..., w^) r , Vm = ( v ™ , . . . , u™) r . At each time step, one has to solve the system of linear equations where A has been introduced in §3.1.2. Lemma 3.11. The matrix I + ^ A is invertible, and Proof. We leave the first point to the reader. For the second point, we have that Therefore, for W € which proves the desired result, because A + AT is positive definite; see (3.27). D 3.2. Upwinding 71 Thanks to Lemma 3.11, we have which implies that and Lemma 3.11 implies that The Crank-Nicolson scheme is stable with respect to || • ||, unconditionally with respect to h and At, and convergence is proved as in §3.1.2. Exercise 3.6. For 9, 0 < 9 < I, consider the scheme One recovers Eider's implicit scheme for 0 = 1, Ruler's explicit scheme for 0 = 0, and the Crank-Nicolson scheme for Q = \Studvine the stability of this scheme consists of considering the seauence given bv where A has been introduced in £3.1.2. Prove that the scheme is unconditionally stable as soon as 0 > ^ (the proof is similar to that for the Crank-Nicolson scheme and relies on the fact that A + AT is positive definite; see (3.27)). 3.2 Upwinding Let us assume that the coefficients a, ft, and r are constant and discuss the stability of the Euler implicit scheme: Find (pf, m e {0,..., M}, j € {0,..., W + 1}, satisfying ^ = (f>0(Xj), 0 < j < N + 1, p™ = 0$+1 = 0, 0 < m < M, and, for 1 < m < M, 1 < j < N, with respect to || • ||oo: l|V||oo = maxo< m <Mmaxi< ; <Ar \v™\. For that, we need a few additional notions on matrix analysis; for a vector V e R^, the notation V > 0 (resp., V < 0) means that all the components of V are nonnegative (resp., nonpositive). 72 Chapters. Finite Differences Definition 3.12. A matrix B e RNxN is an M-matrix if there exists a diagonal matrix D with positive diagonal entries such that An M-matrix is the right product of a strictly diagonal dominant matrix by an in vertible diagonal matrix, so it is invertible. The M-matrices are an important class of matrices, because they have monotonicity properties. Lemma 3.13 (discrete maximum principle). Let F e ~RN be a vector such that F > 0. Let B e RNxN be an M-matrix. Then V = B~1F > 0. Proof. By easy algebraic manipulations, it is enough to prove the result when the matrix B is diagonal dominant, i.e., D = 1^. Let IQ be the index such that u,0 = min; Vj. We have because the off-diagonal coefficients of B are nonpositive, which implies Therefore vio > 0, from the third property in (3.39). Corollary 3.14. The entries of the inverse of an M-matrix are all nonnegative. Proof. Let B be an M-matrix and Kj = ((B'^ij,..., (B~l)Nj)T the ;th column of B'1. We have BKj = F/, where Fj = (<5(,,)[<,<#. Lemma 3.13 implies that K > 0. Exercise 3.7. Let a matrix B e M N x N be invertible and such that Prove that Lemma 3.13 holds for B. Let us consider the scheme (3.38). If |/J| < ^-, then the matrices A and I + At A are M-matrices and we have the following stability estimate. 3.2. Upwinding 73 Lemma3.15. If\ft\ < £, then \\(I + AfArMloo < 1Proof. Consider the system of linear equations (/ + Af A)£7 = V. Let ymax, (resp., Vmin) be the vector whose components are all equal to max;=i,. ,# Vj (resp., min;=1 # Vj). It can be easily checked that where £ is a vector whose components are all nonpositive. Therefore U — 1+*Af Vmax < 0. Similarly, one can prove that U — 1+*Af Vmin > 0. Therefore, which ends the proof. In fact, we have proved the following slightly stronger result. Lemma 3.16. Assume that \ft\ < ^- and that rnin;-=0i...,^+i <p^ = 0. Then (<p™);i/n given by (3.38) satisfy If the condition \ft\ < ^- is not fulfilled, then the scheme may not be monotone; i.e., oscillations in the ^-variable may appear (see the numerical example below), and ||(7 + A/A)" 1 ||oo may be larger than 1. In this case, the scheme becomes unstable in the || • 11 oo norm. So, if a2 is much smaller than ft, then step h needs to be very small. Remark 3.8. Note that it is quite important to obtain nonnegative values ofcp since cp stands for a price! Remark 3.9. For European options, the volatility is often not small compared with r, so the scheme (3.38) is most often stable. For Asian options or options with stochastic volatility, we shall see that some diffusion coefficients in the partial differential equation may vanish completely, so the scheme (3.38) will be unstable in the || • ||oo norm. One way to cure these instability phenomena is to use an alternative discretization for the term -£ff (xjt tm), i.e., assuming that ft > 0, _ff *<*/>'•^-rt*;-^ so the scheme becomes Such a discretization of — P^(XJ, tm) is called an upwind discretization, because —ft can be interpreted as a velocity, and the new discretization takes information upstream and not downstream. On the contrary, the scheme (3.38) is called centered. 74 Chapters. Finite Differences With the upwind discretization, the Euler implicit scheme reads The matrices B and I + Affi are M-matrices, independent of Af and h, and the Euler implicit scheme (3.40) is always stable in the norm || • H^, because of the following lemma. Lemma 3.17. The matrix B satisfies \\(I + AfB)"1!!^ < 1. Proof. The proof is left to the reader. Such a gain in stability has a cost: indeed, thanks to Lemmas 3.1 and 3.2, one can prove that the scheme (3.40) is first order in the variables t and x, so it is less accurate than the scheme (3.38). Remark 3.10. The idea of using upwind schemes originates from computational fluid dynamics, where convective effects usually dominate diffusion. An Example. We consider the steady state boundary value problem with ft > 0. The solution to (3.42) is If 2§r -4C 1, u(x) is very close to 0, except in a small neighborhood of x = 1 of diameter 0(y) (this zone is called a boundary layer); see Figure 3.2. Let us consider the two discretizations (3.38) and (3.40) of (3.42), with At = oo. It is possible to compute explicitly the discrete solutions given by these two schemes (the calculations are a bit long) and to see that the centered scheme produces oscillations, whereas the upwind scheme gives a qualitatively correct solution. In Figure 3.3, we have plotted the solutions given by three schemes: the centered scheme, the upwind scheme, and the downwind scheme (i.e., upwinding has been used in the wrong direction): we observe that the centered scheme is 3.2. Upwinding 75 Figure 3.2. The solution of (3.42} for a2 =0.09, r = 1, j8 = 10: the solution vanishes outside a boundary layer. figures..), solutions given oy three schemes for a" = U.UU2!), r = 1, p = 1U, and N = 100. Le/Jf: upwind scheme (zoom); center: centered scheme; right: downwind scheme. Only the upwind scheme gives a qualitatively correct result. Figure 3.4. Solutions given by three schemes for a2 = 0.09, r = 1, ft = 10, and N = 1000. Left: upwind scheme (zoom); center: centered scheme; right: downwind scheme. unstable in the norm || • H^ when the grid step is larger than the boundary layer, and that upwinding in the wrong direction produces a disaster. Remark 3.11. If the grid is sufficiently fine, i.e., if^<£l, then all the schemes will end up giving the correct result. This is the case for the results plotted in Figure 3.4. In the limit when h —» 0, the centered scheme is more accurate since it is of order two. 76 Chapters. Finite Differences One has to remember that upwind schemes are safer but less accurate than centered schemes, and that they should be used when transport phenomena dominate diffusion. It is possible to use second order upwinding, by making use of the second order finite difference formula in Exercise 3.2: assuming that ft > 0, this leads to discretizing the term -P$(Xj, tm) by -£[-<p(xj+2, tm} + 4<p(Xj+i, tm) - 3<p(Xj, f m )], so the Euler implicit scheme becomes for j < N — 1. This formula cannot be applied aij = N — l, and one can use, for instance, a first order scheme there, or something else. Although the matrix obtained with (3.44) cannot be an M-matrix (note that it has four nontrivial diagonals instead of three before), we see that the diagonal term is increased compared to a center scheme, so the stability is improved. Of course, it is possible to use the Crank-Nicolson scheme for time stepping, and obtain a second order scheme in both t and x. 3.3 Finite Differences in the Primitive Variables We consider a European put whose price satisfies the Black-Scholes equation with the Cauchy data where PQ is the payoff function. We truncate the domain in the 5 variable, so (3.45) holds in (0, T] x (0, 5), and we must add a boundary condition at the artificial boundary 5 = S: for example, we impose the Dirichlet condition We suppose that the coefficients a and r are smooth enough and we make the assumptions (2.40) and (2.41). Consider two integers M and N and call A/ = -^, h = jf^, S{ = ih for i = 0 , . . . , N + 1, and tm = mh form = 0 , . . . , M. The nodes (S/, tm) form a uniform grid of the rectangle [0, 5] x [0, T]. 3.3. Finite Differences in the Primitive Variables 3.3.1 77 Euler Implicit Scheme The Euler implicit scheme for discretizing (3.45), (3.46), and (3.47) reads where aj1 = a(Sj, tm) and rm = r(tm}. We call Am the tridiagonal matrix of R (N+1)x(jV+1) : and Pm € RN+l the vector Pm = (p%,..., p%)T. The Euler implicit scheme reads We denote by || • ||2 the norm in R^1: || Q\\22 = Y^=0 qf, and by | • | the norm Lemma 3.18. Under assumptions (2.40) and (2.41), there exists a nonnegative constant €2 such that, for all m, m = 1,..., M, 78 Chapters. Finite Differences Proof. We have where Posing qN+i = 0, we have that, for any 77 > 0, For the term $2, we have that, for any fi > 0, 3.3. Finite Differences in the Primitive Variables 79 From (3.52) and (3.53), for any 77 > 0 and JJL > 0, and (3.51) follows by taking 77 and /u, large enough. Corollary 3.19. If At < -^, then, form = 1 , . . . , M, I + AtAm is invertible, and it is possible to use Eider's implicit scheme. Proof. The equality (/ + AtA)Q = 0 implies and therefore Q — 0. Consistency. By using Lemmas 3.1 and 3.2, one can easily check that if the solution P of (3.45), (3.46), and (3.47) is smooth enough, then, for j = 1 , . . . , N, the consistency error is bounded by C(P)(h2 + A/), whereas e™+1 is bounded by C(P)At. Therefore, the Euler implicit scheme is of order one with respect to t and two with respect to S. Stability: The Energy Method. Let || • || be the norm in R^+Dx^: \\Q\\ = maxm=i;...,M 7= r IIG m ll2, where Q = (Q1, ..., Qm) and Qm € RN+l. Lemma 3.20. There exists a constant CT, > 0 (independent of N) such that, if At < ^-, then the Euler implicit scheme is stable in the norm \\ • ||. Proof. Proving the stability of the method in the norm || • || consists of showing that if, for m= 1,...,M, then, for a positive constant independent of V, N, and M, 80 Chapters. Finite Differences To do it, we take the scalar product of (3.54) with Um: and we use the well-known identity UT(U - V) = \(\\U\\\ + \\U - V\\\ - || V|||). We obtain that which implies, thanks to (3.51), where C3 = 2C2 + 1. Assuming that Ar < ^, multiplying (3.56) by (1 - C3 Ar) m ~ M , and summing over m, we obtain that Let €4 be a positive constant independent of A/ such that log(l — Ca Ar) > — €4 Af. We have that (1 - C*AtrM < ec*M^ = ec*T. and Since (3.57) holds when M is replaced by m < M, we have proved (3.55), with C = max(l, Vf)e?c*T. Remark 3.12. Note that here, the stability is more difficult to analyze than in the previous cases, because the coefficients of the partial differential equation are not constant. The method used here to prove the stability is called an energy method. Convergence. It is possible to replicate the arguments used for Euler's explicit scheme in §3.1.2 and prove that the Euler implicit scheme in the primitive variables is convergent in the norm || • ||. Exercise 3.8. Write down the Crank—Nicolson scheme for the Black-Scholes equation in the primitive variables and analyze its stability by the energy method. 3.4. Numerical Results 81 Figure 3.5. The error produced by the Crank-Nicolson scheme with a centered discretization in the variable S, as a function of N (in log-scales). 3.4 Numerical Results We consider a vanilla European put with strike K = 100 and maturity 1 and we assume that the volatility and interest rates are constant: a = 0.2 and r = 0.04. In this case, it is possible to use Black-Scholes formula (1.18), and to compute the error produced by the same finite difference schemes as in §3.3, except that we use the Crank-Nicolson time scheme instead of the Euler implicit scheme. We compute the error in the norm || • || introduced above. In Figure 3.5, we take a very small time step, i.e., M = 4000, so that the consistency error due to time discretization is very small, and we plot the error in the norm || • || with respect to TV. As a function of N, the error is decreasing and limited from below by the error produced by the time discretization. When this last error is negligible compared to the error due to the discretization in S, we see that the convergence order (the slope of the curve in log-scales) is less than 2: this is due to the fact that the payoff is singular at S — K. In fact, with more careful theoretical considerations, it could be seen that the error decays faster than /?2~ e for all € > 0, and slower than h*. This is indeed observed in Figure 3.5. In Figure 3.6, we take a small step in the S variable, i.e., TV = 120, so that the consistency error due to discretization with respect to S is small, and we plot the error in the norm || • || with respect to M, for both the Crank-Nicolson and the Euler implicit scheme. As a function of M, the two errors are decreasing and limited from below by the error produced by the discretization in S. When this last error is negligible compared to the error due to the time discretization, we see that the convergence order (the slope of the curve in log-scales) is less than 2: this is due to the fact that the payoff is singular at S = K. In fact, with more careful considerations, it could be checked that the error decays faster than A? *~€ for all € > 0, and slower than h*. This is indeed observed in Figure 3.6. Due to the choice of the norm || • ||, the two curves have the same behavior, because the error is driven by the singularity at t — 0, and it does not help to take an accurate scheme near t = 0. At N and M fixed (M = 230, TV = 120), plotting the pointwise error for the CrankNicolson and Euler implicit schemes (see Figure 3.7) shows that the error is concentrated around the singularity, i.e., t = 0 and 5 = K. We see also that the error decays faster in 82 Chapter 3. Finite Differences Figure 3.6. The error produced by the Crank-Nicolson and Euler implicit schemes with a centered discretization in the variable S, as a function ofM (in log-scales). Figure 3.7. The pointwise error produced by the Crank-Nicolson and Euler implicit schemes with a centered discretization in the variable S, as functions and S. 3.5. Which Variable Is Better? 83 time with the Crank-Nicolson scheme: indeed, away from t = 0, the solution is smooth and the Crank-Nicolson behaves better than the Euler schemes. Remark 3.13. The previous observations tell us that in order to improve the accuracy, choosing a uniform grid is not a good idea, and that the grid should be highly refined near t — 0 and S = K. However, the schemes presented so far rely on uniform grids in the variable S. It is possible to design second order schemes that work on nonuniform grids, but in our opinion, their construction is easier understood with the formalism of finite elements. Therefore, at this point, we keep in mind that nonuniform grids should definitely be used, and we postpone the description of schemes for such grids to the next chapter. Project 3.1. On the example of European call, compare the computing times of a MonteCarlo method and of a Crank-Nicolson finite difference scheme. For the Monte-Carlo method, apply one of the variance reduction techniques given in Chapter 1. 3.5 Which Variable Is Better? We are ready now to answer the question, Should one prefer the primitive variables or the logarithmic price? The answer is, it does not matter; what is important is the grid. Indeed, a uniform grid in the logarithmic price, when converted in the primitive variable, has a large density of nodes near 5 = 0, which is completely unnecessary for a vanilla option, because the price is almost affine at S = 0. Conversely, we have seen that a uniform grid in the primitive variable may use too many nodes for large values of S. Therefore, for both choices of variables, what really matters is to use a suitable grid, properly refined near the singularity of the payoff function. The schemes discussed so far are designed for uniform grids in 5 or x only: to obtain good schemes for nonuniform grids, one should be more careful, and things are better understood with the concepts of finite elements; this will be the topic of the next two chapters. 3.6 Options on a Basket of Two Assets Consider an option on a basket of two assets: its price is given by the multidimensional Black-Scholes equation where t is the time to maturity, PQ is the payoff function, and is positive definite. 84 Chapters. Finite Differences For computing, we truncate the domain and consider (3.58) for 0 < Si < 5\ and 0 < 52 < £2, where Si, £2 are large enough. Additional boundary conditions have to be imposed on the artificial boundaries Si = Si and S2 = $2. For puts and many reasonable payoff functions like in (2.64), (2.65), it is sensible to impose that P(S\, S2) = P(S\, $2) = 0 for all 0 < Si < Si, 0 < S2 < S2. Consider three positive integers N\, A/2, and M and pose hk = j/^, k = 1, 2, and At = jj. We consider the real numbers 5*,,- = ih^ for k = 1, 2 and 0 < / < A/* + 1 and tm = mAt for 0 < m < M. The points (tm, S1,, S2j} are the nodes of a uniform grid of [0, 71 x [0, Si] x [0, S2]. The value of at (Si,/, 82, j) e (0, Si) x (0, Sz) is approximated by the centered scheme where For i = 0 or j = 0, we take the same scheme, but some terms vanish, so, on the two boundaries S1 = 0 and S2, we obtain schemes for the one-dimensional Black-Scholes equation. Finally, the Euler implicit scheme consists of finding P™j, 0 < m < M , 0 < i < NI + 1, 0 < j < N2 + 1, such that 3.7. An Asian Put with Fixed Strike 85 with the convention that P™, , — P,m, — 0 and with and It can be checked that the scheme (3.60) is first order in time, and second order in the variables Si and 52. The stability and convergence analyses follow the same line as in §3.3. Exercise 3.9. Write the Euler implicit scheme with an upwind discretization of the first order derivatives. Project 3.2. Compare various implicit schemes for a vanilla European call: Euler and Crank-Nicolson with/without upwinding and Crank-Nicolson with Gear's formula (3.22) for the first order derivative. Plot the errors; plot also a finite difference approximation of dssC. 3.7 An Asian Put with Fixed Strike 3.7.1 An Upwind Scheme with Respect to A For the financial modeling of Asian options, we refer the reader to [117, 116] and the references therein. We consider an Asian put with fixed strike whose payoff is Po(S, A) = (A — K)+: calling A the average value of the asset in time, A = j J0' S(r}dr, the price of the option is found by solving the Cauchy problem (hereafter, t denotes the time to maturity, so Note that when t -> T, then A -> S, so the price of the option at t = T (today) is given by P(t, S, S), and for pricing, we are interested only in the value of P on the diagonal S = A. Nevertheless, we have to solve (3.63). 86 Chapters. Finite Differences On 5 = 0, the coefficient 3-^- vanishes, so the equation degenerates into a partial differential equation with respect to t and A: Near A — 0, we have This term is analogous to a transport term with a velocity pointing outward the domain in fluid mechanics, and for that reason no boundary condition has to be imposed on the boundary A — 0 (in fluid mechanics, this is called an outflow boundary). Remark 3.14. Note that there is no diffusion term with respect to A (i.e., jjp), so, in view of §3.2, upwinding in the variable A will be necessary. Exactly as for the Black-Scholes equation, we truncate the domain in the variables S and A, i.e., we consider (3.63) in (0, 5) x (0, A), and we have to supply additional boundary conditions on the boundaries S = S and A = A. An argument similar to that for the European put shows that lim^-^oo P(t, 5, A) = 0, so we can choose to impose the Dirichlet condition P(t, S, A) = 0 in the zone where 5 > A. No condition has to be imposed for 5 < A for the same reasons as above (if 5 < A, the term — yjj£ |£ is a transport term with an outgoing velocity). Consider now the boundary S = S: on this boundary, we impose the Neumann condition |j = 0, because P0 does not depend on 5, so P should not depend on 5 for large values of S. Take three integers Ns, NA, and M, pose hs = S/Ns+1 = jj~^, and Af = -^, and consider the real numbers 5, = ih$, Aj = jhA, tm = mAf for 0 < i < NS + 1, 0 < j < NA + l,0<m < M. The nodes (?„,, 5,, A;) form a uniform grid of [0, T] x [0, S] x [0, A]. At a node (S,-, Aj) in (0, S) x (0, A), is approximated by the upwind scheme where 3.7. An Asian Put with Fixed Strike 87 It is possible to use a second order scheme by making use of Exercise 3.3 for discretizing S-A dP f /c 4 \. ~ T-t 8A al V J / , Aj). Of course, this scheme cannot be applied near the boundaries A — 0 and A = A. 3.7.2 A Program in C++ The following program computes the price of an Asian put with a Crank-Nicolson scheme and the finite difference schemes described in §3.7.1. For simplicity, we have used only band matrices (the bandwidth is equal to the number of steps in the S variable) and the systems of linear equations are solved by LU factorization. It would have been better to use sparse matrix and a good preconditioned iterative solver like GMRES (see [107, 106]) with an incomplete LU factorization (see [106]). The time grid may have variable steps, whereas the grid in S and A does not vary with time. We use the vector + sparse matrix class called RNM of Danaila, Hecht, and Pironneau [38]. It is not necessary to study these classes in order to use them. One need only know how to call them and how to use the overloaded operators. It may seem like killing a fly with a gun, but it will allow us to hide low-level implementations using the bias library for speed and adaptation to the computer architecture. The RNM class is templated over a basic type: the real numbers (either double or f 1oat). We will later use ddoubl e for automatic differentiation as a fast way to compute derivatives and sensitivities (Greeks). To create an RNM vector v of size m and a band matrix A of size m x m and bandwidth d = 1, one writes const int N=10; typedef double Real; typedef KN<Real> vec; typedef SkyLineMatrix<Real> mat; vec v(N); mat a(N,1); It is indeed convenient to define the types vec and mat for readability, as these will be used often. The RNM classes implement efficiently the operations of vector calculus such as vec c = 0 , b = 2 * c + 1; a . L U ( ) ; a.Solve(v,c); cout«v«endl; 88 Chapters. Finite Differences which means that, with cf = l, i = l...,N, and a a tridiagonal band matrix, the system of linear equations av = c is solved by the Gauss LU factorization method, and the result is displayed. A "CN-scheme" class is defined for the Crank-Nicolson scheme. ALGORITHM 3.2. Crank-Nicolson. class CN_Scheme_Asian { private: int order; double T, S_max, A_max; int NS,NA; vector<double> grid_t; MatriceProfile<double> AA_S; // MatriceProfile<double> AA_A; // // // // bounds of the comp. domain number of nodes in S and A time grid, can be nonuniform auxiliary matrix computed once // and for all auxiliary matrix computed once // and for all the matrix of the linear system // interest rate // volatility MatriceProfile<double> BB; // double rate ; double sigma; public: CN_Scheme_Asian( const int orderg, const double Tg, const double S_maxg, const double A_maxg, const int NSg, const int NAg, const vector<double> &grid_tg, const double rateg,const double sigmag) : order (orderg) , T (Tg) , S_max (S_maxg) , A_max (A_maxg) , NS (NSg) , NA (NAg) , grid_t (grid_tg) , AA_S (NSg*NAg,2*NAg) ,AA_A(NSg*NAg, 2*NAg) ,BB(NSg*NAg,2*NAg) , rate(rateg), sigma(sigmag) { Assemble_Matrices(); }; // constructor void Assemble_Matrices( ); // assembles time independent matrices void Time_Step (int it, vector<KN<double> > &P) ; // one time step void build_rhs(KN<double> &u, const KN<double> &u_jp, const double t,const double dt); // construct RHS of // linear system void build_matrix( const double t, const double dt) ; // builds BB from AA_S and AA_A } A time step of the method is implemented in the function Time_Step: it consists of building the matrix B ~ M + A^A"1 (not equal because of the Neumann boundary condition at S = 5), constructing the right-hand side of the system, and solving the system. 3.7. An Asian Put with Fixed Strike 89 ALGORITHM 3.3. Time step. void CN_Scheme_Asian::Time_Step(int it, { double t=grid_t[it]; double dt=t-grid_t[it-1]; build_rhs(P[it],P[it-l],T-t+dt,dt); build_matrix(T-t,dt); // BB.LUO; BB.Solve(P[it] ,P [it]); } vector< KN<double> >& P) // current time // current time step // computes the RHS computes the matrix B =(M+dt/2* A) // LU factorization of B // solves the system The matrix has to be recomputed at each time step, since it depends on t\ however, it is possible to write Am = AS + -j~AA, where the matrices AS and AA do not vary in time and can be computed once and for all. The matrices As and AA are computed by the function void Assemble_Matrices () . ALGORITHM 3.4. Matrix assembly 1. void CN_Scheme_Asian::Assemble_Matrices() { assert(S_max<=A_max); double hS=S_max/(NS-1); double hA=A_max/(NA-1); vector<double> S ( N S ) ; vector<double> A ( N A ) ; for(int i = 0 ; i < N S ; i + + ) S[i] = (S_max/ (NS-1) ) *i; for(int i=0;i<NA;i++) A[i] = (A_max/ (NA-1) ) *i; int k = - l ; AA_S=0; // stiffness AA_A=0; double aux; for(int i=0;i<NS-l;i++) for (int j = 0 ; j < N A ; j + + ) { k=i*NA+j; aux=pow(sigma*i,2) ; AA_S(k,k)=rate+aux; AA_S(k,k+NA)= -(aux + r a t e * i ) / 2 ; } if (order==l) for(int i = 0 ; i < N S - l ; i + + ) for (int j = 0 ; j < N A ; j + + ) { aux= f a b s ( - S [ i ] + A [ j ] )/hA; k=i*NA+j; A A _ A ( k , k ) = aux; if ( S [ i ] > = A [ j ] ) AA_A(k,k+l)=-aux; else // checks that S_max<=A_max // step in S // step in A // S grid // A grid matrix except derivatives wrt A // derivative wrt A 90 Chapter 3. Finite Differences AA_A(k,k-l)=-aux; } if else (order==2) { for(int i=0;i<NS-l;i++) for (int j=0;j<2;j++) { aux= f a b s ( - S [ i ] + A [ j ] ) / h A ; k=i*NA+j; A A _ A ( k , k ) = aux; if ( S [ i ] > = A [ j ] ) AA_A(k,k+1)=-aux; else AA_A(k,k-l)=-aux; } for(int i=0;i<NS-l;i++) for (int j = N A - 2 ; j < N A ; j + + ) { aux= f a b s ( - S [ i ] + A [ j ] ) / h A ; k=i*NA+j; A A _ A ( k , k ) = aux; if ( S [ i ] > = A [ j ] ) AA_A(k,k+l)=-aux; else AA_A(k,k-l)=-aux; } for(int i=0;i<NS-l;i++) for (int j=2;j<NA-2;j++) { aux= f a b s ( - S [ i ] + A [ j ] ) / h A ; k=i*NA+j; if ( S [ i ] > = A [ j ] ) { A A _ A ( k , k ) = 3*aux/2; AA_A(k,k+l)=-4*aux/2; AA_A(k,k+2)=aux/2; } else { A A _ A ( k , k ) = 3*aux/2; AA_A(k,k-l)=-4*aux/2; AA_A(k,k-2)=aux/2; } } } for (int j = 0 ; j < N A ; j + + ) for(int i = l ; i < N S - l ; i + + ) { } 2 k=i*NA+j; AA_S(k,k-NA)= // -(pow(sigma*i,2) -rate*i)/2; note that the Neumann condition at S=S_max is not done yet 3.7. An Asian Put with Fixed Strike 91 The function : build_matrix is as follows. ALGORITHM 3.5. Matrix assembly 2. void CN_Scheme_Asian: :build_matrix (const double t,const double dt) { int i ; BB=0; for(int k=0;k<NS-l;k++) for (int j=0;j<NA;j++) { i=k*NA+j; BB(i,i)=l+dt/2*(AA_S(i,i)+AA_A(i,i)/t); BB(i,i+NA)=dt/2*AA_S(i,i+NA); } for(int k=l;k<NS-l;k++) for (int j=0;j<NA;j++) { i=k*NA+j; BB(i,i-NA)=dt/2*AA_S(i,i-NA) ; } for(int k=0;k<NS-l;k++) for (int j=l;j<NA;j++) { i=k*NA+j; BB(i,i-l)=dt/2*AA_A(i,i-l)/t; } for(int k=0;k<NS-l;k++) for (int j=0;j<NA-l;j++) { i=k*NA+j; BB(i,i+l)=dt/2*AA_A(i,i+l)/t; } if (order==2) { for(int k=0;k<NS-l;k++) for (int j=0;j<NA-2;j++) { i=k*NA+j; BB(i,i+2)=dt/2*AA_A(i,i+2) /t; } for(int k=0;k<NS-l;k++) for (int j=2;j<NA;j++) { i=k*NA+j; BB(i,i-2)=dt/2*(AA_A(i,i-2) /t) ; } } for (int j = 0;j<NA;j++) { i=j+(NS-l)*NA; // the Neumann condition at S=S_max 92 Chapters. Finite Differences BB(i, i)=BB(i-NA,i-NA) ; BB(i, i-NA)=-BB(i,i) ; } 2 Finally, the right-hand side of the system of linear equations is constructed by the following program. ALGORITHM 3.6. Right-hand side. void CN_Scheme_Asian::build_rhs(KN<double> &u, const KN<double> &u_p, const double t,const double dt) { u=0; AA_A. addMatMul(u_p, u) ; u/ = t; AA_S. addMatMul (ujp, u) ; u*=-dt/2; for(int k=0;k<NS-l;k++) f o r (int j=0;j<NA;j++) { int i=j+NA*k; u(i)+=u_p(i); } for (int j=0;j<NA;j++) // the Neumann condition at S=S_max { int i=j+(NS-l)*NA; u(i)=0; } ] We use this program for computing an Asian put with strike K = 100. We have chosen 5 = A = 200. The maturity is 1 year, r = 0.05, and a = 0.2. In Figure 3.8, we have plotted the surface P(S, A) at t ~ 0, / ~ T/2, and t ~ T. The grids are uniform and we have used the first order in A upwind scheme with 100 nodes in 5 and A, and 50 nodes int. In Figure 3.9, we plot a zoom of the price of the put at t ~ y, when we use an upwind second order and a centered scheme instead of the first upwind scheme for discretizing —S-A/T-r:we see that the second scheme is not monotone and that the centered scheme causes spurious oscillations. Here the grid in (5 < A) has 60 x 60 nodes. 3.7. An Asian Put with Fixed Strike 93 Figure 3.8. The Asian put computed by the Crank-Nicolson scheme at t ~ 0, t ~ T/2, and t ~ T. 94 Chapters. Finite Differences Figure 3.9. The Asian put computed by the Crank-Nicolson scheme with a second order upwind scheme in A and with a centered scheme at t ~ T/2. Chapter 4 The Finite Element Method 4.1 Orientation Conforming finite element methods are numerical approximations closely linked to the theory of variational or weak formulations presented in Chapter 2. The first finite element method can be attributed to Courant [34]. The framework is the same in any dimension of space d: for a weak formulation posed in an infinite-dimensional function space V, for instance, it consists of choosing a finite-dimensional subspace V/, of V, for instance, the space of continuous piecewise affine functions on a triangulation of Q, and of solving the problem with test and trial functions in Vh,instead of V. In the simpler finite element methods, the construction of the space V/, is done as follows: • The domain is partitioned into nonoverlapping cells (elements) whose shapes are simple and fixed: for example, intervals in one dimension, triangles or quadrilaterals in two dimensions, tetrahedra, prisms, or hexahedra in three dimensions. The set of the elements is in general an unstructured mesh called a triangulation. • The maximal degree k of the polynomial approximation in the elements is chosen (mostly degree one in this book). • Vh is made of functions of V whose restriction to the elements are polynomial of degree less than k. Programming the method is also somewhat similar in any dimension, but mesh generation is very much dimension-dependent. There is a very well understood theory on error estimates for finite elements. It is possible to distinguish a priori and a posteriori error estimates: in a priori estimates, the error is bounded by some quantity depending on the solution of the continuous problem (which is unknown, but for which estimates are available), whereas, in a posteriori estimates, the error is bounded by some quantity depending on the solution of the discrete problem which is available. 95 96 Chapter 4. The Finite Element Method For a priori error estimates, one can see the books of Raviart and Thomas [103], Strang and Fix [111], Braess [18], Brenner and Scott [20], Ciarlet [27, 28], and Thomee [112] on parabolic problems. By and large, deriving error estimates for finite element methods consists of the following: 1. establishing the stability of the discretization with respect to some norms related to || • ||v, as we did for finite difference methods; 2. once this is done, one sees that in simple cases the error depends on some distance of the solution of the continuous problem to the space Vh. This quantity cannot be computed exactly since the solution is unknown. However, it can be estimated from a priori knowledge on the regularity of the solution. When sharp results on the solution of the continuous problem are available, the a priori estimates give very valuable information on how to choose the discretization a priori; see the nice papers by Schotzau and Schwab [109] and Werder et al. [115], in the case of homogeneous parabolic problems with smooth coefficients. A posteriori error estimates are a precious tool, since they give practical information that can be used to refine the mesh when needed. In Chapter 5, we consider a posteriori error estimates for a finite element method appb'ed to the Black-Scholes equation. In this chapter, we insist on implementation rather than error estimates. The chapter is organized as follows: We first describe the finite element method on a generic parabolic boundary value problem in two dimensions. Then we focus on the Black-Scholes equation in one and two dimensions. 4.2 A Generic Problem 4.2.1 Variational Formulation Consider the following: • let £2 be a polygonal domain of M2 (£2 is open and bounded); • let F be the boundary of £2; • we assume that F = F</ U FB, where the one-dimensional measure of F^ n Fn is 0; for* e F, • we denote by n the unit normal vector to F at x, pointing outward; • we consider smooth enough functions: Remark 4.1. It is possible to consider more general domains whose boundaries are locally the graph of a Lipschitz continuous function. For suitable functions 4.2. A Generic Problem 97 we are interested in finding u(x, T) solving the parabolic boundary value problem where We recall Green's formula, which holds whenever the integrals are defined. The variational formulation of (4.1) involves the Sobolev space which is a Hilbert space endowed with the norm Calling T>(Q) the space of the restrictions of the functions of £>(R2) to Q, we recall that £>(£2) is dense in W. The linear operator u i->- u\?d, which maps a function to its restriction to r</, is bounded from £>(£2) with the norm || • || w to L 2 (r^). Therefore, we can define a continuous extension yd of this operator on W, called the trace operator on IV We define V as the kernel of yd. The space V is a closed subspace of W. Note that it is also possible to define a trace operator from W to L 2 (F W ). For simplicity, we assume that the coefficients K, a, and f3 and the function g are smooth enough so that there exists a function with • Yd(ug) = 8 a-e- with respect to t; • ^ - V • (KVUg) - V • (aug) + Pug e L2(S7 x (0, 71)); • the normal trace (&wg + (K Vug) •«) |rn can be defined and belongs to L 2 (F n x (0, T)). 98 Chapter 4. The Finite Element Method Reasoning as in §2.6, we introduce the bilinear form on W: Assuming that for a.e. x e £2, K(X) is a symmetric tensor and there exist two positive constants 0 < K < k such that, for all £ e R2, • a e (L°°(Q))2, ft € L°°(n), ft € L°°(rn), it can be proved that there exist two positive constants c_ < c and a nonnegative constant A. such that for all u, w e W, and The variational formulation of (4.1) is as follows: Find u: u — ug e L2((0, T); V), u e C°([0, T]; L 2 (ft)), and f e L2((0, T); V), with u|,=0 = MO, and, for a.e. t e (0, T), Thanks to the bound (4.5) and to Garding's inequality (4.6), it can be proved that, if there exists ug satisfying the condition above, then the variational formulation has a unique solution, which satisfies the first line of (4.1) in the sense of distributions. 4.2.2 The Time Semidiscrete Problem We introduce a partition of the interval [0, T] into subintervals [f m _i, tm], 1 < m < Af, such that 0 = f0 < *i < • • • < tm = T. We denote by Atm the length tm — tm-1, and by Af the maximum of Atm, 1 < m < M. For simph'city, we assume that UQ e W. We discretize (4.7) by means of a Crank-Nicolson scheme; i.e., we look for um e W, m = 0 , . . . , Af, such that u° = UQ and for all m = 1,..., M, um - ug(tm) e V, and for all v e V, where <f>m 1/2 means 0(*m"'2Hm), and similarly for /. This scheme is second order. Remark 4.2. I/UQ does not belong to W, then we have to approximate first UQ by a function in W, at the cost of an additional error. 4.2. A Generic Problem 99 Figure 4.1. Left: a finite element mesh made of triangles. This mesh has been obtained by pricing adoptively an American basket option. Right: these cases are ruled out. 4.2.3 The Full Discretization: Lagrange Finite Elements Discretization with respect to x is obtained by replacing W (resp., V) by a subspace of finite dimension Wh C W (resp., V), C V). For example, one may choose for Vh, a space of continuous piecewise polynomial functions on a triangulation of £2 vanishing on F</. For a positive real number h, consider a partition Th of £2 into nonoverlapping closed triangles (Th is the set of all the triangles forming the partition) such that • Q = (JKeThK; • for all AT ^ AT', two triangles of Th, K n K' is either empty, a vertex of both K and Kf, or a whole edge of both K and K'; • for all K e Th, the one-dimensional measure of K n F^ (resp., K D Fw) is either 0 or K nrd (resp., AT n Fn) is a whole edge of AT; • maxtfeT^ diameter(AT) = h. For these conditions to hold, £2 must be polygonal (to be covered exactly by a triangulation). However, if £2 is not polygonal but has a smooth boundary, it is possible to find a set Th of nonoverlapping triangles of diameters less than h such that the distance between £2 and \JK€j-hK scales like h2. In Figure 4.1, we show examples of situations which can or cannot occur with the mesh defined above. Exercise 4.1. Call NT the number of triangles in Th, NE the number of edges, Nv the number of vertices, and NQ the number of vertices lying in the open domain £2. Prove that For k a positive integer, we introduce the spaces 100 Chapter 4. The Finite Element Method We focus on the case where k = 1; i.e., the functions in Wh are piecewise affine. It is clear that Wh is a finite-dimensional subspace of W and that V/, is a finite-dimensional subspace of V. Assume that for each m = 1 , . . . , M, there exists a function u™h e Wh such that the trace of u™h on F^ is g(tm). If it is not the case, g(tm) must be approximated first by the trace of a function in Wh, at the cost of an additional error. For example, if g is continuous on r^, one can take the Lagrange interpolation of g. Assuming that UQ e Wh, the full discretization of the variational formulation consists offindingu% e Wh, m = 1 , . . . , M, such that itf - u™h e Vh, and, with u°h - UQ, 4.2.4 The Discrete Problem in Matrix Form Abasis of Vh is chosen, (tu,),=i,...,#• Then, for 1,..., M, u™ can be written as and, applying (4.11) to (4.10) with u/, = w{, we obtain a system of linear equations for m nm — — (u \r \uj )j=l,...,N- where M and A are matrices in R^ xAr : and The matrix M is called the mass matrix and A the stiffness matrix. It can be proved, thanks to estimates (4.5) and (4.6), that if Ar is small enough, then M + A^"- A is invertible, so it is possible to solve (4.12). 4.2. A Generic Problem 101 Figure 4.2. The shape function wj 4.2.5 The Nodal Basis Hereafter, we take k = 1, so we deal with piecewise linear finite elements. On each triangle K E Th, denoting by ql, i = 1, 2, 3, the vertices of K, we define for x e R2 the barycentric coordinates of x, i.e., the solution of This 3x3 system of linear equations is never singular because its determinant is twice the area of K. It is obvious that the bary centric coordinates A.f are affine functions of x. Furthermore, • when x e K, Xf > 0, i = 1, 2, 3; • if K — [qil, q'2, q'3] and x is aligned with q'1, qh, then A.J = 0. Let Vh be a function in Wh'. it is easy to check that, on each triangle K e Th, Therefore, a function in Wh is uniquely defined by its values at the nodes of Th and a function in Vh is uniquely defined by its values at the nodes of Th not located on IV Call (ql)i=i,...,N the nodes of Th not located on F^, and let wl be the unique function in Vh such that wl ( q j ) = Sjj for all j = 1 , . . . , N. For a triangle K such that ql is a vertex of K, it is clear that wl coincides in K with one of the three barycentric coordinates attached to triangle K. Therefore, we have the identity which shows that (w'),=1 >Ar is a basis of Vh. As shown in Figure 4.2, the support of w' is the union of the triangles of Th containing the node q1, so it is very small when the mesh 102 Chapter 4. The Finite Element Method is fine, and the supports of two basis functions, w' and wj, intersect if and only if ql and qi are the vertices of a same triangle of Th. Therefore, the matrices M and A constructed with this basis are very sparse. This reduces dramatically the complexity when solving properly (4.12). The basis (u;'),=i ^ is often called the nodal basis of Vh. The shape functions w' are sometimes called hat functions. For u/, e Vh, the values u, = Vh(q') are called the degrees of freedom of Vh. UK — [q'1, q'2, q13], and if b'1 is the point aligned with q'2 and q'3 and such that tfiq^ _L <7' 2 g' 3 , then and calling w'1 the unit vector orthogonal to q'2q'i and pointing to q'1, i.e., w'1 = .• If'^'H bilq'1 and E'1 the length of the edge of K opposite to q11, and using the well-known identity Eil I^'V1 | = 2\K\, we obtain This yields in particular where a% is the angle of K at vertex q'3. The following integration formula is very important for the numerical implementation of the finite element method. Proposition 4.1. Calling A,-, i = 1, 2, 3, the barycentric coordinates of the triangle K, and v\, v"2,V3 three nonnegative integers, and \K\ the measure of K, Remark 4.3. It may be useful to use bases other than the nodal basis, for example, bases related to wavelet decompositions, in particular for speeding up the solution o/(4.12); see [95, 114]. Remark 4.4. The integral of a quadratic function on a triangle K is one-third the sum of the values of the function on the midedges times \K\, and therefore (4.19) is simpler when vi + vi + V-? = 2: Remark 4.5 (mass lumping for piecewise linear triangular elements). Let f be a smooth function and consider the following approximation for the integral of f over £2 = U^eT^ K> where 7h is a triangulation of SI: 4.2. A Generic Problem 103 where q\ , qf, q% are the three vertices ofK. If f is affine, this formula is exact; otherwise it computes the integral with an error O(h2). This approximation is called mass lumping: for two functions Uh, u>h e V/,, we call U and V the vectors of their coordinates in the nodal basis (see (4.15)): mass lumping permits us to approximate JQ uhVh by UTMV, where M is a diagonal matrix with positive diagonal entries. 4.2.6 Stabilization by Least Squares Exactly as for finite differences, the Galerkin finite element scheme presented above becomes unstable in the maximum norm when the nonsymmetric term in (4.1) becomes dominant (for example, this is the case for some Asian options). One has to stabilize the method: one way is to add a least squares term to (4.8). We consider the sum on the elements of the squared residuals: Finding u™ as the minimizer of Jm(v, u™ *) over u™h + V/, amounts to solving a least squares approximation to (4.1). It consists of solving the Euler equations where with and where F(Vh} is a linear form depending on u™ 1,<t>m 2 and fm 2. 104 Chapter 4. The Finite Element Method This method has serious drawbacks: the condition number of the matrix in the system of linear equations (4.21) scales as the square of the condition number of the matrix in the Galerkin method. Therefore, the solution is much harder to compute by iterative methods and more sensitive to roundoff errors. Also, this method is less accurate in the regions where the solution is smooth. Therefore, it is much better to mix together the Galerkin and the least squares approximations, and the resulting method is called the least squares Galerkin method: for a well-chosen parameter <5, the new discrete problem is to find u™ e u™h + Vh,m = 1 , . . . , M, with uQh = uQ, and Of course, this problem amounts to solving a system of linear equations for the values of u™ at the vertices, with a new matrix M+Atm/2A.The stability is increased because the diagonal coefficients of the matrix are larger now. It is possible to study this procedure thoroughly, including a priori error estimates, and to choose 8 in an optimal way. There are many references on this topic; see, for example, [54]. 4.3 The Black-Scholes Equation with Local Volatility We are interested in discretizing the Black-Scholes equation for a vanilla put, i.e., (3.45), (3.46), (3.47), with a finite element method. The variational formulation that we start from has been introduced in §2.3.2 and is given in (2.23), (2.24). We introduce a partition of the interval [0, S] into subintervals KI = [5,-_i, 5,-], 1 < i < AT + 1, such that Q = SQ < Si < ••• < SN < SN+i = 5. The size of the_interval TI is called h{ and we set h = max^i^.^+i hi. We define the mesh TH of [0, 5] as the set {KI, ..., KN+I}. In what follows, we will assume that the strike K coincides with some node of Th'. there exists kQ, 0 < JCQ < N + 1, such that 5^ = K. We define the discrete space Vh by The assumption on the mesh ensures that P0 e Vh. The discrete problem obtained by applying the Crank-Nicolson scheme in time reads as follows: Find (P^0<m<M, PH e Vh satisfying and for all m, 1 < m < M, 4.3. The Black-Scholes Equation with Local Volatility 105 where am = a,m and Note that, for v, w e V^, we have a simpler expression for at(v, w) when a is continuous with respect to 5: where [ff ]($•) is the jump of ff at 5,-: Let (u/),=o,...;v be the nodal basis of Vh, and let M and Am in R^+Dx^+D be the mass and stiffness matrices defined by M,-,y = (w1, u> ; ), A™j = atm(wj, w1), 0 < z, 7 < N. Calling Pm = (P f c m (5 0 ),..., P^(SN))T and P° - (P0(S0), • • •. ^oC^)) 7 , (4.25) is equivalent to The shape functions w1 corresponding to vertex 5, are supported in [5,_i, Si+i ]. This implies that the matrices M and Am are tridiagonal because when |z — j\ > 1, the intersection of the supports of wi' and w; has measure 0. Furthermore giving 106 Chapter 4. The Finite Element Method From this, a few calculations show that the entries of Am are Note that when the mesh is uniform, we recover the matrix A (up to a scaling by h for the rows / > 1, and | for the row i = 0) found when using the finite difference method in §3.3; see (3.49). The entries of M are Therefore, when the mesh is uniform, the scheme (4.29) is not completely equivalent to the finite difference scheme because M is not diagonal. However, in this case, it is possible to use a quadrature formula which makes of M a diagonal matrix M: M,,, = £\ M,->;- (this process is called mass lumping). Doing so, one obtains a scheme completely equivalent to the finite difference scheme. So, when the mesh is uniform, the finite element method with mass lumping is equivalent to the finite difference centered scheme, although it has not been obtained in the same manner. When the mesh is not uniform, the scheme (4.29) can also be seen as a finite difference scheme of second order with respect to 5. Indeed, calling Si±i = |(Sj+S,±i), it corresponds to using the following finite difference approximations for the second order derivative: 4.4. A Black-Scholes Equation Solver in C++ 107 and for the first order derivative, Exercise 4.2. Prove that the finite difference scheme obtained by the two sets of formulas above is second order accurate. 4.4 A Black-Scholes Equation Solver in C++ The following program solves the one-dimensional Black-Scholes equation with variable a with a Crank-Nicolson scheme and piecewise affine finite element in 5. The systems of linear equations are solved by LU factorization. The time grid may have variable steps, whereas the mesh in S does not vary with time. A program where the mesh in 5 can vary in time is given in the next chapter. As in §3.7.2, we use the RNM vector + sparse matrix class of Danaila, Hecht, and Pironneau [38]. It is not necessary to study these classes in order to use them. One need only know how to call them and how to use the overloaded operators. It may seem like overkill, but it will allow us to hide low-level implementations using the bias library for speed and adaptation to the computer architecture. A CN_Scheme class is defined for the Crank-Nicolson scheme as follows. ALGORITHM 4.1. CN-scheme. class CN_Scheme{ private: vector<double> S_nodes, S_steps; // node and element sizes vector<double> grid_t; // the time grid double rate (double) ; // interest rate is a function of time double vol (double,double); // vol. is a function of time and S MatriceProfile<double> B; // matrix M+dt/2 A public: CN_Scheme (const vector<double> &g_grid_S, const vector<double> &g_S_steps, const vector<double> & g_grid_t) :S_nodes(g_grid_S) , S_steps(g_S_steps), grid_t(g_grid_t), B(g_grid_S.size()-1,2) {}; // constructor void Time_Step(int i, vector<KN<double> > &P) ; void build_rhs (KN<double> &u, const KN<double> &u_p, const double t,const double dt) ; void build_matrix(MatriceProfile<double> &B , const double t, const double dt); h A time step of the method is implemented in the function Time_Step: it consists of building the matrix B = M + ^-A™ (we have assumed that local volatility is a function 108 Chapter 4. The Finite Element Method of time and 5, so the matrix has to be recomputed at each time step), computing its LU factorization, constructing the right-hand side of the system of linear equations, and solving this system. ALGORITHM 4.2. Time step. void CN_Scheme::Time_Step(int it, vector< KN<double> >& P) { double t = g r i d _ t [ i t ] ; // current time double dt=t-grid_t[it-1] ; // current time step build_matrix(B,t,dt) ; // computes B =(M+dt/2* A) B.LUO; // LU factorization of B build_rhs(P[it],P[it-l] ,t-dt,dt); // computes the RHS B.Solve(P[it],P[it]); // solves the system ] The matrix B = M + ^"-A"1 is assembled as follows. ALGORITHM 4.3. Matrix assembly. void CN_Scheme::build_matrix(MatriceProfile<double> &B, const double t,const double dt) { int i; double S,h_jp,h_n, a,b,c,d; double r=rate(t); // computes the first row of B h_n=S_steps[0] ; B(0,0) = (0.25*dt*r+l./3)*h_n; B(0,l)=h_n/6; for (i=l; i< S_steps .size 0-1; i++) { h_p=h_n; S=S_nodes[i] ; h_n=S_steps[i] ; a=pow(S*vol(t,S),2) ; b=a/h_jp; c=a/h_n; d=r*S; // B(i,i)=0.25*dt*(b+c+r*(h_p+h_n))+ B(i,i-l)=0.25*dt*(-b+d)+h_p/6; B(i,i+l)=0.25*dt*(-c-d)+h_n/6; } h_p=h_n; S=S_nodes[i]; h_n=S_steps[i] ; a=pow(S*vol(t,S) ,2) ; b=a/h_p; c=a/h_n; d=r*S; B(i,i)=0.25*dt*(b+c+r*(h_p+h_n))+ B(i,i-l)=0.25*dt*(-b+d)+h_p/6; ] computes the i-th row of B (h_p+h_n)/3 // (h_p+h_n)/3 ; computes the last row of B ; 4.4. A Black-Scholes Equation Solver in C++ 109 The right-hand side is computed as follows. ALGORITHM 4.4. Right-hand side. void CN_Scheme::build_rhs(KN<double> &u,const KN<double> &u_p, const double t,const double dt) { // u_p is the solution at the previous time step // u will be the right-hand side of the linear system // u is computed from u_p by a loop on the elements double r , c , d ; // auxiliary variables double x_l,x_r; // left and right endpoints of current element double v_l,v_r; // links to the values of the vol. at x_l,x_r double u_l,u_r; // d.o.f. of u_p associated to the current element r = r a t e ( t ) ; u=0; // all the components of u are initialized to 0 x_l=0; // some initializations before entering the loop u_l=u_p (0) ; v_l=0.5*pow(x_l*vol(t,x_l),2); int i; for ( i=0; i<S_steps.size ()-1;i++) // loop on elements { // left val. of x, u_p and vol at left end of elem. are known x_r=S_nodes [i + 1] ; // get x, u_p and vol at right end of elem. v_r=0.5*pow(x_r*vol(t,x_r),2); u_r=u_p (i+1) ,c=u_r-u_l; d=c/S_steps[i]; u(i)+=S_steps [i] / 6 . * (2*u_l+u_r) +0.5*dt*(d*v_l+(c*(2*x_l+x_r)-(2*u_l+u_r)*S_steps [ i ] ) * r / 6 ) ; u (i+1)+=S_steps [i]/6.*(u_l+2*u_r) + 0.5*dt*(-d*v_r+(c*(2*x_r+x_l)-(2*u_r+u_l)*S_steps [ i ] ) * r / 6 ) ; // right val. becomes left val. for the next elem. x_l=x_r; u_l=u_r; v_l=v_r; } // last elem. is special because of Dirichlet conditions c=-u_l; d=c/S_steps[i] ; u(i)+=S_steps[i]/3.*(u_p(i)) +0.5*dt*(d*v_l+(c*(2*x_l+x_r)-2*u_l*S_steps[i])*r/6); } In Figure 4.3, we compare the error produced by the method programmed above for two grids: a uniform grid with 100 nodes in t and 100 nodes in S, and a nonuniform grid with the same number of nodes and an algebraic refinement near t = 0 and S = K. We see that the error is much larger with the uniform grid. We see also that when the mesh is nonuniform there is an error at high values of 5, which becomes comparable to the error near the money: this error is due to the artificial boundary conditions. For improving on this, one should either take S larger or use transparent boundary conditions (see §4.5). 110 Chapter 4. The Finite Element Method Figure 4.3. The pointwise error produced by the Crank-Nicolson scheme and piecewise affine finite element methods for uniform and nonuniform grids with 100 x 100 nodes. 4.5 A Transparent Boundary Condition While the Black-Scholes equation is set on (0, +00), localization at 5 e (0, 5) implies an error which decays fast as ^ grows. Nevertheless, for saving time, one may need to have S as small as possible—for example, 5=1.2K. 4.5. A Transparent Boundary Condition 111 Transparent boundary conditions were proposed in computational physics for linear partial differential equations with constant coefficients, for which the Green's functions are known, and in particular in electromagnetism, where one frequently deals with unbounded domains; see [80]. They permit us to compute the solution in a bounded domain with no errors. We propose adapting the idea to the present situation. Consider the problem with the compatibility condition g(0) = 0. It corresponds to a, r constant and is obtained from (2.9) by performing several changes of variables and unknown function; see §2.2.3, in particular the change of variable x — log S. Extending u in x < L by M(x, t) = g(t) and calling q = —dxit(L, t), this problem is equivalent to So the solution satisfies ~T" where G(x, t) =e4tV4ntis the fundamental solution to the heat equation, which yields at x =L i.e., since /0°° G(z, t - r)dz = ±, This, in turn, is approximated numerically by Returning to the Black-Scholes equation in the variable 5, in the special case when r — o"2/2, the transparent condition is and is approximated by 112 Chapter 4. The Finite Element Method When r is a different constant, the new function v = u(x, t)e z°2 e ^ P ( S , t), x = log(S)) satisfies (with u(x, t) = which yields and in the 5 variable, As above, this is approximated by Discretization by finite differences on a uniform grid of step At and h gives where The program for an Euler scheme with transparent boundary condition is as follows. ALGORITHM 4.5. Transparent boundary conditions. void Euler_Scheme::Time_Step_Transp_BC(int it, vector< KN<double> >& P, int verbose) { int i,n; double dt,t,S,h_p,h_n,r; double a,b,c,d,e; double co_l,co_2; double pi=4*atan(l.); n=S_steps [it] . sizeO ; 4.5. A Transparent Boundary Condition 113 MatriceProfile<double> A ( n , 2 ) ; t=grid_t[it]; dt=t-grid_t[it-1] ; r=rate(t); e=0.5*dt; h__n=S_steps [it] [0] ; A ( 0 , 0 ) = e * r * h _ n + h_n/3; A(0,l)=h_n/6; for(i=l;i< n-l;i++) { h_p=h_n; S=S_nodes[it] [i] ; h_n=S_steps[it] [i] ; a=pow(S*vol(t,S) ,2) ; b=a/h_p; c=a/h_n; d=r*S; A ( i , i ) = e * (b+c+r* (h_p+h_n) ) + (h_jp+h_n)/3 ; A(i,i-l)=e*(-b+d)+h_p/6; A(i,i+l)=e*(-c-d)+h_n/6; } h_p=h_n; S=S_nodes[it] [i] ; h_n=S_steps[it] [i] ; double Smax=S; double eta_infi=vol(t,Smax); double eta_infi_sq= p o w ( e t a _ i n f i , 2 . ) ; double aux_tr=r- 0.5*eta_infi_sq; A ( i , i ) = s q r t ( 2 * p i ) + sqrt(dt)*(aux_tr/eta_infi + 2* eta_infi *Smax/ h_n) ; A ( i , i - l ) = - 2 * sqrt(dt)*eta_infi*Smax/ h_n; if (change_grid[it]) b u i l d _ r h s ( P [ i t ] , P [ i t - l ] ,S_steps [it-1],S_nodes[it-1] ,S_steps[it], S_nodes[it]); else build_rhs_same_grid(P[it],P[it-l],S_steps[it-1],S_nodes[it-1], S_steps[it],S_nodes[it]); P[it](n-l)=0; for (int j = l ; j < i t ; j + + ) { double t 2 = g r i d _ t [ j ] ; double dt2=t2-grid_t[j-1]; double r 2 = r a t e ( t 2 ) ; int siz= S _ s t e p s [ j ] . s i z e ( ) - 1 ; double h2= S_steps[j] [siz]; co_l=-dt2*((r2- 0.5*eta_infi_sq)/(2*eta_infi) + eta_infi*Smax/h2) ; co_2=dt2 * eta_inf i * Smax/h2; P [ i t ] ( n - l ) + = ( P [ j ] ( s i z ) * c o _ l + P [ j ] (siz-1) *co_2) * exp(-pow((r2+ 0 . 5 * e t a _ i n f i _ s q ) , 2 . ) * (t-t2)/(2*eta_infi_sq))/sqrt(t-t2); } A.LUO ; A.Solve(P[it] , P [ i t ] ) ; }_ 114 Chapter 4. The Finite Element Method The sum can be approximated as follows: This expression can be computed much faster because an induction formula is available for the last sum. Exercise 4.3. Write down the transparent boundary condition for (2.12) with a constant dividend yield q > 0. Exercise 4.4. Write down the transparent boundary condition for Dupire's equation (2.51) for constant dividend yield and interest rate. Figure 4.4 illustrates the performances of the transparent boundary conditions at S = 1.4K and S = 1.2K, for a put option, with uniform volatility. The option price is well approximated, whereas the Dirichlet condition P(S) = 0 gives bad results. There remains an error though, due to • the integration formula for (4.32); • the fact that the function does not solve exactly the Black-Scholes equation in (0, 5) x (0, T). In Figure 4.5, the price obtained with transparent boundary conditions at 5 = IAK and 5 = 1.2K one year to maturity is compared to the exact price. 4.6 Levy Driven Assets As in §2.5, one may consider LeVy driven assets. The aim of this section is to describe several possible ways to discretize the partial integrodifferential equation (2.57). 4.6.1 A Scheme with an Explicit Discretization of the Nonlocal Term In [32], it is shown that when the kernel k is not too singular or when diffusion dominates, an explicit treatment of the nonlocal term is good enough. This means that a minor modification of the program for the usual Black—Scholes equation will suffice: at every time step tm, 4.6. Levy Driven Assets 115 Figure 4.4. Top: error in the exact price when using an Euler scheme with the new boundary condition on a European put at T = 1 for a = 0.2, r = 0.04, S = 1.4, K = 140. Bottom: error with the Dirichlet condition P(S, t) = 0. There are 70 nodes in the S direction and 50 time steps. before the resolution of the system of linear equations one must change the right-hand side of the linear system from Pm At to (Pm + v) Af with (recall that t is the time to maturity). Let Si be the node of a uniform mesh with step size h. Let us denote by P™ the approximation of P(S,-, mAf), i =Q,...,N. We approximate the integral v(S) by a finite 11 6 Chapter 4. The Finite Element Method Figure 4.5. Comparison with the exact solution at T = 1 when using transparent and Dirichlet conditions at S = 140 (top) and S = 120 (bottom). sum over j = 0,..., N: ALGORITHM 4.6. An elementary program. void getAu() { const double c = 0 . 1 / s q r t ( 8 * a t a n ( l . 0 ) ) ; for(int i = l ; i < n S - l ; i + + ) { v[i]=0; for(int j = l ; j < n S ; j + + ) { double x = l o g ( d o u b l e ( j ) / i ) ; 4.6. Levy Driven Assets 11 7 double w = u [ j ] - u [ i ] - ( u [ i + l ] - u [ i ] ) * ( j - i ) ; v[i] += w * c * e x p ( - x * x / 2 ) / ( j + 0 . 5 ) ; } } }_ In Figure 4.6, we have plotted the price of a vanilla put option computed with the Euler explicit scheme with Algorithm 4.6, when the underlying asset is described by a Levy process, with k(z) = e~^, as well as the price of the same option given by the standard Black-Scholes model. 4.6.2 A Semi-Implicit Scheme and a Program for Options on CGMY Driven Assets We are going to propose a scheme where the nonlocal term is discretized partly implicitly; i.e., the nonlocal interaction between nodes close to each other will be treated implicitly. On the contrary, when two nodes are far enough from each other, their interaction will be treated explicitly. The advantage of such a method is twofold: • the systems of linear equations to be solved at each time step involve banded matrices; • one can tune the bandwidth of this matrix in order to obtain a stable scheme. Calling as above wj the shape functions, we have to compute with k given by (2.59). The first step is to compute Figure 4.6. A put option on an underlying asset modeled by a Levy process and comparison with the same modeled by a Black-Scholes equation. 118 Chapter 4. The Finite Element Method To simplify the discussion, we focus on the case where the parameter Y satisfies 0< Y < 1. We discuss in detail the case when 5 > S/+i: in this case, Calling x the function x we see that Note that x can be written using special functions: 1. IfF = 0, where E\ is the exponential integral E\(x) = ff° *-j-dt. 2. IfY = 1, where £2 is the second order exponential integral EI(X) = J™ ~rdt. 3. I f O < Y < 1, where F(a, x) is the incomplete T function: T(a, x) = f*°° ta le 'dt. 4.6. Levy Driven Assets 119 After some calculations, one obtains the following in a similar manner: 1. IfSy < S < S y+i' 2. JfSj-i < S < Sj 3. IfS< Sj-i, The special functions E\, £2, and F(,) are programmed in the GSL [59]. Using this library, the code for the function x is as follows. ALGORITHM 4.7. x« ^include <gsl/gsl_sf.h> double chi(double x, double C,double M,double Y) { if (Y<le-6) 120 Chapter 4. The Finite Element Method { if (x<50) return gsl_sf_expint_El(M*x)/C; else return 0; } else if( l.-Y<le-6) { if (x<50) return gsl_sf_expint_E2(M*x)/C/x; else return 0; } else { if (x<50) return (exp(-x*M)* pow(x, -Y) -pow(M, Y)* gsl_sf_gamma(l.-Y)*gsl_sf_gamma_inc_Q(l-Y,M*x))/C/Y; else return 0; } J Then the program for computing the function wl (5)7(5) is as follows. ALGORITHM 4.8. CGMY1. double fu_I (double x, void * params) { double * alpha= (double*) params; double xO=alpha[0]; double xl=alpha[1]; double x2=alpha[2]; double hO=xl-xO; double hl=x2-xl; double res; if (x>x2) { double logo; if(xO>0) logO=log(x/xO); else logO=50; double logl=log(x/xl); double Iog2=log(x/x2); if ( (l+G)*log2>50) res=0; else { res=x2/hl*chi(log2,C,G,Y) - (x2/hl+xO/hO) * chi(logl,C,G,Y)+ 4.6. Levy Driven Assets 121 xd/hO*chi(logO,C,G,Y) - x * ( c h i ( l o g 2 , C , l + G , Y ) / h l + c h i ( l o g O , C , 1 + G , Y) /hO - c h i ( l o g l , C , G + l , Y ) * ( 1 / h l +l / h O ) ) ; } } else if (x>xl) { double logO; if(xO>0) logO=log(x/xO); else logO=50; double logl=log(x/xl); double Iog2=log(x2/x); res=-x2/hl*chi(log2,C,M,Y) +x/hl*chi(Iog2, C,M-1,Y) + xO/hO*chi(logO,C,G,Y)-x/hO*chi(logO,C,1+G, Y) +(1/hO+l/hl)*x*chi(logl,C,1+G,Y) -(xO/hO+x2/hl)*chi (logl,C,G,Y); } else if (x>xO) { double logO ,if(xO>0) logO=log(x/xO); else logO=50; double logl=log(xl/x) ; double Iog2=log(x2/x) ; res= xO/hO*chi(logO,C,G,Y)-x/hO*chi(logO,C, 1+G,Y) -x2/hl*chi(log2,C,M,Y)+x/hl*chi(Iog2 , C,M-1,Y) -(l/hO+l/hl)*x*chi(logl,C,M-l,Y) +(xO/hO+x2/hl)*chi(logl,C,M,Y); } else { double logO=log(xO/x); double logl=log(xl/x); double Iog2=log(x2/x); if(M*logO>50) res= 0; else { res=-x2/hl*chi(log2,C,M,Y) + ( x 2 / h l + x O / h O ) * c h i ( l o g l , C , M , Y ) - xO/hO*chi(logO,C,M,Y) +x*(chi(Iog2 , C , M - 1 , Y ) / h l + c h i ( l o g O , C , M - 1 , Y ) / h O -chi(logl,C,M-1,Y)*(1/hl+l/hO) ) ; } } res*=alpha[3]+x*alpha[4]; return res; ] Note that this function has to be modified if j = 0. 122 Chapter 4. The Finite Element Method We propose the following semi-implicit scheme for discretizing (2.57): Calling B the matrix defined by we choose an integer b, we call B the banded matrix such that and we take B — B—B. With A the stiffness matrix for the standard Black-Scholes equation and with Pm = (Pm/n(50),.. -, P£*(SN))T and P° = (P0(S0),..., P0(SN))T, the scheme is Computing the entries of B amounts to computing an integral of a singular function: for that, we use the GSL function gsl_integrat ion_qagp, and a simplified program for a time step is the following. ALGORITHM 4.9. CGMY2. #include <gsl/gsl_math.h> ^include <gsl/gsl_integration.h> void Euler_Scheme_for_Levy::Time_Step(int it, vector< KN<double> >& P) { int i, n; double dt, t, S,h_jp,h_n, r; double a,b,c,d,e; gsl_integration_workspace *w =gsl_integration_workspace_alloc(200) ; double res; double err; size_t si=200; double * param=new double [5],gsl_function F; n=S_steps[it].size(); MatriceProfile<double> A(n,max(2,bandwidth)); t=grid_t[it] ; dt=t-grid_t[it-1]; r=rate(t); e=0.5*dt; h_n=S_steps[it] [ 0 ] ; A ( 0 , 0 ) = e * r * h _ n + h_n/3; A(0,l)=h_n/6; for(i=l;i< n-l;i++) { hj)=h_n; S=S_nodes[it] [i] ; h_n=S_steps[it] [i] ; a=pow(S*vol(t,S),2); b=a/h_p; 4.6. Levy Driven Assets 123 c=a/h_n; d=r*S; A(i, i)=e*(b+c+r*(hjp+h_n))+ A(i, i-1)=e*(-b+d)+hjp/6; A(i,i+1)=e*(-c-d)+h_n/6; } h_p=h_n; S=S_nodes[it][i]; h_n=S_steps[it][i]; a=pow(S*vol(t,S) ,2) ; b=a/h_p; c=a/h_n; d=r*S; A(i,i)=e*(b+c+r*(h_p+h_n))+ A(i,i-l)=e*(-b+d)+h_p/6; (h_jp+h_n)/3; (h_p+h_n)/3; f o r ( i =0 ; i < n , - i + + ) { S=S_nodes[it][i]; double Sn=S_nodes[it] [i+1]; h_n=S_steps[it] [i] ; f o r ( i n t j = -bandwidth+1;j <bandwidth;j ++) if ( ( i + j < n ) & & ( i + j > = 0 ) ) { param[0]=S_nodes[it][i+j-1]; param[l]=S_nodes[it] [ i + j ] ; param[2]=S_nodes[it][i+j+1]; param[3]=Sn/h_n; param[4]=-1./h_n; double * sing=new double[2]; sing[0]=S; sing[1]=Sn; if ( i + j > 0 ) F.function=& fu_I; else F.function=&fu_I_0; F.params=param; gsl_integration_qagp(&F,sing,2, 0 , 0 . 0 0 1 , s i , w , & r e s , & e r r ) ; A(i,i+j)-=e*res; if ( i < n - l ) { param[3]=-S/h_n; param [4] =1. /h_n,F.params=param; gsl_integration_qagp(&F,sing,2, 0, 0.001,si, w,&res,&err); A(i+l, i+j) -=e*res,} } } build_rhs(P[it],P[it-l],S_steps[it],S_nodes[it] , it) ; A.LUO ; A. Solve(P[it] , P [ i t ] ) ; } 124 Chapter 4. The Finite Element Method We skip the description of the function build_rhs. Note that the algorithmic complexity for constructing the matrix and the right- hand side is O(N2), so it is one order larger than for the standard Black-Scholes equation with local volatility. There are ways of improving this: either by using a wavelet basis (see [95, 94] for a sophisticated procedure using nonuniform time meshes and wavelet compression in the price variable— this method can be used for barrier options and American options for Levy driven assets) or by using the fast Fourier transform [24], with a narrower range of applications. Numerical Results. We take a = 0, C = 1, M = 2.5, G = 1.8, so the Levy process is a pure jump process. In Figure 4.7, we plot the price of a put with strike K = 100 one year to maturity for several values of Y. In Figure 4.8, we plot the price as a function of time to maturity and of S for Y = 0.5. We see also that even with such a nonuniform mesh, the scheme is stable. In Figure 4.9, we plot the solution computed with a = 0, C = 1, M = 2.5, G = 1.8, and Y = 0.9 and by treating the nonlocal term fully explicitly (b = 0 in (4.35)), we see that instabilities develop. With the same parameters and mesh, taking b = 2 suffices to stabilize the scheme. In Figure 4.10, we set a = 0.1 and we compare the price given by the Black-Scholes formula with prices of CGMY driven assets for Y = 0, 0.5, 0.9, w i t h C = 1,M = 2.5, G= 1.8. Figure 4.7. A put option on a CGMY driven asset for Y = 0, Y = 0.2, and Y = 0.9. 4.6. Levy Driven Assets 125 Figure 4.8. A put option on a CGMY driven asset for Y = 0.5 as a function of S and t. Figure 4.9. Instabilities caused by a fully explicit treatment of the nonlocal term. 126 Chapter 4. The Finite Element Method Figure 4.10. Comparison between the price of a put computed by the BlackScholes formula with a = 0.1 and puts on CGMY driven assets with a = 0.1 and Y = 0, 0.5,0.9. 4.7 4.7.1 Programs for Two-Dimensional Cases Options on a Basket of Assets We consider an option on a basket of two assets whose price is obtained by solving the variational problem (2.70), (2.71), where the bilinear form a is given by where the domain Q is the rectangle (0, 50 x (0, Si). Let a triangulation of Q be obtained by three families of parallel lines (like a finite difference mesh where the mesh rectangles are divided into two triangles using always the same diagonal). Using the basis (U>'),<AT of the shape functions introduced in §4.2.5 (N is the number of vertices in Q), and a lexicographic ordering of the degrees of freedom, the matrix A has generally nine nonzero diagonals (it may be pentadiagonal in the case when Si2 = Sii = 0). The bandwidth, i.e., max{|i — j | : A,7 ^ 0}, is of the order of */N. A direct solution of the system of linear equations by the Gauss factorization algorithm is not the best method when N is large; it is better to use a biconjugate or GMRES method, or simply a conjugate gradient method [69] if the drift term has been treated explicitly in the time discretization; see [81,106,107,113] for descriptions of advanced iterative methods for systems of linear equations; note also that 4.7. Programs forTwo-Dimensional Cases 127 for a more general mesh, the matrices M and A are not pentadiagonal, but they are sparse. The iterative methods do not need the matrix A but only a function which implements U —> At/, i.e., which computes fl(]C,-ujw^ w')i if U = (u\, ..., u^)T. To compute At/, we use the fact that where A*U is the vector whose entries are a/jrCC/ ujwj)i w '> * — 1, • • •, W, and where Hence We shall also use (4.17) and (4.19). For simplicity only, let us consider only the first term in (4.38), so aK becomes and But Vw' is constant on K and Sk = Y^l=i sk,vtf, so from (4.19) and (4.20), The summation (4.39) should not be programmed directly like 128 Chapter 4. The Finite Element Method because the numerical complexity will then be of order N2NT, where NT is the number of triangles in Th. One should notice that the sums commute, i.e., and then see that A,^ is zero when ql or qj is not in AT, so that effectively one has This technique is called assembling. The complexity is O(Nt) now. It has brought up the fact that vertices of triangle K have global numbers (their positions in the array that store them) and local numbers, their positions in the triangle K, i.e., 1,2, or 3. The notation inoc refers to the map from local to global. Therefore, one should compute tfloci.loc', from (4.40) and (4.17), we have that where n^loc is thefcthcoordinate ofnliloe. It helps a little to note that Elnl is the edge qi+qi++ rotated counterclockwise by 90° in the triangle (ql, ql+, ql++) provided that the numbering is counterclockwise too: We split the computation of U \-> (aM + A)£7 into two parts corresponding, respectively, to the bilinear forms and to enable an explicit treatment of the nonsymmetric part of A. Doing so, it is possible to use the well-known conjugate gradient algorithm [69, 81] to solve the systems of linear equations at each time step, because the matrix of the system is symmetric and positive definite. It is also possible to use a fully implicit method, but then one must choose other iterative methods like BICGSTAB [113] or GMRES [107, 106]. 4.7. Programs for Two-Dimensional Cases 129 Thus the main part of the program will be as follows. ALGORITHM 4.10. Two-dimensional Black-Scholes. void aMul(Vec& au, Grid& g, Vec& u, double alpha, double sll, double s!2, double s22,double a) { double kll,k!2,k22; for(int i=0; i<g.nv/i++) au[i] = 0; // init au for(int k=0; k<g.nt;k++) // loop on triangles { kll=0; k!2=0; k22=0; for (int iv=0;iv<3;iv++) { int i = g (k, iv) ; kll+= sll*pow(g.v[i] . x , 2 ) ; k!2+= 2 * s l 2 * g . v [ i ] . x * g . v [ i ] . y ; k22+= s 2 2 * p o w ( g . v [ i ] . y , 2 ) ; for (int j v = 0 ; j v < 3 ; j v + + ) { int j= g ( k , jv) ; kll+= sll*g.v[i] . x * g . v [ j ] .x; k!2+= s!2*g.v[i] . x * g . v [ j ] .y; k!2+= s ! 2 * g . v [ i ] . y * g . v [ j ] . x ; k22+= s22*g.v[i] .y*g. v[j ] .y; } } f o r ( i n t iloc = 0; iloc < 3; iloc++) { int i = g ( k , i l o c ) ; int ip = g ( k , ( i l o c + l ) % 3 ) ; int ipp= g ( k , (iloc+2)%3) ; for(int jloc = 0; jloc<3; jloc++) { if } } } } int j = g ( k , j l o c ) ; int jp = g ( k , ( j l o c + l ) % 3 ) ; int jpp= g ( k , ( j l o c + 2 ) %3) ; double aijk = a* (k22* (g.v[jpp] .x - g . v [ j p ] . x ) *(g.v[ipp].x - g.v[ip] .x) +kll* (g.v[jpp] .y - g . v [ j p ] . y ) *(g.v[ipp].y - g.v[ip].y) +k!2* ( ( g . v f j p p ] .x - g . v [ j p ] . x ) *(g.v[ipp].y - g.v[ip].y) + ( g - v [ j p p ] . y - g - v [ j p ] .y) *(g.v[ipp].x - g . v [ i p ] . x ) ) ) / g . t [ k ] . a r e a / 9 6 . ; if (!g.v[i].where) au [i] += aijk * u [j ] ; (!g.v[i].where) au[i] += (u [i] *2 .+u|'ip]+u [ipp] ) * g . t [ k ] . a r e a * alpha/ 12.; 130 Chapter 4. The Finite Element Method void bMul(Vec& bu, Grid& g, Vec& u, double bl, double b2, double sll, double s!2, double s22) { double rsl,rs2; double sll_, s!2_, s22_; rsl=bl/12; rs2=b2/12; sll_=-sll/24; sl2_=-s!2/24; s22_=-s22/24; for(int i=0; i<g.nv; i++) bu[i] = 0; for(int k=0; k<g.nt;k++) { doub1e Kgradu1=0; doub1e Kgradu2 = 0; f o r ( i n t iloc = 0; iloc < 3; iloc++) { int i = g ( k , i l o c ) ; int ip = g ( k , (iloc+1)%3); int ipp= g ( k , ( i l o c + 2 ) % 3 ) ; Kgradul+=u[i]*(g. v [ i p p ] . y - g . v [ i p ] . y ) /2; Kgradu2-=u[i]*(g.v[ipp].x-g.v[ip].x)/2; } for(int iloc = 0; iloc < 3; iloc++) { int i = g ( k , i l o c ) ; bu[i]+=rsl* Kgradul*g.v[i].x+rs2* Kgradu2*g.v[i].y; bu[i]+=sll_* Kgradul*g.v[i] .x+s!2_* Kgradul*g.v[i] .y; bu[i]+=s!2_* Kgradu2*g.v[i].x+s22_* Kgradu2*g.v[i].y; for (int j loc = 0; jloc<3; jloc-(-+) { int j = g ( k , jloc) ; bu[i]+=rsl* Kgradul*g.v[j].x+rs2* Kgradu2*g.v[j].y; bu[i]+=sll_* Kgradul*g.v[j].x+s!2_* Kgradul*g.v[j].y; bu[i]+=s!2_* Kgradu2*g.v[j].x+s22_* Kgradu2*g.v[j].y; } } } } With a fixed time step, the number of conjugate gradient iterations scales like the number of nodes. To avoid such an unpleasant behavior, one has to use a preconditioned conjugate gradient method with a good preconditioner. Although it is beyond the scope of this book, we advocate the use of multigrid or algebraic multigrid preconditioners; see [96] and references therein. In Figures 4.11 and 4.12, we plot the price of a put 0.7 years to maturity, with payoff functions given by (2.65) and (2.64). The full program is given in the appendix (§4.10). 4.7. Programs for Two-Dimensional Cases 131 Figure 4.11. The price of a put option on a basket of two assets 0.7 years to maturity. The coefficients are r = 0.1, EH = 322 = 0.04, Ei2 = —0.012, P0 given by (2.65) with K = 100 computed with three different meshes with, respectively, 497, 1969, and 7733 nodes. The time step is 0.01 years. Figure 4.12. The price of a put option on a basket of two assets 0.7 years to maturity. The coefficients are r = 0.1, E11= S22 = 0.04, Ei2 = —0.012, P0 given by (2.64) with K = 100 computed with a mesh with 1969 nodes. The time step is 0.01 years. 132 Chapter 4. The Finite Element Method Figure 4.13. The price of a put option on a basket of two assets computed with different boundary conditions: first the finite element method described in §4.7.1; second the same method but imposing Dirichlet conditions at 5, =0", i = 1,2, whose data are obtained by solving one-dimensional Black-Scholes equations. The two surfaces are indistinguishable. Project 4.1. For a basket option with two assets, compare several boundary conditions. For some of them, one can use a finite difference discretization. Use a Gauss-Seidel method to solve the systems of linear equations. In Figure 4.13, we have plotted the price of a put option obtained with two kinds of boundary conditions. Project 4.2. Test the program given in the appendix below (§4.10), and run it (no special boundary condition is imposed on the lines S\ = 0, £2 = Q). Modify the method by imposing the traces on the lines Si = 0 and 82 = 0 (these trace functions are obtained by solving one-dimensional parabolic problems). Does it give better results? Project 43. In the program given in the appendix below, replace the conjugate gradient by a biconjugate gradient, BICGSTAB, or GMRES (the source codes for these methods are freely distributed on many web sites), and treat the first order terms implicitly. Project 4.4. Take a basket European put option, and make the change of variables Si -> Si/(l + Si), i = 1, 2, which maps (M+)2 onto the unit square. Modify the program given in the appendix below in order to solve the new boundary value problem and compare. A mesh adapted to the case (see Chapter 5) may be generated with freeFEM (http://www.freefem. org). 4.7. Programs for Two-Dimensional Cases 4.7.2 133 A Stochastic Volatility Model We consider the partial differential equation (2.87) obtained in §2.7. The partial differential equation is rewritten in terms of r — T — t and in divergence form as A semi-implicit in time finite difference discretization is applied: Let Vh be the space of continuous piecewise linear functions on a triangulation of the square ft := (0, LJC) x (—Ly, Ly) which are equal to zero on the Dirichlet boundaries of the problem. We consider the following finite element discretization: For p — 0, the aim is to approximate P in the domain (0, 5) x (— 1.5, 1.5) for t smaller than 1. We choose S = 800. For computing the solution, we discretize (2.87) in the larger domain (0, 800) x (—y, y) with y > 1.5. We use artificial homogeneous Dirichlet conditions on the boundaries y = ±y. These conditions, which are obviously not satisfied by P, induce nevertheless small errors on P in the smaller domain (0, 800) x (—1.5, 1.5) because the advection terms are strong near the top and bottom boundaries, and directed outward, so the bad effects of the wrong artificial boundary conditions are limited to a boundary layer near y = ±y. We take y = 3. In Figure 4.14, we plot the price of the put option one year to maturity performed with the parameters with a time step of 6 days. There is a Neumann boundary condition on the boundary x = S. No boundary condition is needed on x = 0 because of the degeneracy of the equation. Remark 4.6. The choice ofa=l is not quite realistic from a financial viewpoint if the asset is linked to stocks, because the mean reversion rate is generally larger. When the asset 134 Chapter 4. The Finite Element Method Figure 4.14. The price of a put option with stochastic volatility one year to maturity: two views. corresponds to interest rates, smaller values of a are reasonable. When the mean reversion rate is large, it is possible to carry out an asymptotic expansion of the solution as in [51], and we believe that the variational setting introduced above permits us to fully justify these expansions. We give below the new functions aMul and bMul used for the systems of linear equations. ALGORITHM 4.11. Stochastic volatility. void aMu!2 (Vec& au, Grid& g, Vec& u, double alpha, double sll, double s!2, double s22,double a) { double kll,kl2,k22; int k,i,ip,ipp,j,jp,jpp; for(i=0; i<g.nv;i++) 4.7. Programs for Two-Dimensional Cases 135 au [ i] = 0; for(k=0; k<g.nt;k++) { double int_Kx2y2=0; double int_Kxabsy=0; for (int iloc=0;iloc<3;iloc++) { i= g ( k , i l o c ) ; for (int jloc=0;jloc<3;jloc++) { j = g(k, jloc) ; for (int l l o c = 0 ; l l o c < 3 ; l l o c + + ) { int 1 = g ( k , l l o c ) ; for (int mloc=0 ;mloc<3;mloc++) { int m = g ( k , m l o c ) ; int c [ 3 ] ; c[0]=0; c[l]=0; c[2]=0; c [iloc] + + ; c [ j loc] ++; c [Hoc] + + ; c [mloc] ++; int nl=l;int n2=l;int n3=l;int n4=l; for(int p=l;p<=c[0];p++) nl*=p; f o r ( i n t p=l;p< = c [1] ;p++) n2*=p; for(int p=l;p<=c[2];p++) n3 * =p; for (int p=l,-p<=c [0] +c [1] +c [2] + 2 ; p + + ) n4*=p; int_Kx2y2+=double(2*nl*n2*n3)/n4*g.v[i].x*g.v[j] .x*g.v[l].y*g.v[m].y; } } } } // int_Kx2y2*=2; for (int iloc=0;iloc<3;iloc++) { i= g(k,iloc); int_Kxabsy+=2*g.v[i].x*abs(g.v[i].y)/12; for (int jloc=iloc+l;jloc<3;jloc++) { j = g(k, jloc) ,- int_Kxabsy+= ( g . v [ i ] .x*abs ( g . v [ j ] .y) +g. v [ j ] .x*abs ( g . v [ i ] . y ) ) / 1 2 j } } kll=sll*int_Kx2y2; kl2=s!2*int_Kxabsy; k22=s22; f o r ( i n t iloc = 0; iloc < 3; iloc++) { i = g(k,iloc); ip = g ( k , ( i l o c + l ) % 3 ) ; 136 Chapter 4. The Finite Element Method ipp= g(k, (iloc+2)%3) ; for(int jloc = 0; jloc<3; jloc++) { j = g(k,jloc); jp = g(k, (jloc+l)%3) ; jpp= g(k,(jloc+2)%3); double a i j k = a * ( k 2 2 * ( g . v [ j p p ] . x - g . v [ j p ] . x ) *(g.v[ipp].x - g.v[ip].x) +kll* ( g . v [ j p p ] .y - g . v [ j p ] .y) *(g.v[ipp].y - g.v[ip].y) +k!2* ( ( g . v t j p p ] .x - g . v t j p ] .x) * ( g . v [ i p p ] . y - g . v [ i p ] .y) + (g.v[jpp] .y - g . v t j p ] .y) * (g.vfipp] .x - g . v [ i p ] . x ) ) ) /g.t [k] . a r e a / 4 . ; if if ( ! g . v [ i ] .where) a u t i ] += aijk * u [ j ] ; } (!g.v[i].where) au[i] += (u [i] * 2 . + u [ i p ] + u [ i p p ] ) * g . t [ k ] . a r e a * alpha/ 12.; } } } void bMu!2(Vec& bu, Gridfc g, Vec& u, double alpha, double rhobeta2, double alpham, double r) { double rsl,rs2,rs3; rsl=r/12; rs2=-alpha/12; rs3=rhobeta2/12; f o r ( i n t i = 0 ; i<g.nv; i + + ) bu[i] = 0; for(int k=0; k<g.nt;k++) { doub1e dxu= 0; double dyu=0; for(int iloc = 0; iloc < 3; iloc++) { int i = g(k,iloc); int ip = g(k,(iloc+l)%3); int ipp= g(k, (iloc+2)%3); dxu-=u[i]*(g.v[ipp].y-g.v[ip].y)/2; dyu+=u[i]*(g.v[ipp].x-g.v[ip].x)/2; } for(int iloc = 0; iloc < 3; iloc++) { int i = g(k,iloc); for (int jloc=0;jloc<3;jloc++) { int j = g(k,jloc); for (int lloc=0;lloc<3;lloc++) 4.7. Programs for Two-Dimensional Cases 137 { int 1 = g ( k , IIc) ; for (int mloc=0 ,-mloc<3 ,-mloc++) { int m = g ( k , m l o c ) ; int c[3] ; c[0]=0; c[l]=0; C[2]=0; c [Hoc] + + ; c [jloc] + + ; c [Hoc] + + ; c [mloc] ++; int nl=l;int n2=l;int n3=l;int n4=l; f o r ( i n t p = l ; p < = c [0] ,-p++) nl*=p; f o r ( i n t p = l ; p < = c [1] ,-p++) n2*=p ; for(int p=l;p<=c[2];p++) n3*=p ; for (int p=l;p<=c [0] +c [1] +c [2] +2,-p++) n4*=p; if (!g.v [i] .where) bu[i]-=dxu*double(2*nl*n2*n3)/n4 * g . v [ j ] .x*g.v[l] .y*g.v[m] .y; } } } if ( !g.v[i] .where) { double signy= (g.v[i].y>0)?1:-1; b u [ i ] + = ( r s l - signy*rs3 ) * dxu*g.v[i].x+(rs2-signy*rs3) * dyu*g.v[i].y+alpham*dyu/3; f o r ( i n t jloc = 0; jloc<3; j l o c + + ) { int j = g (k, j loc) ; signy= ( g . v [ j ] . y > 0 ) ? 1 : - 1 ; if ( ! g . v [ i ] . w h e r e ) b u [ i ] + = ( r s l - signy*rs3 ) * d x u * g . v [ j ] . x + (rs2-signy*rs3) * dyu*g. v [j ] .y; } } } } // // i triangles }_ 4.7.3 Matrix Storage: The Compressed Sparse Row Format Since the matrices A, M do not depend on time and since the matrix-vector products have to be performed many times, it is much more efficient to compute the matrices once and for all and store them. Of course, only the nonzero entries must be stored; a popular format for sparse matrices is called the compressed sparse row format (also called Morse format): 138 Chapter 4. The Finite Element Method • the nonzero entries of the matrix A are stored in a large vector double * ent_a, and the nonzero entries of a given row are contiguous in the vector; • the addresses in the vector ent_a of the first nonzero entry of each row are stored in a vector int * first_in_row_a, whose size is the number of rows; • the column indices corresponding to the nonzero entries are stored in a vector int * col_a, whose size matches that of ent_a. The code for assembling the symmetric part of A and storing it in the compressed sparse row format uses the standard template library of C++, particularly the container map. ALGORITHM 4.12. Compressed sparse row storage. void build_a(Grid& g, double alpha, double sll, double s!2, double s22,double a, map<pair_int, double, std::less<pair_int> > & entries) { double kll,kl2,k22; int k,i,ip,ipp,j,jp,jpp; if (a>0) { for(k=0; k<g.nt;k++) { double int_Kx2y2=0; double int_Kxabsy=0; for (int iloc=0;iloc<3;iloc++) { i= g(k,iloc); for (int j l o c = 0 ; j l o c < 3 ; j l o c + + ) { j = g ( k , jloc) ; for (int lloc=0;lloc<3;lloc++) { int 1 = g ( k , l l o c ) ; for (int mloc=0,-mloc<3 ,-mloc++) { int m = g(k,mloc); int c[3] ; c[0]=0; C[l]=0; c[2]=0; C [iloc] ++;c [jloc] ++; c [Hoc] ++;c [mloc] ++; 4.7. Programs for Two-Dimensional Cases 139 int n l = l ; i n t n 2 = l ; i n t n 3 = l ; i n t n 4 = l ; for(int p = l ; p < = c [ 0 ] ; p + + ) nl*=p ; for(int p=l;p<=c[1];p++) n2*=p; f o r ( i n t p = l ; p < = C [2] ; p + + ) n3*=p; for(int p=l;p< = c [ 0 ] + c [ l ] + c [ 2 ] + 2 ; p + + ) n4*=p; int_Kx2y2+=double(2*nl*n2*n3)/n4*g.v[i] . x * g . v [ j ] .x *g.v[l] .y*g.v[m] .y; } } } } for (int iloc=0;iloc<3;iloc++) { i= g(k,iloc); int_Kxabsy+=2*g.v[i] .x*abs(g.v[i] .y)/12; for (int jloc=iloc+l;jloc<3;jloc++) { j = g(k, jloc) ; int_Kxabsy+= (g. v[i] .x*abs (g. v[j ] .y) + g . v [ j ] .x *abs(g.v[i].y))/12; } } kll=sll*int_Kx2y2; kl2=s!2*int_Kxabsy; k22=s22; for(int iloc = 0; iloc < 3; iloc++) { i = g(k,iloc); ip = g(k,(iloc+l)%3); ipp= g(k,(iloc+2)%3); for(int jloc = 0; jloc<3; jloc++) { j = g(k, jloc) ; jp = g(k, (jloc+l)%3) ; jpp= g(k,(jloc+2)%3); double aijk = a* (k22* (g.v[jpp] .x - g . v [ j p ] . x ) * ( g . v [ i p p ] . x - g.v[ip] .x) +kll* (g.v[jpp] .y - g . v [ j p ] .y) * ( g . v [ i p p ] . y - g.v[ip] .y) +k!2* ( (g.v[jpp] .x - g . v [ j p ] .x) * ( g . v [ i p p ] . y - g.v[ip] .y) + ( g - v [ j p p ] .y - g . v t j p ] - y ) * ( g . v f i p p ] .x - g.v[ip] .x) ) ) / g . t [ k ] .area/4. ; pair_int auxp; auxp[0] =i; auxp[l]=j ; pair <map<pair_int,double, less<pair_int > >::iterator, bool> pit; pair< pair_int,double> val; val.first=auxp; val.second=aijk; 140 Chapter 4. The Finite Element Method pit=entries.insert(val); if (pit.second==false) (*(pit.first)).second += aijk; } } } } if(alpha>0) for(k=0; k<g.nt;k++) for(int iloc = 0; iloc < 3; iloc++) { i = g(k,iloc); pair_int auxp; auxp[0]= i; auxp[1]= i; pair <map<pair_int,double, less<pair_int > >::iterator, bool> pit; pair< pair_int,double> val; val.first=auxp; val.second=g.t[k].area * alpha/ 6.; pit=entries. insert (val) ,• if (pit.second==false) (*(pit.first)).second += val.second; for (int jloc=l;jloc<3;jloc++) { ip = g(k,(iloc+jloc)%3); auxp[0]= i ; auxp [1]=ip; val.first=auxp; val.second=g.t[k].area * alpha/ 12.,• pit=entries.insert(val); if (pit.second==false) (* (pit.first)).second += val.second; } } } int main() { Grid g("mesh6_VS.msh") ; // triangulated square map<pair_int, double, std: : less<pair_int> > entries,for(int i=0; i<g.nv; i++) // a hack to put axis at Neumann conditions i f ( g . v [ i ] .where == 2| |g.v[i].where==4 ) g.vfi].where = 0; double * ent_stiff_sym; int * col_stiff_sym; int * first_in_row_stiff_sym; int size_stiff_sym,int k,j ; map<pair_int,double, less<pair_int > >::iterator it; build_a(g, r+1./dt,sll,s!2,s22,1..entries); ent_stif f_sym=new double [entries .size () ] ; 4.8. Programming in Dimension d > 2 141 col_stiff_sym=new i n t [ e n t r i e s . s i z e ( ) ] ; first_in_row_stiff_sym=new i n t [ g . n v ] ; k=-l; j = -l; for(it=entries.begin();it!=entries.end();it++) { j++; ent_stiff_sym[j]= (*it).second; col_stiff_sym[j]= ( * i t ) . f i r s t [1] ; if ( ( * i t ) . f i r s t [ 0 ] ! = k ) { k++; first_in_row_stiff_sym[k] =j; } } size_stiff_sym=entries.size(); entries.clear 0 ; ] Assembling the mass matrix and the nonsymmetric part of A are done similarly. The matrix-vector product is as follows. ALGORITHM 4.13. Matrix-vector product. void Mul(Vec& bu, Grid& g, Vec& u, double * ent, int * col, int * first_in_raw, int & size_of_ent) { int i ; for( i=0; i<g.nv;i++) bu[i] = 0; for( i=0;i<g.nv-l;i++) if ( !g.v[i] .where) for(int j=first_in_raw[i];j<first_in_raw[i+1];j++) bu[i]+= ent [ j ] * u [ c o l [ j ] ] ; if ( ! g . v [i] .where) for(int j=first_in_raw[i];j<size_of_ent;j++) b u [ i ] + = ent [j] *u[col [j] ]; } 4.8 Programming in Dimension d > 2 There are more and more financial products built on several assets, so the numerical solution of the Black-Scholes equation in higher dimension is a current area of research. In three dimensions the finite element method is used intensely in engineering, so some of the engineering software can be used. For example, Figure 4.15 shows the solution obtained with f f 3d [40] by the finite element method with quadrangles of the BlackScholes equation for a European put with r = 0, al• = 0.1 * i, cr,; — —0.1, i, j = 1, 2, 3, and payoff 142 Chapter 4. The Finite Element Method The computational domain is the intersection of the cube (0, 1 )3 with the unit sphere centered atO. 4.9 High Dimensions: An Introduction to Galerkin Methods with Sparse Tensor Product Spaces For parabolic problems in space dimensions d > 3, the finite element and finite difference methods fail, because they require typically O(h~d) degrees of freedom for an accuracy of O(h} in the energy norm. For this reason, a popular cliche says that only Monte-Carlo methods can be applied for high-dimensional problems. Yet quite recent developments have shown that it is possible in some cases to use deterministic Galerkin methods or grid-based methods for parabolic problems in dimensions d for 4 < d < 20: these methods are based either on sparse grids [ 118,65,63] or sparse tensor product approximation spaces [64,114]. For a recent survey on sparse grids, a good reference is [23]. Here we give a brief survey of a paper by Petersdoff and Schwab [114]. The full results contained there are of great interest but rather technical and beyond the scope of the present book. For convenience, we restrict ourselves to sparse tensor product finite element spaces constructed with one-dimensional piecewise affine functions. The construction of the approximation space involves wavelets: for simplicity, we focus on a very simple example of wavelets. 4.9.1 Wavelets in M In the interval / = [0, 1], we define the mesh Te whose nodes are xj = j2~e~l, j — 0 , . . . , 2i+1. We define V1 as the space of piecewise linear continuous functions on the mesh Tl vanishing at 0 and 1. The dimension of V£ is N*- = 2£+1 — 1. We define ML = Nl - N*'1 = 2£. For t > 0, we define the wavelets VJ, j = 1, • • •, Ml, at level £, by where the normalization constant is chosen in order to achieve || ^rj || £2 = I f o r l < j < M . The support of ^frj has diameter less than 22~i. The first three levels are displayed on Figure 4.16. For t > 0, we define Wl = spantyj, 1 < j < M1} and W° = V°: we have V1 = Wl 0 Vl~\ and V1 = 0f=0 Wk. Each function v of VL has the representation v = Y^k=o SyLi u; tf > an<^ ^ *seasv to cneck that most of the wavelets belonging to levels k and I with \k — t\ > 1 are orthogonal for the L2 and H1 scalar products. 4.9. Introduction to Sparse Approximations for High Dimensions 143 Figure 4.15. A put option built on three underlying assets. On the top the payoff and the computational domain projected on a cube. On the bottom the solution on the sphere fl(0, 0.5). The following properties can also be checked: with c and C independent of t. 144 Chapter 4. The Finite Element Method Figure 4.16. The wavelet basis: the first three levels. Figure 4.17. A representation of the full tensor product space for d = 2 (for t = 0. 1. 2). 4.9.2 Sparse Tensor Product Spaces For a parabolic equation in Q = (0, 1)J, a natural choice for a discrete space is the tensor product space Vh = V* 0 • • • ® Vfc = Y^o<k,<t wkl ® ''' ® ^''- Tne dimension of V/, is (2 t+1 + 1)J, so it grows very rapidly with d. We shall use instead the sparse tensor product space Vh — Ylki+--+k,<t Wkt <8> • • • <8> Wki<, whose dimension is O(td2t). The space V/, is considerably smaller than Vh and can be used for practical computations for d < 20. A schematic representation of the spaces V/? and V/, are displayed in Figures 4.17 and 4.18. Consider the discretization of an elliptic Dirichlet problem in Q: the discretization error of the Galerkin method with the space Vh (resp., V/,) is of the same order as the best fit error when approximating the solution of the continuous problem by a function of Vh (resp., Vh). We know that inf ( 1 / e ^ ||u — u/,||//i ( n) < Ch v\H2(n), where h = 2 ~ f , and M#: (n) = ZLti+-+*,=? II kf'v. k lt Ilij/n)- Since V/, is much smaller than V h a similar <ir, .-.'iv(/ estimate is not true. However, the following estimate has been proved (see [64, 114]): 4.9. Introduction to Sparse Approximations for High Dimensions 145 Figure 4.18. A representation of the sparse tensor product space for d = 2 (for t = 0, 1, 2). where is endowed with its natural norm and seminorm. We see that the Galerkin method with the space Vh converges linearly in h provided the solution to the continuous problem belongs to K 2 (fi) (which is a much smaller space than #2(£2)). When dealing with a homogeneous parabolic problem such as (2.61) with smooth coefficients, Petersdoff and Schwab [114] made use of the smoothing property of the parabolic operator and designed a method based on sparse tensor product spaces as above, even if the Cauchy data are not smooth: indeed, for any Cauchy data, the solution to the problem belongs to "H2(£2) for all positive time, so the sparse tensor product space will be large enough to approximate the solution at t > 0 in an optimal way. Yet, when the Cauchy data are not smooth enough, the %2-norm of the solution blows up as t -» 0. This is the case for options with nonsmooth payoff functions. To compensate for this, Petersdoff and Schwab [114] proposed using a time stepping with a very nonuniform time grid suitably refined 146 Chapter 4. The Finite Element Method near t — 0. This yields a sophisticated method which enables one to price basket options with up to twenty assets. Similar ideas have been used for pricing options under stochastic volatility in [71]. 4.10 Appendix: The Full Program for Two-Dimensional Black-Scholes ALGORITHM 4.14. Two-dimensional Black-Scholes. // ^include <iostream> ^include <fstream> ^include <math.h> ^include <cmath> ^include <stdlib.h> ^include <assert.h> ^include "RNM.hpp" tfdefine NDEBUG using namespace std; typedef KN<double> // file : BS2DfemCG.cpp uncomment when debugging is over Vec; class Vertex { public: double x, y; int where; // // coordinates on which boundary }; class Triangle { public: Vertex* v[3]; int where; double area; // the 3 vertices of the triangle // in which region }; class Grid { public: int nt, nv; // nb of triangles, vertices, and edges KN<Vertex> v; // all vertices KN<Triangle> t; // all triangles Grid(const char *path ); // reads a triangulation in freeFEM format int no(Triangle* tt) const { return tt-( Triangle*)t;} // the place in // array t of triangle tt int no(Vertex* tt) const { return tt-( Vertex*)v;} // the place in // array v of Vertex tt 32 int operatorO (int k,int iloc) const { return no (t [k] . v[iloc] ) ; } // same as no(vertex) }; Grid::Grid(const char *path ):v(),t() { // reads a triangulation in freeFEM format int iO,il,i2; 4.10. Appendix: The Full Program for Two-Dimensional Black-Scholes ifstream file(path); if (Ifile) cout«"can t find triangulation file"«endl; file » nv » nt; v.init(nv); t.init(nt); for(int i=0; i<nv/ i++ ) f i l e » v [ i ] . x » v [ i ] . y » v [ i ] .where; f o r ( i n t i = 0 ; i<nt; i++ ) { file » iO » il » i2 » t[i].where; t [i] . v [ 0 ] = & v [ i O - l ] ; t [i] . v [ l ] = & v [ i l - l ] ; t [i] . v [ 2 ] = & v [ i 2 - l ] ; t [ i ] . a r e a = ( (t [i] . v [1]->x - t [i] . v [ 0 ] - > x ) * (t [i] . v [ 2 ] - > y - t [ i ] . v [ 0 ] ->y) (t[i] .v[2]->x - t[i] .v[0]->x) * ( t [ i ] .v[l]->y - t[i] . v [ 0 ] - > y ) ) / 2 ; } } void bMul(Vec& bu, Grid& g, Vec& u, double alpha, double bl, double b2, double sll, double s!2, double s22) { double rsl,rs2; double sll_,s!2_,s22_; rsl=bl/12; rs2=b2/12; sll_=-sll/24; Sl2_=-sl2/24; s22_=-s22/24; for(int i=0; i<g.nv; i++) bu[i] = 0; f o r ( i n t k=0; k < g . n t ; k + + ) { double Kgradul=0; double Kgradu2=0; for(int iloc = 0; iloc < 3; iloc++) { int i = g(k,iloc); int ip = g(k,(iloc+l)%3); int ipp= g(k,(iloc+2)%3); Kgradul+=u[i]*(g.v[ipp].y-g.v[ip].y)/2; Kgradu2-=u[i]*(g.v[ipp] .x-g.v [ i p ] . x ) / 2 ; } for(int iloc = 0; iloc < 3; iloc++) { int i = g(k,iloc); bu[i]+=rsl* Kgradul*g.v[i].x+rs2* Kgradu2*g.v[i].y; bu[i]+=sll_* Kgradul*g.v[i].x+s!2_* Kgradul*g.v[i].y; bu[i]+=s!2_* Kgradu2*g.v[i].x+s22_* Kgradu2*g.v[i].y; f o r ( i n t jloc = 0; jloc<3; j l o c + + ) { int j = g (k, j loc) ,• bu[i]+=rsl* Kgradul*g.v[j].x+rs2* Kgradu2*g.v[j].y; 147 148 Chapter 4. The Finite Element Method b u [ i ] + = s l l _ * Kgradul*g.v[j] .x+s!2_* K g r a d u l * g . v [ j ] .y; bu[i]+=s!2_* Kgradu2*g.v[j] .x+s22_* K g r a d u 2 * g . v [ j ] .y; } } } } void aMul(Vec& au, Grid& g, Vec& u, double alpha, double sll, double s!2, double s22,double a) { double kll,k!2,k22; for(int i=0; i<g.nv;i++) au[i] = 0 ; // init a u for(int k=0; k<g.nt;k++) // loop on triangles { kll=0; k!2=0; k22=0; for (int i v = 0 ; i v < 3 ; i v + + ) { int i = g ( k , i v ) ; kll+= sll*pow(g.v[i] . x , 2 ) ; k!2+= 2*sl2*g.v[i] .x*g.v[i] .y; k22+= s 2 2 * p o w ( g . v [ i ] . y , 2 ) ; for (int j v = 0 ; j v < 3 ; j v + + ) { int j= g ( k , j v ) ; kll+= sll*g.v[i] . x * g . v [ j ] .x; k!2+= s!2*g.v[i] .x*g.v [j ] .y; k!2+= s!2*g.v[i] .y*g. v [ j ] . x ; k22+= s22*g.v[i] . y * g . v [ j ] .y; } } for(int iloc = 0; iloc < 3; iloc++) { int i = g ( k , i l o c ) ; int ip = g ( k , ( i l o c + l ) % 3 ) ; int ipp = g ( k , ( i l o c + 2 ) % 3 ) ; for(int jloc = 0; jloc<3; jloc++) { int j = g ( k , j l o c ) ; int jp = g ( k , (jloc + l ) % 3 ) ; int jpp = g ( k , (jloc+2) %3) ; double aijk = a* (k22* (g.v[jpp] .x - g . v [ j p ] . x ) * ( g . v [ i p p ] . x - g.v[ip] .x) +kll* (g.v[jpp] .y - g - v [ j p ] .y) *(g.v[ipp].y - g . v f i p ] . y ) +k!2* ( ( g . v [ j p p ] .x - g . v f j p ] .x) * ( g . v [ i p p ] . y - g . v f i p ] .y) + ( g - v [ j p p ] . y - g . v [ j p ] .y) *(g.v[ipp].x - g . v [ i p ] . x ) ) ) /g.t[k].area/96.; if ( ! g . v [ i ] . w h e r e ) au[i] += aijk * u [ j ] ; } if ( ! g . v [ i ] .where) au[i] += ( u [ i ] *2.+u [ip]+u [ipp] ) * g . t [ k ] . a r e a * alpha/ 12.; 4.10. Appendix: The Full Program for Two-Dimensional Black-Scholes 149 } } } void solvecg(Grid& g, Vec& f, Vec& u, int niter, double precise, double alpha, double sll,double s!2,double s22) { int nv = g.nv; Vec au(nv), ag(nv), grad(nv), hh(nv), diag(nv); double normOldGrad = Ie60; for(int m=0; m<nlter ; m++) { aMul(au, g, u, alpha,sll,sl2,s22,1) ; double normGrad = 0; for(int i=0;i<nv; i++) if (!g.v[i] .where) { g r a d f i ] = ( a u [ i ] - f [i] ) ; normGrad += pow(grad[i] , 2) ; } double gh =0, gamma = normGrad / normOldGrad; normOldGrad = normGrad; for(int i=0;i<nv; i++) if(!g.v[i].where) { hh[i] = gamma * hh[i] - grad[i]; gh += grad[i] * hh[i] ; } aMul(ag,g,hh,alpha,sll,s!2,s22,1); double rho = 0; for(int i=0;i<nv; i + + ) if ( ! g . v [ i ] .where) rho += hh[i] * a g [ i ] ; rho = - gh / rho ; for(int i=0;i<nv; i + + ) if (!g.v [i] .where) u[i] += rho * hh[i]; if(m==0) precise = normGrad * pow(precise,2); if(normGrad < precise) { cout « " nb iter=" «m«" normGrad = " «normGrad« endl; return; } } } void myexitO { cout«"program ended at myexit () "«endl; } int main() { atexit(myexit); Grid g("mesh2.msh"); // // for debugging triangulated square 150 Chapter 4. The Finite Element Method for(int i = 0; i<g .nv; i++) // a hack to have Neumann conditions if(g.v[i].where != 0) g.vfi].where = 0; const double T =0.7, r=0.05, Kl=100, K2=100, sl=0.2, s2=0.2, sll=sl*sl, S22=s2*s2, s!2=-sl*s2*0.3; // financial data const int itermax=70; double dt = T/itermax; double t=0; Vec uO(g.nv), ul(g.nv); Vec f(g.nv),x(g.nv),f1(g.nv),f2(g.nv) ; for(int i=0; i<g.nv/i++) { //set payoff at maturity double a = (g.v[i].x > g.v[i].y )? Kl-g.v[i].x : K2-g.v[i].y ; uO[i] = a>0 ? a : 0; ul[i]=0; } for(int timelter=0; timelter < itermax; timelter++) { // time loop t+=dt; aMul(f2,g,uO,1./dt,0.,0.,0.,0) ; bMul(fl,g,uO,0,r,r,sll,s!2,s22) ; for(int i=0;i<g.nv;i++) f[i]=fl[i]+f2 [i]; // the mass matrix the nonsymmetrie part of the // stiffness matrix // // add the two contributions cout«"timeiter = "«timelter+l«" temps = "«t«'\t'; solvecg(g,f, ul,200, le-5, r+1./dt,sll,s!2,s22); // solve linear // system by eg for(int i=0; i<g.nv;i++) uO[i] =ul[i] ; } // update of stream plot ("plot2") ,for (int it=0,-it<g.nt; it++) plot «g. v [g (it, 0) ] .x «" "«g. v[g (it, 0) ] .y « " " « u O [ g ( i t , 0 ) ] « endl «g. v [g (it, 1) ] .x «" "«g. v [g (it, 1) ] .y « " " « u O [ g ( i t , l ) ] « endl «g. v[g (it, 2) ] .x «" "«g. v [g (it, 2) ] .y « " " « u O [ g ( i t , 2 ) ] « endl «g. v[g (it, 0) ] .x «" "«g.v [g (it, 0) ] .y « " " « u O [ g ( i t , 0 ) ] « endl «endl«endl ; return 0; ] Chapter 5 Adaptive Mesh Refinement This chapter is devoted to automatic mesh refinements with criteria based on a posteriori estimates of the finite element discretization errors of the Black-Scholes equation. The main idea consists of finding local error indicators which can be computed explicitly from the solution of the discrete problem, and such that their Hilbertian sum is equivalent to the global error. These indicators are said to be optimal if the constants of the norm-equivalence inequalities are independent of the error. Moreover, since they are local, they provide a good representation of the error distribution. The result (Theorem 5.6) leads to a numerical method which puts the discretization nodes where they are needed; for a given accuracy, the method is fast because it has fewer unknowns than with a uniform mesh. For example, this may be important for calibration problems where the Black-Scholes equation is solved a large number of times. This chapter uses many of the technicalities of the finite element method and may be difficult for nonspecialists. We have chosen to follow the same strategy as in the enlightening paper by Bernardi, Bergam, and Mghazli [14]. Therefore we need a finite element method with a mesh in the variable S that can vary in time, and this chapter provides such a tool. We consider two families of error indicators, both of residual type. The first family is global with respect to the price variable and local with respect to time: it gives relevant information in order to refine the mesh in time. The second family is local with respect to both price and time variables, and provides an efficient tool for mesh adaption in the price variable at each time step. Other approaches for mesh adaption for parabolic problems and finite element methods are available in, e.g., [45,46, 47]. This chapter is rather technical but essentially self-contained; to this end, there are some repetitions concerning Sobolev spaces and variational methods and other crucial notions for constructing the error indicators. The technical proofs are all given separately in the appendix at the end of this chapter. They can of course be skipped. 151 152 Chapters. Adaptive Mesh Refinement 5.1 The Black-Scholes Equation and Some Discretizations 5.1.1 The Black-Scholes Equation and Its Variational Formulation We consider the Black-Scholes equation for a European put with a local volatility a: Here t is the time to maturity and S is the price of the underlying asset. The volatility a is a function of 5 and / and the interest rate r is a function of t. For a vanilla put, the payoff function is where K is the strike. What follows can be generalized to any payoff function vanishing for S large enough. To simplify the discussion, we assume that the volatility a (5, t) and the interest rate r (t) are smooth functions. We need to make the following assumptions: there exist constants 0 < crmin < 0max> 0 < CCT, and R > 0 such that For the purpose of discretization, we truncate the domain in the variable 5: we introduce a large constant S, and instead of (5.1), we consider where Q = (0, 5). In what follows, we use the space L2(£2) of square integrable functions on Q. We denote by (-, •) the inner product in L 2 (ft) and by || • || the associated norm. We introduce the weighted Sobolev space V: Endowed with the inner product and norm V is a Hilbert space. This space has the following properties: 5.1. The Black-Scholes Equation and Some Discretizations 153 1. V is separable. 2. Denoting by D(R + ) the space of infinitely differentiable functions with compact support in R+, and by T>(&) the space containing the restrictions of the functions of £>(M+) to £2, Z>(S2) is densely embedded in V. 3. V is densely embedded in L 2 (fi). 4. The seminorm is in fact a norm in V, equivalent to || • \\v; more precisely, we have the following Hardy inequality: for all v e V, Denoting by D (Q) the space of infinitely differentiable functions with compact support in £1, we define V0 as the closure of D(£2) in V. It is easy to prove that V0 is the subspace of V containing the functions vanishing at 5. For simplicity, we also denote by (•, •) the duality pairing between V0, the dual space of VQ, and VQ, and we define || • ||v> by We define C°([Q, T}\ L2(fi)) as the space of continuous functions with values in L (£2), and L2(0, T; VQ) as the space of square integrable functions with values in VQ. We call a, (u, w) the bilinear form: 2 It is clear from the assumptions above on r and a that for all t e [0, T], at is a continuous bilinear form on V x V. Let IJL be the best positive constant such that, for all V, W € Vn, The boundary value problem (5.6) has the following equivalent variational formulation (see [90]): Find u e C°([0, T}\ L 2 (ft)) n L2(0, T\ VQ) satisfying From the assumptions above on r and a, we have the following Garding inequality. Lemma 5.1 (Garding's inequality). There exists a nonnegative constant A. such that 154 Chapters. Adaptive Mesh Refinement Proof. Take, for example, Using Lemma 5.1 and abstract results due to Lions and Magenes [90], it is possible to prove that the problem (5.14), (5.15) admits a unique solution. Moreover, introducing the norm we have, by taking v equal to u(t)e 2X/ in (5.15) and integrating in time, From this, we deduce that 5.1.2 The Time Semidiscrete Problem We introduce a partition of the interval [0, T] into subintervals [f n _i, t n ], I <n < N, such that 0 = to < ti < • • • < IN = T. We denote by Atn the length tn — tn-\, and by Ar the maximum of the Atn, 1 < n < N. We also define the regularity parameter /OA,: For a continuous function / on [0, T], we introduce the notation /" = f(tn). The semidiscrete problem arising from an implicit Euler scheme is the following: Find (un)0<n<N e L2(Q) x Vf satisfying For A? smaller than 1/(2A.), the existence and uniqueness of (u")o<n<N is a consequence of the Lax-Milgram lemma. We call uA/ the function which is affine on each interval [/„ _ i, rn ], and such that u^t(tn) = un. From the standard identity (a — b,a) = ^ \a |2 + ^ \a — b\2 — \ \b\2, a few calculations show that Multiplying equation (5.23) by Yl"=i(l — 2XAr,) and summing the equations on n, we obtain 5.1. The Black-Scholes Equation and Some Discretizations 155 Introducing the discrete norm for the sequence (vm}\<m<n, we have the discrete analogue of (5.18): In what follows, we will need an equivalence relation between [[(w m )]]n and [[MA?]](^)Lemma 5.2. There exists a positive real number a < | such that the following equivalence property holds for At < | and for any family (U W )O<«<AT in v£+1: From (5.26) and (5.27), we deduce that for all «, 1 < n < N, where 5.1.3 The Fully Discrete Problem We now describe the full discretization of (5.6). Foreachn,0 < n < N, let (7^/i) be a family of grids of £2. As usual, /z (w) denotes the maximal size of the intervals in Tnh- For a given element a> e Tnh, let hw be the diameter of a> and let Smm((o), Smax(<*>) be the endpoints of u>. We assume that there exists a constant ph such that, for two adjacent elements a> and co' of (Tnh), For each h, we define the discrete spaces by The grids Tnh for different values of n are not independent: indeed, each triangulation Tnh is derived from Tn-\,h by cutting some elements of Tn-\^ into smaller intervals or, on the contrary, by gluing together elements of Tn-\,h- This enables us to use simple Lagrange interpolation operators to map a discrete function of Vn-\,h to a function of Vnh and to compute exactly (u^"1, v%) if wjj"1 e Vn-i,/, and u£ € Vnn. 156 Chapters. Adaptive Mesh Refinement Assuming that w0 € VQh, the fully discrete problem reads as follows: Find (unh)0<n<N, unh e V°h, satisfying As above, for At smaller than 1/(2A), the existence and uniqueness of (M^)o<n<w is a consequence of the Lax-Milgram lemma, and we have the stability estimate We call u h A/ the function which is affine on each interval [/„ _ i, tn ], and such that u /, A, (tn) = u"h. 5.2 Error Indicators for the Black-Scholes Equation 5.2.1 An Upper Bound for the Error We now intend to bound the error [[u — M/,,A/]](^)» 1 < « < W, as a function of error indicators which can be computed from Uh, A/ • We are going to use the triangular inequality and we begin by evaluating [[u — W A ,]](/„). With this aim, we make a further assumption on the coefficients: we assume that a, S|| are Lipschitz continuous with respect to t uniformly with respect to S and that r is Lipschitz continuous on [0, T]. Thanks to the previous set of assumptions on the coefficients, we can introduce three constants LI, LI, and Lj, such that, for all t and t' in [0, 7*], Proposition 53. Assume that the function UQ belongs to V\h- Then there exists a constant a < j such that if At < |, the following a posteriori error estimate holds between the solutions of problems (5.15) and (5.22): where 5.2. Error Indicators for the Black-Scholes Equation 1 57 and c is a positive constant, L = 4Li + 2L2 + LS, where L\, LI, L^ are given by (5.35), and C(UQ) is given by (5.29). Corollary 5.4. If the assumptions of Proposition 5.3 are satisfied, there exists a positive constanta < | such that if At < j, the following a posteriori error estimate holds between the solutions of problems (5.15) and (5.22): Proposition 5.5. Assume that UQ e V\h. Then the following a posteriori error estimate holds between the solution (w")o< w <Ar of problem (5.21), (5.22) and the solution («£)o<n<Ar of problem (5.32), (5.33).' there exists a constant c such that, for all tn> 1 < n < N, where Remark 5.1. One could also take for r]m<a) the larger indicator where £/, i = 1, 2, are the two endpoints ofco and where -£*- (£) is the jump of-^j- at £,. This larger indicator is not necessary for parabolic problems in two dimensions (including time), but in more than two dimensions, (5.40) does not yield an upper bound for the error, and (5.41) is compulsory. This will be explained in Remark 5.2 in the appendix below. Combining the results of Propositions 5.3 and 5.5 leads to the following full a posteriori error estimate. Theorem 5.6. Assume that UQ e V\h and that AAf < a as in Lemma 5.2. Then the following a posteriori error estimate holds between the solution u of problem (5.14), (5.15) 158 Chapters. Adaptive Mesh Refinement and the solution uh,A of problem (5.32), (5.33): there exists a constant c such that, for all tn,\<n<N, where L = 4L\ + ILj. + £3, LI, £2, ^3 are given by (5.35), C(UQ) is given by (5.29), nn is given by (5.37), and r\m^ is given by (5.40), and 5.2.2 An Upper Bound for the Error Indicators The program is now to prove separate bounds for each indicator rjn and rjn^. We begin with rjn. For that, we introduce the notation [[vn]] for (i>") !<„<#, vn e VQ: Proposition 5.7. Assume that u° belongs to VQ, and that A.A/ < a as in Lemma 5.2. The following estimate holds for the indicator nn, 2 < n < N: and where c is a positive constant. 5.4. A Taste of the Software 159 The most important property of estimate (5.44) is that, up to the last term, which depends on the data, all the terms on the right-hand side of (5.44) are local in time. More precisely, they involve the solution in the interval [tn-i,tn]. We need to define some more notation before stating the upper bound result for r]n^. For co e Tn,h, let K^ be the union of co and the element that shares a node with co, and let V0(KJ be the closure of 2?(£J in V(£J = {v e L2(KW); Sff e L2(KJ} endowed with the norm || u || v ( £j = (fK u 2 (S)+,S 2 (ff (S)) 2 )?. Wealsodefine |Mlv 0 (Kj = (fKo S 2 (ff (S)) 2 )5 for v € VQ(KW}. We denote by V^K^ the dual space of Vo(KM) endowed with dual norm. Proposition 5.8. The following estimate holds for the indicator r]n>a) defined in (5.40) for all co € Tn,h, 1 < n < N: 5.3 Conclusion In §5.2.1 we have bounded the norm of the error produced by the finite element method by a Hilbert sum involving the error indicators nm and nm<a), which are, respectively, local in t and local in t and S. Conversely, in §5.2.2, we have seen that the error indicators can be bounded by local norms of the error. This shows that the error indicators are both reliable and efficient, or in other words that the error produced by the method is well approached by these indicators. Furthermore, since the indicators are local, they tell us where the mesh should be refined. It is now possible to build a computer program which adapts the mesh so as to reduce the error to a given number e. From the result of an initial computation M/, iA , we can adapt separately the meshes in the variables t and S so that the Hilbert sum in (5.42) decreases. The process is repeated until the desired accuracy is obtained. 5.4 A Taste of the Software The software for the finite element method with adaptive mesh refinement based on the error indicators presented above is surely more complex and longer than the simple program presented in §4.4. For that reason, we will not reproduce it entirely here. Instead, we focus on two points: • the program for a backward Euler scheme with the mesh in the S variable varying in time; • the computation of the indicators rjm. An Euler scheme class is defined for the backward Euler scheme as follows. 160 Chapters. Adaptive Mesh Refinement ALGORITHM 5.1. Euler_scheme. class Euler_Scheme { private: vector<vector<double> >S_nodes,S_steps; vector<double> grid_t; vector<int> change_grid; double rate (double); // the meshes in S (one for // each time step) // the mesh in t // at each time step, tells // whether the S-mesh varies or not // the function for the // interest rate // the local volatility function // a small parameter double vol(double,double); double eps,protected: public: Euler_Scheme(const vector<vector<double> > &g_grid_S, const vector<vector<double> > &g_S_steps, vector<double> & g_grid_t, vector<int> & g_change_grid) :S_nodes(g_grid_S),S_steps(g_S_steps), grid_t(g_grid_t), change_grid(g_change_grid){eps=le-9;}; // the constructor void Time_Step(int i, vector<KN<double> > &P) ; // a time step void build_rhs(KN<double> &u, const KN<double> &u_p, const vector<double> & steps_p, const vector<double> & nodes_p,const vector<double> & steps, const vector<double> & nodes); // computes the RHS of the linear system at each time step void build_rhs(KN<double> &u, const KN<double> &u_p, // computes the RHS of the linear system at each time step // assuming that the S-mesh does not vary double build_time_error_indicator(const KN<double> &u, const KN<double> &u_p, const vector<double> & steps_p, const vector<double> & nodes_p, const vector<double> & steps, const vector<double> & nodes); // computes the time error indicator at a given time step double build_time_error_indicator(const KN<double> &u, const KN<double> &u_p, // computes the time error indicator at a given time step // if the S-mesh does not vary double build_time_error_indicator(int it, const vector< KN<double> >& P) ; // the loop for computing the time error indicators void build_S_indicator(const KN<double> &u, const KN<double> &u_p, const vector<double> & steps_p, const vector<double> & nodes_p, const vector<double> & steps, const vector<double> & nodes, const double rt , const double dt, KN<double> &indic ); // computes the S-error indicators at a given time step void build_S_indicator(int it, const vector< KN<double> >& P, vector< KN<double> >& indie); // computes the 5-error indicators at a given time step // if the S-mesh does not vary } 5.4. A Taste of the Software 161 A time step of the method is implemented in the function Time_Step: it consists of building the matrix B = M + Af m A m , computing its LU factorization, constructing the right-hand side of the system of linear equations, and solving this system. ALGORITHM 5.2. Time step. void Euler_Scheme::Time_Step(int { int i, n ; double dt,t,S,h_p,h_n,r; double a,b,c,d,e; it, vector< KN<double> >& P) // constructs the matrix of the linear system n=S_steps[it] .size (); MatriceProfile<double> A(n,2); // memory allocation t=grid_t[it]; dt=t-grid_t[it-1]; r=rate(t); e=0.5*dt; h_n=S_steps[it][0]; A(0,0)=e*r*h_n+ h_n/3; A(0,l)=h_n/6; for(i=l;i< n-l;i++) { h_jp=h_n; S=S_nodes[it][i]; h_n=S_steps[it] [i]; a=pow(S*vol(t,S),2); b=a/h_p; c=a/h_n; d=r*S; A ( i , i ) = e * (b+c+r* (h_j>+h_n) )+ (h_p+h_n)/3 ; A(i,i-l)=e*(-b+d)+h_p/6; A(i,i+l)=e*(-c-d)+h_n/6; } h_p=h_n; S=S_nodes[it][i]; h_n=S_steps[it] [i]; a=pow(S*vol(t,S),2); b=a/h_p; c=a/h_n; d=r*S; A ( i , i ) = e * ( b + c + r * (h_js+h_n) )+ (h_p+h_n)/3 ; A ( i , i - l ) = e * (-b+d)+h_p/6; // the matrix of the linear system is constructed // builds the right-hand side (change_grid[it]) build_rhs(P[it],P[it-l],S_steps[it-1],S_nodes[it-1], S_steps[it],S_nodes[it] ) ; else build_rhs(P[it] ,P[it-l],S_steps[it] ,S_nodes[it] ); // simpler if 162 Chapters. Adaptive Mesh Refinement A.LUO ; A.Solve(P[it],P [it]); // // LU factorization of A solves the linear system } The difficult part is the construction of the right-hand side of the system of linear equations when the mesh in 5 varies: assume that Tn,h ^ Tn-\,h', then we have to compute fQ u"h~1wi for the shape functions of V®h. To do it exactly, one has to intersect the two meshes Tn,h and Tn-\,h- We reproduce here a function which is not optimized (so that it is not too intricate). ALGORITHM 5.3. Right-hand side. void { Euler_Scheme::build_rhs(KN<double> &u, const KN<double> &u_p, const vector<double> & steps_p, const vector<double> & nodes__p, const vector<double> & steps, const vector<double> & nodes) double h; double ujpl,u_pr; double phi_l,phi_r; double psi_l,psi_r; double x_l,x_r; int i=0; int j=0; U=0; u_pl=u_jp (0) ; x_l=0; while (ioteps. size () ) { if(nodes_p[j +1]<=nodes[i+1]+eps) { phi_l=0.0; psi_l=l.0; while (nodes_p [j+1]<=nodes[i+1]+eps) { if ( j < s t e p s _ p . s i z e ( ) - 1 ) u_pr=u_p(j+l) ; else u_pr=0; x_r=nodes_p[j+1]; h=x_r-x_l; phi_r=(nodes_p[j+1]-nodes[i])/steps [i] ; psi_r=l.-phi_r; if(i<steps.size()-1) u ( i + l ) +=h* (2* (phi_l*u_pl+phi_r*u_pr) + (phi_l*u_pr+phi_r*u_pl) ) / 6 ; u (i) +=h* (2* (psi_l*u_pl+psi_r*u_pr) + (psi_l*u_pr+psi_r*u_j?l) ) / 6 ; x_l=x_r; u_pl=u_pr; phi_l=phi_r; psi_l=psi_r; 5.4. A Taste of the Software 163 j++; if (j==steps_jp. size () ) break; } if(nodes[i+1]>nodes_p[j]+eps) { x_r=nodes[i+1]; h=x_r-x_l; if ( j < s t e p s _ p . s i z e ( ) - 1 ) u_pr=u_p (j ) + (nodes [i+1] -nodes_jp [ j ] ) /stepsjp [j ] * (u_p(j+l) -u_p(j) ) ; else u_pr=(1.-(nodes[i+1] -nodes_p [j])/steps_p[j])*u_p(j) ; phi_r=l.0; psi_r=0.0; if (i<steps.size ()-1) u(i+l)+=h* (2* (phi_l*u_pl+phi_r*u_pr) + (phi_l*u_pr+phi_r*u_pl) )/6; u (i) +=h* (2* (psi_l*u_pl+psi_r*u_pr) + (psi_l*u_pr+psi_r*u_pl) )/6; u_pl=u_pr; x_l=x_r; } i++; } else { while (nodes [i+1] <=nodes_p [ j+1] +eps) { x_r=nodes[i+1]; h=x_r-x_l; if (j<steps_p.size()-1) u_pr=u_j) (j ) + (nodes [i+1] -nodes_p [ j ] ) /stepsjp [ j ] * (u_p(j+l) -u_p(j) ) ; else u_pr=u_p(j)*(1-(nodes[i + 1]-nodes_p [ j ] ) / s t e p s _ p [ j ] ) ; if (i<steps.size()-1) u ( i + l ) + = h * ( 2 * u_pr +u_pl) /6; u ( i ) + = h * ( 2 * u_pl +u_pr) /6; x_l=x_r; u_pl=u_pr; i++; if ( i = = s t e p s . s i z e ( ) ) break; } if (nodes [i] >nodesjp[j+l] -eps) J++; } } } We do not reproduce the function for building the right-hand side when the mesh in the variable S does not vary: it follows along the same lines as that presented in §4.4. 164 Chapters. Adaptive Mesh Refinement The function for evaluating rjm given by (5.37) is Euler_Scheme: :build_ time_error_indicator. ALGORITHM 5.4. Error indicator for the time mesh. double Euler_Scheme::build_time_error_indicator(const KN<double> &u, const KN<double> &u_p, const vector<double> & steps_p, const vector<double> & nodes_p, const vector<double> & steps, const vector<double> & nodes) { double h; int i=0; int j = 0,doub 1 e u_pr, u_r, e_r ; double x_l,x_r; double u_pl=u_p (0) ; double e_l=u(0)-u_pl; double indic=0; x_l=0; while (i<steps.size() ) { if (nodes__p [j +1] <=nodes [i+1] +eps) { while (nodes__p [ j +1] <=nodes [i+1] +eps) { if ( j < s t e p s _ p . s i z e ( ) - 1 ) u_pr=u_p(j + 1 ) ; else u_pr=0; x_r=nodes_p[j +1] ; h=x_r-x_l; i f ( i < s t e p s . s i z e ( ) -1) u_r=u(i) + (x_r-nodes[i])/steps [ i ] * ( u ( i + l ) - u ( i ) ) ; else u_r=u(i)-(x_r-nodes[i])/steps[i]*u(i); e_r=u_r-u_pr ; indic+= (x_r*x_r*e_r-x_l*x_l*e_l) *(e_r-e_l)/h+h*((2*e_r+e_l)*e_r+(2*e_l+e_r)*e_l)/6; e_l=e_r; u_jpl=u_pr; x_l=x_r; J++; if ( j = = s t e p s _ p . s i z e ( ) ) break; } if(nodes [i+1]>nodes_p [j]+eps) { x_r=nodes[i+1]; h=x_r-x_l; if (j<steps_p.size()-1) u_pr=u_p(j) + (x_r-nodes_p[j] ) /steps_p[j] * (u_p(j+l) -u_p(j) ) ; else u_pr=u_p(j)*(!.-(x_r-nodes_p [ j])/steps_p[j]); if (i<steps.size()-1) 5.5. Results 165 e_r=u(i+l)-u_pr; else e_r=-u_pr; indic+= (x_r*x_r*e_r-x_l*x_l*e_l) *(e_r-e_l)/h+h*((2*e_r+e_l)*e_r+(2*e_l+e_r)*e_l)/6; e_l=e_r; u_pl=u_pr; x_l=x_r; } i++; } else { while(nodes[i+1]<=nodes_p [j+1]+eps) { x_r=nodes[i+1]; h=x_r-x_l; if (j<steps_p.size()-1) u_j?r=u_p(j) + (x_r-nodes_p [j ] ) /stepsj>[j] * (u_p(j+l) -u_p(j) ) ; else u_jpr=u_p (j ) - (x_r-nodes_p [ j ] ) /steps_p [ j ] *u_p(j ) ; if (i<steps.size ()-1) e_r=u(i+l)-u_pr; else e_r=-u_pr; indic+= (x_r*x_r*e_r-x_l*x_l*e_l) *(e_r-e_l)/h+h*((2*e_r+e_l)*e_r+(2*e_l+e_r)*e_l)/6; e_l=e_r; u_pl=u_pr; x_l=x_r; i++; if (i==steps.size ()) break; } if(nodes[i]>nodes_p [j+1]-eps) j++; } } return indie,• } 5.5 Results 5.5.1 Test with a Uniform Volatility We apply the refinement strategy to the computation of a vanilla European put with payoff 100 and maturity 1 year: the volatility and the interest rates are constant: a = 0.2 and r = 0.04. Therefore, we can also compute the price of the option by the Black-Scholes formula, and the error due to the discretization. We compute the option price in the rectangle [0, 200] x [0,1]. 166 Chapters. Adaptive Mesh Refinement First Refinement Strategy. We start with a uniform mesh with 20 nodes in t and 80 in S. Along with the discrete solution, we compute the indicators r\m and rjm_w, and according to (5.42), we can compare 77^ with -^ XLeT^ ^m &•> me former term being a global Smin discretization error indicator at time tm. If the time-discretization error indicators tend to dominate the global S-discretization error indicators, we choose to refine the mesh in the t variable, and we divide the time steps for which the error indicators are large into smaller time steps, keeping the 5 mesh unchanged. If, on the contrary, the global S-discretization error indicators tend to dominate the time-discretization error indicators, then, for each tm, we generate a finer mesh Tm by dividing the elements u> such that rjn iW is large into smaller elements. In such a way we obtain a new mesh, and we can compute again a discrete solution and error indicators. For the refinement in t, we compute f = maxm rjm and £ = minm r\m and we divide the time interval \tm-\ ,tm] by two if rjm > (£ + £)/2. For the refinement in 5, we take a similar strategy. This produces a very progressive mesh refinement: we made up to 19 refinements. We plot in Figure 5.1 the meshes obtained after 0, 5, 10, 19 refinements. In Figure 5.2, we plot -j3- and ty0- XLer Vm u>as functions of time. In Figure 5.3, we have plotted the error between the prices computed by the Black-Scholes formula and by the finite element method, for the four meshes. In Figure 5.4, we have plotted the error indicators rjm<w. Finally, in Table 5.1 we have listed both a\\u — Uh,At\\L2((Q,T);V) and (£)m07m + ^f Y^a rim o>)) f°r me different meshes. We see that the estimate of the error by means of the error indicators is really reliable, for the estimated error never exceeds 2.1 x the actual error. Therefore one can use safely the error indicators for a stopping criterion in the adaption procedure. The code for the refinement strategy is as follows. ALGORITHM 5.5. Refinement strategy. int mainO { // int max_aspect_ratio_t=2; int max_aspect_ratio=2; double reduction_factor=8.; parameters for the mesh refinement function // data structure for the seguance of grids vector< vector<double> >grid_t(21); vector<vector<vector<double> > >grid_S(21); vector< vector<vector<double> > >S_steps(21); vector < vector<int> >change_grid(21) ; // bounds of the domain double S_max= 200.0, T=l.; double K=100; // construction of a first grid int Nt=21; int NS=81; grid_S[0] .resize(Nt); S_steps[0].resize(Nt); change_grid[0].resize(Nt,0); for(int i=0;i<Nt;i++) { grid_t[0] .push_back((T*i)/(Nt-1) ) ; for(int j = 0 ; j < N S ; j + + ) sj|nsay •£•$ ~l Figure 5.1. Four successive mesh refinements: the bottom right figure is a zoom of the more refined mesh near the singularity. 89 L min ^ 5 w) versus time. juaujaujpy Ljsayv aAjidepy -gjajdEiQ Figure 5.2. Error indicators nm and (ty- ^^^f si|nsay - g - g 691 Figure 5.3. The pointwise errors with the adaptive strategy: the bottom right figure is a zoom. OZL }U9W8U!py Ljsaw aAjjctepv 'SJajdeiQ Figure 5.4. Error indicators rjm^: the bottom right figure is a zoom. 5.5. Results T71_ grid_S[0][i].push_back((S_max*j)/(NS-1)); for(int j = 0 ; j < N S - l ; j + + ) S_steps[0] [i] .push_back(grid_S[0] [i] [j+1]-grid_S [0] [i] [ j ] ) ; } int ref_it=0; // counts the refinement steps double estim_norm_error=10000; // estimated error while(ref_it<20 && estim_norm_error>l) { Euler_Scheme scheme(grid_S[ref_it], S_steps [ref_it],grid_t[ref_it] , change_grid[ref_it]); // construct a scheme vector<KN<double> > P(Nt); // the discrete solution vector<KN<double> > indic_S(Nt); // indicators in S for (int i=0;i<P.size ();i++) // init P and indic_S { P [i] .init(S_steps [ref_it] [i] .size ( ) ) ; indic_S[i] .init(S_steps[ref_it] [ i ] .size ( ) ) ; f o r ( i n t j = 0; j<S_steps[ref_it] [i] .size ( ) ; j + + ) { P[i] ( j ) = 0 ; indic_S[i](j)=0; } } int iS=0; while ( g r i d _ S [ r e f _ i t ] [ 0 ] [ i s ] < K ) { P [ 0 ] (iS)=K-grid_S[ref_it] [0] [ I S ] ; // the Cauchy datum iS++; } vector<double> indic_t; // indicators in time vector<double> indic_S_global; // sum of the S indicators at each // time step double norm_indic_t=0, norm_indic_S_global=0; for(int i=l;i<Nt;i++) { scheme.Time_Step (i, P) ; // a time step of the scheme double auxl=sqrt(scheme.build_time_error_indicator(i,P) ) * vol(0.5,100); indic__t .push_back (auxl) ; // time error indicator : eta_i norm_indic_t+=auxl*auxl; scheme.build_S_indicator_l(i,P,indic_S); // S error // indicator at time step i: etait(a double aux=scheme.build_global_S_indicator(i,indic_S[i], grid_S[ref_it][i]); // sum of the S error indicators at time step i indic_S_global.push_back(aux); norm_indic_S_global+=aux*aux; } estim_norm_error=sqrt( norm_indic_t)+ sqrt( norm_indic_S_global) ; // next refinement : in t or S ? compares the error indicators in // S and t int which_refine=ref_it%2; if ( norm_indic_t/norm_indic_S_global>2 | | norm_indic_t/norm_indic_S_global<0.5) which_ref ine=norm_indic_t<norm_indic_S_global; // refinement : the parameter which_refine tells whether to // refine in t or S 172 Chapters. Adaptive Mesh Refinement a d a p t i o n _ t S ( g r i d _ t [ r e f _ i t ] , i n d i c _ t , g r i d _ t [ r e f _ i t + l ] ,1, max_aspect_ratio_t, g r i d _ S [ r e f _ i t ] , change_grid[ref_it], S_steps[ref_it], indic_S, grid_S[ref_it+l] ,S_steps[ref_it+l] , change_grid[ref_it+l], reduction_factor, max_aspect_ratio, indic_S_global, which_refine); Nt=grid_t [ref_it + l] . s i z e O ; ref_it++; } } meshes. TableS.l. a\\u-uh^\\L2{(QJ},V}and(Y,m(ri2m + fy £„ <j) error estim. err. 5.67 12.27 5.66 8.56 5.67 6.62 4.66 5.38 3.73 4.58 3.25 4.19 3.26 3.39 2.53 2.95 error estim. err. 1.06 1.48 0.77 1.29 0.77 1.03 0.57 0.90 0.57 0.77 0.41 0.67 0.41 0.52 0.30 0.44 2.53 2.56 * for the different 1.95 2.21 1.45 1.85 1.06 1.59 More Aggressive Refinement Strategies. It is of course possible to use more aggressive refinement strategies; i.e., one can refine a time step or an element more than twice. The advantage is that fewer refinement steps are needed, but the mesh so produced may be too fine in some regions. In our tests, starting with a mesh of 20 x 80, and allowing to split the refined elements into up to eight subelements (depending on the indicator), it is possible to diminish the maximum norm of the error to less than 10~2 in around five refinement steps. 5.5.2 Result with a Nonuniform Local Volatility Here we take the volatility to be a(5, 0 = 0.05 + 0.25 l^s-ioo^ ut-o.s^ ,,. The result is '466 !" 6.61 - ' plotted in Figure 5.5. We see that the mesh is automatically refined in the zone where the volatili ty jumps. 1 Project 5.1. Run the program described above. Adapt it to a barrier option with realistic data. If time allows make the change S ->• 5/(l + 5) which maps R+ onto (0, 1), compute a European put in this formulation, and compare. 5.6 Mesh Adaption for a Put on a Basket of Two Assets To illustrate the power of mesh adaption, we take the example of a European put on a basket of two assets: we solve (2.61), with PQ given by (2.65). We take an = 022 = 0.2, y^y = —0.6, and r = 0.05. We use an Euler scheme in time and triangular continuous and piecewise affine finite elements in the price variables. In Figure 5.6, we plot the contours of the solution nine months to maturity, computed by using a quasi-uniform mesh. It is 5.6. Mesh Adaption for a Put on a Basket of Two Assets 173 Figure 5.5. The solution computed with a piecewise constant local volatility. Figure 5.6. Left: a quasi-uniform mesh in the variables S\, S^. Right: contours o f P ( S i , ^2, 0.25) computed on this mesh. possible to use an adaption strategy. One way do it is to generalize the approach presented above to the two-dimensional case. The approach presented here is different: by and large, starting from a possibly coarse grid, the idea is to adaptively construct a regular mesh (the angles of the triangles are bounded from below by a fixed constant) in the metric generated by an approximated Hessian of the computed solution. Although the theory for this strategy is not as clean as the one presented above, this method gives generally very good results. We have used the freeware f reef em++, by Pironneau and Hecht [100], which is available at http://www.freefem.org. This software permits one to use two-dimensional finite elements and mesh adaption by means of a user-friendly dedicated language. Chapter 5. Adaptive Mesh Refinement 174 Adapted meshes at different times and the contours of the solution nine months to maturity are plotted in Figure 5.7. We see that the meshes need many fewer nodes than the quasi-uniform mesh for a nice accuracy. The mesh is refined only in the zones where the solution has large second order derivatives. Note that no adaption in time has been performed here, although we have made clear that this is crucial for pricing accurately near maturity. Figure 5.7. The adapted meshes three, six, and nine months to maturity, and the contours of P nine months to maturity. 5.7 Appendix: Proofs Proof of Lemma 5.2. From the definition of U A /, an easy computation yields 5.7. Appendix: Proofs 175 If Afm = 0,theright-handsidein(5.47)isequalto|(|u"J|^ + |y m - 1 | 2 v +(i; w , vm-l)v) > 51 u I 2 /, using the inequality ab > — ^- — b2. Furthermore, e~ 2XArmT is continuous with respect to A/ m , so there exists a positive constant a\ < | such that if Af < ^-, then e ^'"' Jr'm e"2A-T |i>Arlv(T)dr > 11 u"1]2/, or in an equivalent manner, m This and the estimate Yl™=i (1 - 2>.Af,-) < e~~2Xtm-1, which holds as soon as 2A. Ar < 1, yield We also have M=l / This and (5.48) yield the upper estimate for [[(u m )]] n . For the other estimate, we see that (5.47) also yields Therefore, We know that there exists a constant «2 < \ such that and where /OA/ is defined by (5.20). We have also that if Af < ^, then 176 Chapters. Adaptive Mesh Refinement so Finally, (5.27) follows by taking a = min(a;i, #2). D Proof of Proposition 5.3. We begin by plugging «A? into (5.15); we obtain that for all t e (tn-i,tn],andv € V0, Subtracting from (5.15) leads to Wenowtakeu(0 = (u — u&t)(t)e 2X/ , integrate on (tn _ i, tn), and sum up with respect to n. Since (u — u&t)(Q) = 0, we obtain We evaluate separately each term on the right-hand side of this inequality: 5.7. Appendix: Proofs 177 where we have used (5.10). Calling L — 4L\ + ILi + LI, and using (5.28), we obtain Dealing now with the second term, we have from a Cauchy-Schwarz inequality m 1 But W A / (T) - um = ^(u - - um), so A/™ Adding and subtracting u™ 1 and u™ yields Using (5.49) then (5.27) yields that the sum over m of the last two terms can be bounded by Therefore which gives the desired estimate. 178 Chapters. Adaptive Mesh Refinement Proof of Corollary 5.4. It is clear that and reusing the steps of the preceding proof, we obtain that which implies that and we can use (5.36). Also, and Finally, and which implies that Combining all these estimates, we have proved the desired result. Proof of Proposition 5.5. For any v e VQ and for any u/, e Vnh, we have 5.7. Appendix: Proofs 179 By integrating by parts, we see that where £,-, i = 1, 2, are the endpoints of &>. Calling (S,-)/=o,...,#„/, the mesh points of Tnh, 0 = SQ < S\ < • • • < Sxnh = S, we choose Vh e V/, such that uj,(S,-) = u(5,-) for S; 7^ 0, and vh (0) such that J0' (v — Vh) = 0. We can prove that and With this choice, Remark 5.2. Note that such a choice for u/,, based essentially on Lagrange interpolation, is not possible for a parabolic problem in more than two dimensions (counting the time dimension), because the junctions ofV are generally not continuous. This explains Remark 5.1. Therefore Finally, taking v = (u" - unh) in (5.51) yields 180 Chapters. Adaptive Mesh Refinement and therefore Multiplying the previous equation by n/L/O ~ 2AAf,-) and summing up over n, we obtain that for a constant c, Therefore, using (5.27), Proof of Proposition 5.7. We apply the triangular inequality to r)n: We know from (5.49) that and using (5.20), It remains to estimate Atne 2Xr 1 "- ^9°- \un —un l\\. For this, we see thai 5.7. Appendix: Proofs 181 where We are going to deal separately with the four terms in the right-hand side of (5.55). We have Similarly, We write the fourth term as 182 But, using (5.19), and Let us deal with III. Exactly as for (5.50), Chapters. Adaptive Mesh Refinement 5.7. Appendix: Proofs 183 • if/i = 1, The desired bounds follow by inserting all these estimates into (5.55). D Proof of Proposition 5.8. We use (5.52) with u/, = 0 and v = (^-^ rS-jfj- + ru%)'fta} on u> and v = 0 on (0, S)\a>, where ^« is the bubble function on at, equal to the product of the two barycentric coordinates associated with the endpoints of co. This leads to We note that v is the product of •&£ by a linear function, and we use the inverse inequalities Thus, 184 Chapters. Adaptive Mesh Refinement and therefore Remark 5.3. lfr]n^ was computed by (5.41) as in Remark 5.1, then Proposition 5.8 would hold: indeed, for any endpoint £/ ^ Qofco, we call co' the other element sharing the node £,- with CD, and we use (5.52) with Vh = 0 and where R^,o is the affine function in O taking the value 1 /£, at £, and 0 at the other endpoint ofO. We see that <7 2 (£, *„)£,- |[^](&)l is bounded by plus the same terms as in (5.57). Using (5.30), (5.58)for w and CD' and the estimate we obtain that Chapter 6 American Options 6.1 Introduction Unlike European options, American options can be exercised anytime before maturity. Note that since the American option gives more rights to its owner than the European option, its price should be larger. As before, the price of the underlying asset satisfies where the volatility may depend on time and price and where Wr is a standard Brownian motion. There exists a probability P* (the risk neutral probability) under which the discounted price of the asset is a martingale. It can be proven that under the risk neutral probability, the price of the American option of payoff P0 and maturity T is where 77,r denotes the set of stopping times in [t, T] (see [78]). It is possible to prove that P(S, t) is also the solution to the variational inequality, which is the weak form of the following set of inequalities: with data The theory for pricing an American option is not easy: the proof of the abovementioned result can be found in Bensoussan and Lions [13] and Jaillet, Lamberton, and Lapeyre [78]. 185 186 Chapter6. American Options Figure 6.1. Left: the function S i-» P(S, t) at t = T and t < T. Right: the region of exercise. It can be proved that the price C(5, t) of a European vanilla call is always larger than the payoff (S — K)+. Therefore, the American and European vanilla calls have the same prices. On the contrary, for the American vanilla put, there is a region where P(5, /) coincides with the payoff P0(S) = (K — S)+; see Figure 6.1. If 5, falls in this region, then the put option should be exercised, because it is worth selling the underlying asset in order to buy some risk-free asset. The region where P(S, t} = P0(S) is called the region of exercise. In what follows, in conformity with the rest of the book, we focus on partial differential equations and their numerical resolutions: the first two sections are devoted to the mathematical analysis of the variational equation and to the free boundary (the boundary of the region of exercise). Then we discuss discretization by finite elements and prove convergence of the method. Later, we consider the solution procedure to the discrete variational inequality, and give a C++ program. Finally, we present two different computations, with a constant and a local volatility: in these tests, we also use a mesh refinement strategy close to the one presented in Chapter 5. 6.2 The Variational Inequality Calling t the time to maturity, (6.2), (6.3) becomes with Cauchy dat 6.2. TheVariational Inequality 187 We focus on the case of a vanilla put, i.e., the payoff function is P0(S) — (K — S)+, but, to a large extent, what follows holds for more general functions. To write the variational formulation of (6.4), (6.5), we need to use the same Sobolev space V as for the European option, i.e., and we call /C the subset of V: Since the functions of V are continuous, the inequality in (6.7) has a pointwise meaning. The set /C is a closed and convex subset of V, because convergence in V implies pointwise convergence. Using the notation defined in Chapter 2, we can formally multiply the first inequality in (6.4) by a smooth nonnegative test function of 5 and perform some integration by parts. We obtain that where the bilinear form at is defined in (2.19): We make the same assumptions as for the European option, namely, (2.20) and (2.21). These imply that the bilinear form at is continuous on V uniformly in t; see (2.22) and Garding's inequality (2.25). Observing that P0 e V, the set JC is exactly 1C = P0 + £0, where K,0 is the cone of nonnegative functions in V. Therefore, from (6.8), we see that a variational formulation to (6.4) is as follows: Find P e C°([0, T]; L2(R+)) nL2(0,1; /C), such that 3£ € L2(0, T; V), satisfying for a.e. t e (0, T), or in an equivalent manner, 188 Chapter 6. American Options and finally Note that (6.12) and (6.13) imply that Conversely, choosing v = P(t) + w — P0, with w e AC in (6.14), implies (6.12). Then using (6.12) and choosing v = P0 in (6.14) yields (6.13). Therefore, we have found that the weak formulation is equivalent to the following variational inequality: Find P e C°([0, 7]; L2(R+)) n L2(0, 7; AC), such that |f e L2(0, 7; V), satisfying (6.10) and (6.14). We do not write here the proof of existence and uniqueness for the variational inequality evolution problem (6.10), (6.14). It is given in [2], after the book by Kinderlehrer and Stampacchia [82], which is an excellent reference on the mathematical analysis of variational inequalities. One may also look at the papers by Friedman [56, 57]. The main idea is to observe that • the price of the American option is always larger than that of the European option, which is positive for t > 0. Therefore, P(t) cannot coincide with P0 for values of 5 > K; • it holds that so in the region where P and P0 coincide, we have and to approach the variational inequality by the penalized nonlinear problem: FindPe € C°([0, 7]; L 2 (R+))nL 2 (0, 7; V), such that ^L € L2(0, 7; V), satisfying (6.10) and with V€ : y \-+ Vf(y) = V(|), where V is a smooth nonincreasing convex function (see Figure 6.2) such that Then the proof of existence for the variational inequality consists of showing that the penalized problem has a unique solution Pe, proving estimates on Pe, in particular that a.e. in t, Pf e AC, and finally obtaining that when € —>• 0, Pf converges to a limit P which is a solution to (6.14). The main arguments are related to the fact that Ve is a monotone function and to the weak maximum principle (see [89]). The results are summarized in the following theorem. 6.3. The Exercise Boundary 189 Figure 6.2. The function Ve. Theorem 6.1. With a satisfying assumptions (2.20) and (2.21), the problem (6.10), (6.14) has a unique solution P which belongs to C°([0, +00) x [0, T]) with P(0, f) = K, for all t e [0, T], and is such that Sff, ff e L2(0, T; V), Sff 6 C°([0, T]\ .L2(M+)), anJ f e L2(0, T; L 2 (R + ))The function P is also greater than or equal to Pe, the price of the vanilla European put. The quantities \\P\\L2(0,T;V), II **llL«»(0,r;L 2 (R + ))' ll^ff|| L 2 ( 0 f r ; v), llffllL'(o,r;V), HSff ||L°°(o,r;L2aR+))> and \\ If \\L^O,T-L^R+)) are bounded independently from a in the class defined in assumptions (2.20) and (2.21). We have that Furthermore, if Pe is the solution to (6.10), (6.15), we have and calling n, the function fji = ^ + AtP, where At is the linear operator V —>• V, for all v e V, Atv = -^^-^ 6.3 - rSff + rv, we have The Exercise Boundary Lemma 6.2. Let P be the solution to (6.10), (6.14). There exists a function y : (0, T] —>• [0, K), such that for all t e (0, T), {5; P(S, t) = P0(S)} = [0, y(f)]. In the open set Q+ = {(S, t),0<t <T,S > y(t}}, we have |f + AtP = 0. Proof. The function S|f belongs to C°([0, T]; L2(R+)), and, for any t, we have that fj(-, 0 > -1 a.e. in S. The set {S; P(S, t) = P0(S)} is not empty since it contains 0. If it was not connected, then there would exist an interval where fj(S, 0 < —1 a.e. This would contradict the bound on |j. Therefore, the set {5; P(S, t) = P0(5)} is an interval containing 0. 190 Chapter 6. American Options Theorem 6.3. For a satisfying (2.20) and (2.21), there exists yo > 0 depending only on a such that Proof (sketched). Let P be the solution of (6.4) with a — a. The region {P = P0} is given by {(5, /), S < Y(OK where y is a function from [0, T] to [0, K]. It can be proved by using the weak maximum principle that |^ > 0 (this relies on the fact that a is a constant, so the equation for the penalized problem can be differentiated twice). We can also prove that P is a nondecreasing function of time (by studying the corresponding penalized problem and passing to the limit); therefore y is a nonincreasing function of time. Also, as proven in [82, p. 288], y is continuous, so the boundary of {P = P0} is a negligible set, and p, = |f + AtP = rKl{P=Po} = rKl({S,,),o<t<T,s<y(t)}We also have that P < P: indeed, calling E = P – P, The two terms on the right-hand side are nonnegative. The first term is nonnegative thanks to the convexity of P with respect to S. The second term is nonnegative thanks to (6.19). Furthermore, rAT(l { p< Po} — l{p<pc})E- is nonnegative a.e. thanks to the nonincreasing character of the real function u H> ! M <p 0 (^) (here E- is the negative part of E). Therefore, a weak maximum principle can be applied and we see that £"_ = 0 (everywhere since P and P are continuous). Since P < P, we know that y < y. Therefore, if there exists tQ < T such that y(t0) — 0, then y(t0) = 0 and y(t) = 0 for t > t0. It follows that P solves the BlackScholes equation for t > t0, and P(t0) < K: the maximum principle indicates that P(t) < Ke-r(t-t0) for t > tQ xhis is in contradiction with the fact that P > P0. The assertion y(T) = 0 is also impossible, because we can always look for P in a larger time interval. Since y is continuous on [0, T], there exists YQ > 0 such that inequality (6.20) is satisfied. We now state a regularity result on y, with the minimal assumptions (2.20) and (2.21). Theorem 6.4. For a satisfying (2.20) and (2.21), the function t H-> y (0 is upper semicontinuous. Moreover, it is right continuous in [0, T). Furthermore, for each t e (0, T], y has a left limit at t. Proof. See [2]. The proof is based on the construction of auxiliary variational inequalities with constant volatilities and uses the weak maximum principle. As a consequence of Theorem 6.4, we have the following result. 6.3. The Exercise Boundary 191 Theorem 6.5. For a satisfying (2.20) and (2.21), the function \JL — ^ + At P is In other words, a.e., one of the two conditions P — P0 and JJL = 0 is not satisfied: we see that there is strict complementarity in (6.4). Proof. For any time t, both limr<; y(r) and limr>, y ( r } exist. Therefore, the function y is the uniform limit of a sequence of piecewise constant functions % (i-e., Yk is constant on a finite number of intervals). Thus, calling J (resp., Jk) the set of points where y (resp., y^) jumps, we have J c ^k&^Jk because of the uniform convergence and J/t is finite. Thus the set J is countable. Consider now the boundary T of the set {P = P0} = {S < y(t}, t e [0, T]}: we have T = (F n {(S, /), f e [0, T]\J}) U (r n {(S, t), t e J}). The second set is negligible, since J is countable. For the first set, we have r n {(S, t), t e [0, T]\ J} = {(y(t), /), t e [0, T]\J], so it is also negligible. Thus, F is negligible. Therefore, the set {P = P0} has the same measure as its interior, on which JJL = rK. This proves (6.21). D For additional information on y, we need more assumptions on the volatility. Assumption 6.1. We assume that for a constant Cff > 0, a.e. in (0, T) x R+. Lemma 6.6. With a satisfying assumptions (2.20), (2.21), and (6.22), the solution P to (6.10), (6.14) satisfies 0 > 0 a.e. From Lemma 6.6, we can prove the following result. Theorem 6.7. Under the assumptions of Lemma 6.6, the function y is continuous. Proof. The proof uses the strong maximum principle and is given in [2]. When Theorem 6.7 applies, the graph F of y is a free boundary and the reaction term IJL is rKl{P=Po}: P is a solution to the partial differential equation on one side of F and coincides with P0 on the other side, and a.e. one of the two conditions P = P0 and (u = 0 is not satisfied. Since the option should be exercised when P = P0, the curve F is called the exercise boundary. We have seen in Theorem 6.3 that F does not intersect the axis 5 = 0. Note also that from Theorem 6.1, the slope of P (S, t) as a function of S is continuous across S = y (t). Only the second derivative of P with respect to S may jump at S = y(t). Another interesting question (of practical interest) is the behavior of y for t close to 0, i.e., near the maturity. The answer was given by Barles et al. [11], and Lamberton [86] 192 Chapter 6. American Options for constant volatility. For local volatilities, a comparison argument can be applied, and the results cited above can be generalized as follows. Proposition 6.8. We have, for t close to 0, Therefore, the function y is not even Holder continuous with exponent 1/2. 6.4 Discrete Approximations to the Variational Inequality We choose to discretize the problem with finite elements because they enable to discretize directly (6.14). A finite difference method is quite possible too, but one has to depart from (6.4). We localize the problem on (0, 5) as usual, so V becomes (where S is large enough so that P0(S) = 0), and 1C = {v e V, v > P0}. The variationa inequality is (6.14) with new meanings for V, 1C, and a,. Moreover, if yo e (0, AT) as in (6.20) is known, one can focus on the smaller interva [S, 5] with 0 < S < yo and obtain the equivalent weak formulation: Find P e L2((0, T), JQ D C°([0, T); L 2 (ft)), with |f e L2(0, T; V), such tha P(t = 0) = P0 and (6.14) holds for all v e 1C, with the new definition of the closed set /C We introduce a partition of the interval [0, T] into subintervals [tn-\, tn], 1 < n < N, with At{ = tf — ti-i, Af = max, Af, and a partition of the interval [0, 5] into subintervals a)i = [5,_i, S{], 1 < i < Nh + I, such that 0 = S0 < Si < • • • < SNh < SNh+l = S. The size of the interval <w, is called hi and we set h = max,=i Nh+\ hf. The mesh 7h of [0, 5] is the set {coi,..., a>Nh+i}. In what follows, we will assume that both the strike K and the real number S_ coincide with nodes of 7^: there exist a < / c , 0 < a r < / c < . / V / , + l, such that SK = K and 5 a _i = 5. We define the discrete space Vh by where PI (CD) is the space of linear functions on a). Since K is a node of T/,, P0 e Vh, and since 5 is also a node of T/,, we can define the closed subset /C/, of V/, by 6.4. Discrete Approximations to the Variational Inequality 193 The discrete problem arising from an implicit Euler scheme is as follows: Find (Pn)o<n<N e /Q satisfying and for all «, 1 < n < N, Exercise 6.1. Write the discrete problem arising from the Crank-Nicolson scheme. Let (u>'')i=+o,...Nh be the nodal basis of Vh, and let M and Am in R(Nh.+)*( Nh.+) be the mass and stiffness matrices defined by These matrices are exactly those described in §4.3. Denoting (6.28) is equivalent to We call Ma (resp., A£) the block of M (resp., A") corresponding to a < i, j < Nh/,. 6.4.1 Existence and Uniqueness of (6.28) Theorem 6.9. Consider A such that Gdrding's inequality (2.25) holds, and take A? < £; there exists a unique Pn satisfying (6.28). Proof. We reproduce the arguments of Stampacchia (the proof holds for infinite-dimensional Hilbert spaces assuming that the bilinear form a(-, •) is continuous and satisfies a Garding's inequality). There exists a unique Qn e Vh such that We introduce a positive parameter p, which will be chosen later. It is straightforward to see that (6.28) is equivalent to 194 Chapter 6. American Options which amounts to saying that P" is the projection of P" — p Qn on /C/,, for the scalar product (-,-)v: where n^ is the projector on /C/, with the scalar product (•, -)v- To summarize, we have proven so far that (6.28) is equivalent to the fixed point problem (6.31). To use the BanachPicard fixed point theorem, we need to find p such that the operator P t-> YI)ch(P-pQ)isa. contraction in the norm || • || v, where (? is given by (Q, v)v = (P — Pn~l, i>)+A/ n a / n (P, u) for all v e Vh. Since the projector Yl)ch is Lipschitz continuous with the Lipschitz constant 1, it is enough to prove that for a positive constant x < 1» II^ — pQ — P' — pQ'llv < X\\P — P'\\v for all P, P' e Vh, and obvious meanings for Q and Q'. This amounts to proving that \\P — pQ\\v < X l l ^ l l v * where Q is the unique function in Vh such that (Q, v)v = (P, v) + &tnatn(P, v) for all v e Vh. From the continuity of atn, there exists a positive constant C such that ||<2llv < C\\P\\V. Consider now A such that Garding's inequality (2.25) holds, and take A/ < i. We have For At < i and p small enough (the condition on p depends on Af), we have proved that the mapping P \-+ P — pQisa contraction in Vh, and we can apply the fixed point theorem: there exists a unique P" satisfying (6.31), and therefore (6.28). 6.4.2 Stability Taking v = P0 in (6.28), which implies from (2.22) and (2.25) that Hence, assuming now that 2A.A* < 1, 6.4. Discrete Approximations to the Variational Inequality. 195 For m < N, multiplying this by (1 — 2XAt}m~n~l and summing over n from n = 1 to n — m yield Calling PA/ the piecewise affine function in time such that P&t(tn) = Pn, the previous estimate implies that for any c < 1, there exists a constant C such that for all A? with 2^Ar < c, 6.4.3 Convergence Only for simplicity, we assume hereafter that the grid in t is uniform: Atn = Af for all n. Lemma 6.10. Let P be the solution to (6.10), (6.14) with K, given by (6.24). // P&t is the piecewise bilinear (in the variables t and S) Lagrange interpolate of P on the (S, t) mesh, we have that P&t > P0, and Proof. It is possible to interpolate P at the mesh nodes since P is continuous. Then it is clear that the interpolate PA/ is a piecewise affine function of time with values in K-h (with PAt(tn) = P" e tCh)- The asymptotics on the error in (6.33) and (6.34) follow from the regularity results in Theorem 6.1. Theorem 6.11. Assume that the coefficients a and r are smooth enough so that then 196 Chapter 6. American Options Proof. Let us define R = P - P0 e C°([0, T}\ /C0) and /?A, = PAr - P0 e C°([0, T]: /C 0 ), as well as /f = /? A; (/ m ) = P% -P0e)Cor\Vh, where and where V/, is defined in (6.25). We have With A. in the Garding's inequality (2.25), the inequality in (6.37) can be written as But and Therefore. and (6.38) becomes 6.4. Discrete Approximations to the Variational Inequality 197 Multiplying (6.40) by (1 - 2AAr)"~ A '" 1 , taking v% = r™ = Pm - P0, and summing over n, we get (using the fact that r® = r° = 0) On the other hand, calling 0 the piecewise constant function in (0, T] defined by 0(f) = (1 - 2AAf)"~ JV ~ 1 if *n-i < * < * « , we know from (6.12) that, for every function Q e L2(0, T; /C0), Taking for <2 the piecewise constant function with value in Vj, such that Q(t) = r%, for t e (tn-i, tn], we get that and using the stability estimate (6.32), the asymptotics on R — R, (6.33), (6.34), as well as (6.35), we obtain that 198 Chapter6. American Options Together with (6.41) and Garding's inequality (2.25), this implies that Then, realizing that in (6.45), N could be replaced by any n, 1 < n < N, and combining (6.45) with (6.33), (6.34) yields (6.36). 6.4.4 The Discrete Exercise Boundary One may ask if there is a well-defined exercise boundary t -> y/,(0 also in the discrete problem. A positive answer has been given by Jaillet, Lamberton, and Lapeyre [78] in the case of a constant volatility, an implicit Euler scheme, and a uniform mesh in the logarithmic variable. The main argument of the proof lies in the fact that the solution to the discrete problem is nondecreasing with respect to the variable t. With a local volatility, this may not hold (see the numerical example below). The result of Jaillet, Lamberton, and Lapeyre has been generalized to a local volatility in [4], in the special case when the mesh is uniform in the variable 5: here too, the discrete problem has a free boundary. The proof no longer relies on the monotonic character of the discrete solution with respect to / but on the discrete analogue of the bounds (6.17), i.e., -1 < |j < 0. This is proved by studying a penalized problem for (6.28) (the discrete analogue to (6.15)) and by using a discrete maximum principle on the partial derivative with respect to S (for this reason, a uniform mesh is needed). We can summarize this in the following theorem. Theorem 6.12. Assume that the grid 7h is uniform and that 5 > 0. Assume also that the parameters h and ^ are small enough so that the matrices A£ and M« + A/nA£ are tridiagonal irreducible M-matrices for all n, 1 < n < N. Then there exist N real numbers y£, 1 < n < N, such that We believe that this may be extended to somewhat more general meshes. 6.5 Solution Procedures We propose hereafter four algorithms for solving the discrete variational inequalities arising from an implicit time-stepping procedure. Other methods based on penalization can be found, for example, in [50]. 6.5. Solution Procedures 6.5.1 199 The Projected SOR Algorithm At each time step, we have to solve (6.32), which belongs to the following class of problems: Consider a matrix A e IR MxM , two vectors F and B in RM, and the variational inequality: find U € RM such that where We assume that for two positive constants a and ft, A satisfies so (6.47) has a unique solution. Let co be a real number, 0 < u> < 1. The idea is to construct a sequence of vectors £/(*) which hopefully converges to U by using a one-step recursion formula (starting from an initial guess t/(0)), C/(A:+1) — ifr(U^), where ty is the nonlinear mapping in Rm: This construction is a modification of the so-called successive overrelaxation (SOR) method used to solve iteratively systems of linear equation; see [8, 62, 106] for iterative methods for systems of linear equations. For solving approximately the system AX = F, the SOR methods constructs the sequence (Xw )k (starting from an initial guess X(0)) by the recursion Lemma 6.13. If A is a diagonal dominant matrix and ifO<a>< 1, then the mapping \jf defined in (6.49) is a contraction in EM of the norm \\ • H^ f || V||oo = maxi<,-<A/ | V,-|). Proof. Denote Z = ^r(X), Z' = if(X'). Obviously, where and 200 Chapter 6. American Options Therefore, denoting 8X = X - X',8Y = Y - Y', and <5Z = Z – Z', we have In view of (6.50), denoting by i, 1 < < M, an index such that ||<5F||oc = \8Yj\, it is enough to prove that for a constant p,0 < p < 1, \8Y{\ < p^SX^. But (6.50), (6.51), and 0 < u> < 1 imply and for both the denominator and the numerator are positive, due to the diagonal dominance of A and the choice of CD. Calling wehaveO</o < 1 and \W(X) - ^(*')lloo < pll^llooAs a consequence of Lemma 6.13, the sequence (C/^)* converges to the unique fixed point of ^. There remains to prove the following lemma. Lemma 6.14. With the assumptions of Lemma 6.13, ifU is the solution to (6.47), then U is the unique fixed point of\j/ defined in (6.49). Proof. We know that U satisfies Denote Z = ^f(U). Let us prove by induction on the indices that Z = U: if U\ > B\, then therefore with Y defined as above, Y\ = U\ and Z\ = U\.li, on the contrary, U\ = B\, we have that Y\ < U\, and therefore Z\ = B\. Suppose now that Z; = £7, for j < i. If C7, > Bf, we have that If, on the contrary, Ui = B{, then 7, < Ui and Z, = J5,-. 6.5. Solution Procedures 201 Thanks to Lemmas 6.13 and 6.14, we have proved the following result. Theorem 6.15. With the assumptions of Lemma 6.13, the projected SOR method converges to the solution of (6.41}. 6.5.2 The Brennan and Schwartz Algorithm The Brennan and Schwartz algorithm [19] is an algorithm which works under rather restrictive assumptions. It has been studied by Jaillet, Lamberton, and Lapeyre [78]. The algorithm is a modification of the Gaussian elimination algorithm, and is based on the factorization of A: A = UL, where U is an upper triangular matrix whose diagonal coefficients are all 1 and L is a lower triangular matrix. In fact, the bandwidths of both U and L are 2, so solving a system with U or L is very easy, and can be done with a computational cost linear with respect to M. The complexity for computing L and U is linear too with respect to M. Then, assuming that L and U are computed, the algorithm for solving (6.47) is as follows: • Solve UY = F. • For i = 1 to M, do Ut = max((y; - L,,/_itf,_i)/L M , B,). In [78], Jaillet, Lamberton, and Lapeyre studied this method for the American put in the logarithmic variable, for a uniform grid in x. They prove that if the step size is small enough, then the Brennan and Schwartz algorithm yields the solution to (6.47): the proof relies on the fact that the discrete problem has a free boundary and on the fact that the matrix is an M-matrix. This algorithm is really fast (its complexity grows linearly with M). However, it may lack robustness when the mesh is highly nonuniform. 6.5.3 A Front-Tracking Algorithm Here, we propose an algorithm for computing the solution of (6.28), assuming that the free boundary is the graph of a function. In our experience, this algorithm, based on tracking the free boundary, is more robust (and slightly more expensive) than the Brennan and Schwartz algorithm (see [78]). Since the free boundary is the graph of a function, the idea is to look for y£ by doing the following: • Start from y£ = y£~l. • Solve the discrete problem corresponding to and Pn(S) = 0. 202 Chapter 6. American Options • If Pn satisfies (6.28) and P" > P0, stop; else shift the point y% to the next node on the mesh left/right according to which constraint is violated by Pn. With the notation introduced above, the algorithm for computing PA" is as follows. Algorithm. Choose k such that y£~l = Sk', set found=false; whilefnot found) .. if ( ( I 7 " - t f ° ) t < 0 ) found=false; k = k + 1; else compute a = (M(Un - U"'1} + Af n A w f/ w )^_r, if(a<0) found=false; k = k — 1; else found=true. In our tests, we have computed the average (over the time steps) number of iterations to obtain the position of the free boundary: it was found that (with a rather fine time-mesh), this number is smaller than 2. A Program in C++ for the American Put. Here we give a program for computing an American put. The mesh in S can vary in time exactly as in Chapter 5, so mesh adaption can be performed. For simplicity, the time scheme is Euler's implicit scheme. We write first a function for a single time step. ALGORITHM 6.1. Time step. int American_Euler_Scheme: :Time_Step (int it, double K, const int free_bdry_guess_p) { int vector< KN<double> >& P, const i,n; double d t , t , S , h _ p , h _ n , r ; double a , b , c , d , e ; n=S_steps[it].size 0 ; MatriceProfile<double> A ( n , 2 ) ; KN<double> y ( n ) ; KN<double> r h s ( n ) ; KN<double> o b ( n ) ; // t=grid_t[it]; dt=t-grid_t [it-1] ,r=rate(t) ; e=0.5*dt; h_n=S_steps[it][0]; right-hand side // obstacle // // // current time time step assemble the matrix 6.5. Solution Procedures 203 A(0,0)=e*r*h_n+ h_n/3; A(0,l)=h_n/6; for(i=l;i< n-l;i++) { h_p=h_n; S=S_nodes[it] [i] ; h_n=S_steps[it] [i] ; a=pow(S*vol(t,S) , 2) ; b=a/h_p; c=a/h_n; d=r*S; A(i, i) =e* (b+c+r* (h_jp+h_n) ) + (h_j>+h_n)/3; A(i,i-l)=e*(-b+d)+hjp/6; A(i,i+1)=e*(-c-d)+h_n/6; } h_p=h_n; S=S_nodes [it] [i] ,h_n=S_steps[it] [i] ; a=pow(S*vol(t,S),2) ; b=a/h_p; c=a/h_n; d=r*S; A(i,i)=e*(b+c+r*(h_p+h_n))+ A(i,i-1)=e*(-b+d)+h_p/6; (h_jj+h_n)/3; // if assemble the right-hand side; (change_grid[it] ) { build_rhs(rhs,P[it-l] , S_steps[it-1],S_nodes[it-1],S_steps[it] , S_nodes[it]); } else build_rhs(rhs,P[it-1] , S_steps[it-1],S_nodes[it-1],S_steps[it] , S_nodes[it] ) ; // the obstacle function int iK=0; while (S_nodes[it] [iK] <K) iK++; ob=0; for ( i = 0 ; i < i K ; i + + ) ob(i)=K-S_nodes[it] [i] ; // first guess for the position of the exercise boundary int f+ree_bdry_gues s=0; while (S_nodes[it] [free_bdry_guess]< S_nodes[it-1] [free_bdry_guessjp]) f ree_bdry_guess++,// solves the problem return free_bdry<double>(A, P [ i t ] , y, rhs, ob, free_bdry_guess); } 204 Chapter 6. American Options The program for the free boundary tracking is as follows. ALGORITHM 6.2. Free boundary localization. int free_bdry (const MatriceProfile<double> & A, KN<double> & x, KN<double> & y, const KN<double> & b, const KN<double> & ob, int free_bdry_guess) /* ob : a vector describing the obstacle function */ /* x : the unknown function */ /* y : auxiliary function */ /* A the matrix of the problem */ /* b the right-hand side */ /* free_bdry_guess : guess for the position of the free boundary*/ /* it should come from the previous time step */ { int found =0; int iterations=0; int fbpos= free_bdry_guess; int sense_of_motion=0; int prev_sense_of_motion=0; int not_infinite_loop=l; /* y contains b-A * ob */ /* recall that the constraint b-A*x <= O*/ /* is to be satisfied */ /* so the contact zone is a subset of the region b-A*ob <=0 */ y=A*ob; y-=b; y*=-i.; int fst_ineq_threshold=0; while (y(fst_ineq_threshold+l)<0) fst_ineq_threshold++; /* fst_ineq_threshold is the extremal point of the zone b-A*ob < 0 */ while ( ( I f o u n d ) && abs(fbpos-free_bdry_guess)<150 && iterations <150) { iterations++; prev_sense_of_motion=sense_of_motion; int matsize=x.size()-fbpos; // we shall solve a Dirichlet problem // in the zone i>= fbpos I* fills the matrix and RHS*/ KN<double> xaux(matsize); MatriceProfile<double> auxmat(matsize,2); for (int i=0; i<matsize;i++) { auxmat(i,i)=A(i+fbpos,i+fbpos); xaux(i)=b(i+fbpos); } auxmat(0,0)=!.; for (int i=0; i<matsize-l;i++) { } auxmat(i,i+1)=A(i+fbpos,i+fbpos+1); auxmat(i+1,i)=A(i+fbpos+1,i+fbpos); auxmat(0,1)=0 . ; xaux(0) =ob(fbpos); auxmat.LU(); 6.5. Solution Procedures 205 auxmat.Solve(xaux,xaux); // solves the system /*checks if the guess for the free boundary is correct*/ /* if not, proposes a new guess */ found=l; if (xaux(1)<ob(fbpos+1)) // checks the inequality b>= ob { fbpOS++; found=0; sense_of_motion=l; } else // check the inequality A*x>= b { double aux= A(fbpos,fbpos)*ob(fbpos) +A(fbpos,fbpos-1)*ob(fbpos-1) +A(fbpos,fbpos+1)*xaux(1) ; if (aux<b(fbpos)) { found=0; fbpos--; sense_of_motion=-1; } else if(fbpos-l>fst_ineq_threshold) { found= 0; fbpos--; sense_of_motion=-1; } } not_infinite_loop=sense_of_motion*prev_sense_of_motion; if (not_infinite_loop==-l) cout «" enters an infinite loop"«endl; if (found==l) // the guess is correct, saves the solution in the // vector x { for (int i=0; i< fbpos;i++) x(i)=ob(i) ; for (int i=fbpos; i<ob.size();i++) x(i)=xaux(i-fbpos); } } if (abs(fbpos-free_bdry_guess)<150&&iterations<150) return fbpos; else return -10; } 206 6.5.4 Chapter 6. American Options A Regularized Active Set Strategy The algorithm above is not easy to generalize in higher dimensions. For an algorithm based on active sets and generalizable in any dimension, we have to regularize first the problem. Following [76], we first go back to the semidiscrete problem: find Pn e 1C such that For any positive constant c, this is equivalent to finding P" e V and a Lagrange multiplier IJL e V' such that When using an iterative method for solving (6.54), i.e., when constructing a sequence (Pn'm, nm) for approximating (Pn, ^), the Lagrange multiplier /^m may not be a function if the derivative of the P"'m jumps, whereas \i is generally a function. Therefore, a dual method (i.e., an iterative method for computing n) may be difficult to use. As a remedy, Ito and Kunisch [76] considered a one-parameter family of regularized problems based on smoothing the equation for \JL by for 0 < a < 1, which is equivalent to for x = ca/(l — a) e (0, +00). We may consider a generalized version of (6.56): where \i is a fixed function. This turns out to be useful when the complementarity condition is not strict. It is now possible to study the full regularized problem and prove that it has a unique solution, with p a square integrable function. A primal-dual active set algorithm for solving (6.58) is the following. 6.5. Solution Procedures 207 ALGORITHM 6.3. Primal-dual active set algorithm. 1. Choose P"'°, set k = 0. 2. Loop Denoting by An the operator from V to V: (Anv, w} = (^-, u>) + atn(v, w) and F : V x L2(R+) -+V x L 2 (R+), it is proved in [76] that G(v, /z) : V x L2(R+) -+ V x L 2 (R+), defined by is a generalized derivative of F in the sense that this is seen from the fact that, for any f e R, the function / : R —*• R, y I-* max(y, 0) admits g as a generalized derivative where and by taking ft — 0. Note that 208 Chapter 6. American Options Thus the primal-dual active set algorithm above can be seen as a semismooth Newton method applied to F, i.e., Indeed, calling (<5P", 6/it) = (P"<*+1 - />»•*, ^k+l - /^), it is straightforward to see that in the primal-dual active set algorithm, we have which is precisely (6.61). In [76], Ito and Kunish, by using the results proved in [72], established that the primaldual active set algorithm converges from any initial guess, and that if the initial guess is sufficiently close to the solution of (6.58), then the convergence is superlinear. To compute numerically the solution of (6.54), it is possible to compute successively the solutions (P"(xd, f^(Xi)) °f (6.58) for a sequence of parameters (/£) converging to +00: to compute (Pn(xi+i), n(xi+i)), one uses the primal-dual active set algorithm with initial guess (Pn(xi), V<(Xt))Notice that it is possible to use the same algorithm for the fully discrete problem. Convergence results hold in the discrete case if there is a discrete maximum principle. The algorithm amounts to solving a sequence of systems of linear equations, and the matrix of the system varies at each iteration. Exercise 6.2. Write a program in order to apply the primal-dual active set algorithm to the pricing of an American option (use Ruler's implicit scheme or Crank-Nicolson scheme). Vary the parameter x and compare the active sets as x -> oo. 6.6 6.6.1 Results Uniform Coefficients We consider an American put with a = 0.2, r = 0.04, and T = 1. In this case, the price of the option is an increasing function of the time to maturity, and therefore, the function y introduced in Lemma 6.3 is decreasing. We discretize the problem with the method described in §6.4, except that we allow the mesh in the variable S to vary in time. Doing so, we can adapt the mesh in 5 locally in time: mesh adaption is important in this case, because the solution is always singular (i.e., not twice differentiable in 5) at the exercise boundary (which is unknown), so the mesh should be refined in this region. The routine for computing the matrix A and the right-hand side of the inequalities are similar to those presented in Chapter 5. The evaluation of the error indicators follows along the same lines as in Chapter 5, except that the indicators are set to 0 inside the region where P = P0. Purposely, we omit the code for the error indicators. 6.7. More Complex American Options 209 In Figure 6.3, we plot the function P — P0 as a function of 5 and t for several meshes. Three successive meshes are plotted in Figure 6.4: we see that the mesh is refined near t — 0 and also on the last mesh at least that the mesh refinement follows the free boundary; this will be more visible in the next test case with a local volatility. In Figure 6.5, we plot the exercise boundary for several mesh refinements: when the mesh is properly tuned, we see that we obtain a smooth curve which is tangent to the S axis at t = 0. Finally, we plot in Figure 6.6 the error indicators with respect to S. 6.6.2 Local Volatility Here, we consider an academic example, chosen to illustrate the power of the adaptive strategy. We still consider an American put, with strike K = 100. The interest rate is 0.04 as above, but the volatility is local and we choose so the volatility is piecewise constant and takes the value 0.2 in an ellipse and 0.1 outside. With such a choice, the exercise boundary is expected to change slope as it enters and comes out of the region where a = 0.2. Note that this case is not covered by the theory above, because assumption (2.21) does not hold. In Figure 6.7, we plot the volatility surface as a function of S and t. In Figure 6.8, we plot the function P — P0 versus S and t for two different meshes, and the exercise boundary is displayed in Figure 6.9: we see that the free boundary does change slope when the volatility jumps. We see also that refinement is crucial in order to catch properly the exercise boundary. Note that the function y is not monotone. In Figure 6.10, two meshes are displayed: we see that the refinement follows the free boundary. In Figure 6.11, the error indicators with respect to 5 are plotted: here again, we see that the error indicators are large near the free boundary, where the function P is singular. 6.7 More Complex American Options It is possible to consider American Options on baskets: the price of the option is then found by solving a parabolic variational inequality in dimension d (where d is the size of the basket). Iterative algorithms like projected SOR in §6.5.1 can be used (see [61] for other iterative algorithms), but their convergence is generally slow. The two algorithms proposed in §6.5.2 and §6.5.3 cannot be applied without modification. The algorithm proposed in §6.5.4 may be applied. Exercise 6.3. Write a program in order to apply the primal-dual active set algorithm in §6.5.4 to the pricing of an American put option on a basket of two assets (use Euler 's implicit scheme or Crank—Nicolson scheme). Vary the parameter x and compare the active sets as X -> oo. Designing a very efficient method for American options on baskets is still an interesting open problem. OL£ suoudo uEDuaiuy -9 jajdeip Figure 6.3. The function P — Pa with the adaptive strategy: the bottom right figure is a zoom. suojjdo uBDuaujy X9|diucr) ajoyv 'Z'9 In Figure 6.4. Four successive mesh refinements: the bottom right figure is a zoom of the more refined mesh near the singularity. 212 Chapter6. American Options It is also possible to study American options with stochastic volatility: we refer the reader to [119], where the variational inequality is treated through a penalty method. American options on Levy driven assets have been studied by Matache, Nitsche, and Schwab [93]: for the solution procedure, they used a wavelet basis for which the matrix A" is well conditioned but then the constraint becomes difficult to handle. Figure 6.5. The exercise boundaries for different mesh refinements. 6.7. More Complex American Options Figure 6.6. Error indicators t]m^: the last figure is a zoom. 213 214 Chapter 6. American Options Figure 6.7. The local volatility surface. 6.7. More Complex American Options Figure 6.8. The function P — P0 with the adaptive strategy. 215 216 Chapter 6. American Options Figure 6.9. Left: the exercise boundary for the final mesh and the ellipse where the volatility jumps: there are two singularities corresponding to the jumps of volatility. Right: the exercise boundaries for different mesh refinements. Figure 6.10. Two successive mesh refinements: the mesh is refined along the exercise boundary; see Figure 6.9. 6.7. More Complex American Options Figure 6.11. Error indicators r\n 217 This page intentionally left blank Chapter 7 Sensitivities and Calibration 7.1 Introduction It is important in finance to compute the sensitivity of options with respect to parameters such as the price of the underlying asset or the volatility. In mathematical terms, dffC, for instance, can be obtained by differentiating the Black-Scholes equation and its boundary conditions. Automatic differentiation of a computer code for pricing provides a way to do that efficiently and automatically. Equally important is the problem of adjusting the volatility to fit the observations. It is a difficult task but it can be formulated via least squares as a differentiable optimization problem. Fast algorithms for optimization problems require derivatives of the cost functions, and here again when the number of variables is not too large, automatic differentiation is of great help. In this chapter we present an introduction to automatic differentiation, an implementation of the forward mode by operator overloading in C++, and two applications: one to the computation of Greeks and another to simple calibration when the number of parameters is small. This chapter is also an introduction to the last two chapters on calibration; to this end a short presentation of the conjugate gradient algorithm for optimization is given. 7.2 Automatic Differentiation of Computer Programs Derivatives of functions defined by their computer implementations can be calculated automatically and exactly. Several techniques are available and we will present only one of them—the forward mode [66]. The basic idea is that each line of a computer program can be differentiated automatically, except perhaps branching statements, but since there are only a finite number of them in a computer program, differentiability will be obtained almost everywhere at worst. The Forward Mode. Derivatives of a function can be computed from its differential form. This observation is easy to understand from the following example. 219 220 Chapter 7. Sensitivities and Calibration L e t J ( u ) = \u — ud\2; then its differential is and obviously the derivative of J with respect to u is obtained by putting 8u = 1, 8114 = 0 in (7.1): Now suppose that / is programmed in C/C++ by double J(double u, double u_d){ double z = u-u_d; 2 = 2*(u-u_d); return 2; } int main(){ double u=2,u_d = 0.1; cout « J ( u , u _ d ) « endl; } A program which computes J and its differential can be obtained by writing above each differentiable line its differentiated form. ALGORITHM 7.1. Automatic differentiation. double JandDJ(double u, double u_d, double du, double du_d, double *pd2) { double dz = du - du_d; double 2 = u-u_d; double dJ = dz*(u-u_d) + z*(du - du_d); z = z*(u-u_d); *pdz = dz; return z; } int mainO { double u=2,u_d = 0.1; double dJ; cout « J(u,u_d,1,0,&dJ) « endl; } Except for the embarrassing problem of returning both z , d z instead of z, the procedure is fairly automatic. It can be automatized more systematically by introducing a structured type of differentiable variable to hold the value of the variable and the value of its derivative, struct {double v a l [ 2 ] ; } ddouble; and rewriting the above as follows. 7.2. Automatic Differentiation of Computer Programs 221 ALGORITHM 7.2. AD. ddouble JandDJ(ddouble u, ddouble u_d) { ddouble z; z.val[l] = u.val[1]-u_d.val[1]; z.valtO] = u.val[0]-u_d.val[0]; z.val[l] = z.val[1]*(uval[0]-u_d.val[0]) + z.val[0]*{uval[1]-u_d.val[1]); z.val[0] = z.val[0]*(uval[0]-u_d.val[0]); return z; } int main{) { ddouble u; u . v a l [ 0 ] = 2 ; u_d.val[0] = 0.1; u . v a l [ l ] = l ; u_d.val[l] = 0. ,ddouble dJ; cout « J ( u , u _ d ) .val [0] « ' \ t ' « J (u,u_d, 1, 0) . val [1] « endl; ] In C++ the program can be simplified further by redefining the operators =, —, and *. Then a class has to be used instead of a struct as follows. ALGORITHM 7.3. AD++. class ddouble{ public: double val[2] ; ddouble(double a, double b=0) { v[0] = a; v[l]=b;} // ddouble operator=(const ddouble& a) { val[l] = a . v a l [ l ] ; val [0] =a.val [0] ; return *this; } friend dfloat operator - (const dfloat& a, const dfloat& b) { dfloat c; c.v[l] = a . v f l ] - b . v [ l ] ; // c.v[0] = a.v[0] - b.vtO] ; return c; } friend dfloat operator * (const dfloat& a, const dfloat& b) { dfloat c; c.v[l] = a.v[l] *b.v[0] + a . v t O ] * b . v [ l ] ; c.v[0] = a.v[0] * b.v[0] ; return c; } constructor (a-b)'=a-'-bf h As before a differentiable variable has two data fields: its value and the value of its derivative. Then we need a constructor to initialize such a variable and also the operator "=" to assign them to another one, so that u=v triggers u.val [1] =v.val [1] and u. val [ 0 ] =v. val [ 0 ]. The operator "—" does the usual minus operation on the value 222 Chapter 7. Sensitivities and Calibration of the variables and also on the value of their differentials. For the product the rule for the differentiation of products is used. Finally the function and its calling program are ddouble JandDJ (ddouble u, ddouble u_d) { ddouble z= u-u_d z = z*(u-u_d); return z; } int main() { ddouble u(2,l), u_d=0.1; cout « J ( u , u _ d ) . val [0] «'\t' « J ( u , u _ d , 1, 0) .val [1] « endl; } Note that « is an operator which can be redefined also inside the class ddouble. The conclusion is that a C program can be differentiated simply by replacing the keyword doubl e by ddoubl e. Of course C programs are not only assignments, and it remains to check that branching statements, loops, function calls, etc., have the same property. Branching statements like are in fact a compound of two programs: The method of differentiating each line works for both programs, giving then we can compound these two programs into But notice that we cannot account for B' that way, and so the differential may be wrong at the points where B changes from true to false; this does not occur if B does not depend upon the variable with respect to which the differentiation is done. For loops it is the same; for instance, means i=0 ; A; i = 1; A; i=2 ; A, which will be differentiated as which in turn is 7.3. Computation of Greeks 223 Finally each function must be redefined; for instance, ddouble sqrt (const ddouble& x) { ddouble r ; r . v a l [ 0 ] = s q r t ( x . v a l [ 0 ] ) ; r . v a l C l ] = 0.5*x.val [1] / (le-30+r.val [0] ) ,-return r; } The complete implementation of the class ddouble is given in the appendix (§7.7). Notice that +/x is not differentiable at x = 0 and so a program differentiated automatically is never guaranteed to work. However, a test can be added to the function to avoid such trouble. 7.3 7.3.1 Computation of Greeks Greeks for European Options The sensitivities of an option with respect to the relevant parameters are called the Greeks: let C be the price of a vanilla European call: • the 8 (delta) is its derivative with respect to the stock price S: 9s C; • the 0 or time-decay is its derivative with respect to time: 3,C; • the vega K is its derivative with respect to the volatility a; • the rho p is its derivative with respect to the interest rate, 3rC; • rj is its derivative with respect to the strike K', • finally, the gamma is the rate of change of its delta, d$sC. Equations can be derived for these directly by differentiating the partial differential equation and the boundary conditions which define C, i.e., when r and a are uniform, Note that for S and K, a sharp evaluation of the right-hand side 855C can be tricky; automatic differentiation provides an approximation consistent with the numerical scheme used for C. For American options, it is not so easy to derive equations for the Greeks. Instead of writing a new program to solve the above equations, it suffices to use Algorithm 4.4 written in C/C++ and to change all double or float to ddouble. 224 Chapter 7. Sensitivities and Calibration In the case of dxC, for instance, here is the list of the necessary modifications: • add the link to the ddouble library (# include" ddouble . hpp"); • change the definition of Real: typedef ddouble Real; • indicate with respect to which variable the differentiation is done, i.e., replace in the main function, K=80 by K (80 , 1 ) ; • for graphic display use u [ i ] . val [ 1 ] instead of u [ i ]. Automatic differentiation of computer codes can even be used to compute 8 = dSC, starting from a code for pricing the option for S e [0, 5] with a uniform grid in 5, thanks to the following trick: we observe that any function f ( S ) defined for 5 e (0, 5) satisfies the identity -j^f(XS) = S|£(S) at A = 1. The method then is to scale the array of grid points 5, —> A 5, and differentiate with respect to the scaling factor. As the Black-Scholes equation is integrated on (0, 5), and the grid points are uniformly distributed here, 5,? = iS/N + 1, i = 0 , . . . , N + 1, we can differentiate with respect to 5 the solution of the Black-Scholes partial differential equation in (0, S). This gives Figure 7.1 shows daP, 3^P, d$P, drP obtained by automatic differentiation of Algorithm 4.1. Figure 7.1. Sensitivity of the European put one year to maturity with respect to K, S (vega), S, and r obtained by automatic differentiation of Algorithm 4.4. 7.3. Computation of Greeks 225 Figure 7.2. Sensitivity with respect to K\ and K2 obtained by automatic differentiation of Algorithm 4.10 for the basket option with payoff Po(Si, S2) = min((/sTi — 50+, (K2 - 52)+) computed for Kl = K2 = 100. Automatic differentiation can be applied to computationally more intensive programs: for example, we have used it for a basket put option with payoff Po(Si, 82) = n\in((Ki — 5i)+, (K2 — 52)+). In Figure 7.2, we have plotted the sensitivities with respect to K\ and K2 for KI = K2= 100. 7.3.2 Malliavin Calculus for Greeks We use the notation of Chapter 1 and consider an option with payoff Q°. We assume that the spot price 5, satisfies (1.2) under the risk neutral probability P*. For clarity denote by ;c the initial value So = x of the stochastic process 5,. To make explicit the fact that 5, depends on x, we denote it by St (x). The value of the option at t = 0 is P(x) - «-rrE*(fi°(5r)). 226 Chapter 7. Sensitivities and Calibration To compute dx~E* ((?0(Sr (*))), one could use a finite difference approximation in the Monte-Carlo method: However, this is not precise and sometimes also unstable. A better way to compute 3^E* (Q°(Sr)) comes from the remark that if dxSr(x) had a meaning, we would have Note that if the probability density p(Sr, x) of ST is known (see Broadie and Glasserman [22]), the differentiation with respect to x could be done by an integration by parts: More generally, the basic idea of Malliavin calculus is to use an integration by parts formula on the space of paths of the stochastic process in order to express the sensitivity of an expectation with respect to some parameter 0 as the expectation of a new random variable, which can be computed by the Monte-Carlo method: For two integrable random variables F and G (see [9]) an integration by parts is said to hold if there exists an integrable random variable H(F;G} such that, for all smooth functions <I> with compact support, Malliavin calculus provides a way to find the random variable H(Sr; dx ST). Applied to the Greeks it gives (see [53,52]) Figure 7.3 shows the performance of the formula for & and gives a comparison with automatic differentiation applied to the partial differential equation. The computing time for 8 is of the same order as the one for 5,. Automatic differentiation in the partial differential equation is much faster. For a generalization to American options, see [10]. 7.3. Computation of Greeks 227 Figure 7.3. The 8 (derivative with respect to SQ) of a call with a = 0.1, r — 0.1, T = 1, K = 100 for SQ e (84, 118). Comparison between stochastic centered finite differences, the Malliavin formula, and automatic differentiation in the partial differential equation. The number of trials for the stochastic processes is 50000 and the number of time steps is 100. 7.3.3 Greeks for American Options We end this section on automatic differentiation with an application to American options. By the same trick, i.e., replacing double by ddouble, we can differentiate the program written in §6.5.3 and compute the sensitivity of a put with respect to the strike, for instance. The result is shown in Figure 7.4. Figure 7.4. Sensitivity dP/dK of an American put P with respect to its strike K as a function of asset price and time to maturity. 228 Chapter 7. Sensitivities and Calibration 7.4 An Introduction to the Calibration of Volatility In practice financial models are not perfect and observed data differ from models predictions. A pragmatic approach to this problem is to relax the models by introducing parameters and calibrating these parameters with the observations. The simplest in this line of thoughts is the concept of historical volatility for the stock price and implied volatility for European vanilla options. • By observing the price St for various t one can find or, the historical volatility, from the stochastic differential equation for St. • Similarly, if one observes today (/ = 0) the price uj K T(S, 0) of an option with strike K at maturity T while the underlying asset is worth S0, then one finds which implied volatility a in the Black-Scholes analytical formulas (1.17) or (1.18) gives u = uj. If this is done for several strikes K, in general one does not find the same volatility but rather a volatility surface a (K, T) (called a "smile" because it is usually convex). Exercise 7.1. Write a C/C++ program to compute the implied volatility. One may use the Newton algorithm and to do so compute the derivative of the Black-Scholes formulas (1.17) or (1.18) with respect to a. When the Black-Scholes equation with constant coefficients fails to match the observed prices, the simplest remedy is to use a local volatility, i.e., a carefully chosen function of S and /: a = &(S,t). A possible way is to find a among a family of surfaces usually defined by a few parameters, which fits the data u^ in the sense of least squares. The problem is of the type where Ca is the Black-Scholes partial differential operator with local volatility a. The a)i are suitably chosen nonnegative weights. These parameters are important in practice, because the prices of the options out the money can be very small. A common way to choose the a>i is to relate them to the vega of the option; see [31]. More precisely (7.3) means that n calls on the same asset with different strikes and maturities are observed on the market to be worth {«# }" today when the underlying asset is worth 50; then one seeks for the best volatility surface a (a) parameterized by a e A c Mp to fit the data. 7.4.1 Formulation with Dupire's Equation A direct solution of (7.3) is possible but each evaluation of the cost function requires n solutions of the Black-Scholes partial differential equation (2.12). We have seen in Chapter 2 that fixing t = 0 and S = S0, the price of a vanilla call with maturity r and strike K, 7.4. An Introduction to the Calibration of Volatility 229 u(S0, 0, K, T), as a function of T and K satisfies Dupire's equation: where q is the dividend of the asset and r is the interest rate of the risk-free asset. If the options for all strikes and maturities were on the market, the local volatility would be It is not the case, so one may try to find a as a minimizer of In contrast to the previous minimization problem (7.3), the evaluation of the cost function requires solving only one boundary value problem. The function v is uniquely defined and the evaluation of the cost function can be written as and the problem is to minimize J(a) subject to a e A. This problem is usually ill-posed and very unstable; i.e., small variations of J can be obtained from very large variations of a. A remedy is to add to J aTychonoff regularization functional, which ensures at least that J is coercive, i.e., lima6A,|a|->oo J(a) — +00. 7.4.2 First Numerical Tests Consider the following volatility soace: whereao, A, AT, are given constants. We take KI = 75-f50(i/7) andA, = 100; the advantage is that a2(a) is equal to ao for large and small K and never too small or too big in between when the real and imaginary parts of a, are not too large; to ensure this, we add a penalty term to the criteria, In the following numerical test, a target put option is computed first by solving Dupire' s equation with a nonconstant target volatility surface given by (7.7) with a; = (j — 1 + i7')/100, j = 1, 2, 3,4. There are 5 observation points, at K - 70, 80,90,11, 120 made alternatively at T = 1 and 1.8. Then the optimization program described below is run starting with a, = 0, i = 1,..., 4. After a few iterations the cost function is reduced to 10~n and yet there is £ 230 Chapter 7. Sensitivities and Calibration Figure 7.5. Results of a calibration with 8 parameters and 5 observations. Left: the volatility surface. visible difference between the target and the computed volatility surface; see Figure 7.5. The problem is stiff in that in some domain of the parameters a large variation of a makes no noticeable change in u while in other domains it is the opposite (for example, if at some places a becomes very small). Note also that the amount of data is too small for practical use. The next section explains how the minimization of J was performed. 7.5 Finite-Dimensional Differentiable Optimization Consider the minimization of the functional J : A c R^ -> R. When J is differentiable, gradient methods are applicable, and when J is twice differentiable, Newton and quasiNewton methods can be used (see Polak [101], for example). Here, we cover briefly the steepest descent method and the conjugate gradient method for unconstrained problems. Consider the unconstrained case, A = R^: if J is lower semicontinuous, bounded from below, and coercive, i.e., limx_*oo J ( x ) = +00, then there is at least one solution of the minimization problem, and the solution is unique if in addition / is strictly convex. Furthermore if / is differentiable, the gradient of J satisfies VJ(a*) = O a t a solution a*. 7.5.1 Gradient Methods Gradient methods stem from the fact that at each point a, — V J(a) is a descent direction for J: indeed, if p > 0 is small enough, because The gradient methods construct sequences by the induction relation where the step size pm > 0 is chosen so that» 7.5. Finite-Dimensional Differentiable Optimization 231 One possibility is to take pm constant: pm = p, with p small enough. For convex functions with a positive convexity modulus a and with a Lipschitz continuous gradient (with Lipschitz constant A), fixed step gradient methods converge (geometrically) if p < p-. In the steepest descent method, the step size pm is chosen as the solution of the one-dimensional minimization of p (->• f ( p ) := J(am — pV J(am}}. In practice, it may not be possible to compute exactly this minimum, and line search methods are available to compute efficiently approximations of the minimum. Later, we discuss one of them—Armijo's rule. It can be proved that for convex functions with a positive convexity modulus a and with a uniformly Lipschitz continuous gradient, the steepest descent method converges linearly (i.e., the error tends to 0 like a geometric progression). However, if the minimum is in a very narrow valley (i.e., for C2 functionals, the Hessian matrix is very ill conditioned near the minimum), the steepest descent method produces a lot of oscillations which slow down the convergence. The conjugate gradient method (see below) was developed to avoid these oscillations. 7.5.2 The Conjugate Gradient Method The conjugate gradient method (Hestenes and Stiefel [69]) is a descent method am+l = am + Pmdm where the descent direction dm is a linear combination of VJ(am) and dm~~l: dm = —VJ(am) + ymdm~l and where the step size is the minimum pm of the real variable function p h^ f ( p ) := J(am+pdm}: pm = argmin/(/o). For a convex quadratic function J, the linear combination dm is chosen in order to minimize J(am + pmdm), and the method converges in a finite number of iterations (assuming there are no round-off errors). In this case, there are several ways to write the best coefficients ym. These formulas can also be used when J is not quadratic, but then they are not equivalent: the three best known formulas are • the Fletcher-Reeves formula: the Polak-Ribiere formula: the Hestenes-Stiefel formula: 7.5.3 Line Search by Armijo's Rule In the gradient and conjugate gradient methods, the search for an optimal step size can be replaced by Armijo's rule. Let us denote 232 Chapter 7. Sensitivities and Calibration The following will find k such that p = p02k satisfies Convergence of the gradient and conjugate gradient methods can be shown with such a step size while preserving their linear and superlinear rate. Armijo's rule is implemented as follows: • choose po, set p = p0\ • if (E(p) < P^-\ then while (E(p) < p^-} set p := 2p; • otherwise while (E(p) > p^lp-) set p := f. 7.5.4 An Implementation in C++ Thus it is possible to write a small program which can solve any differentiable optimization problem and for which only the cost function is problem-dependent. A class is defined to encapsulate the data of a minimization problem as follows. ALGORITHM 7.4. A class for an unconstrained minimization problem. class Minproblem { public: int pmax; bool beginning, finishing; int na; ddouble* a; double rho; // Number of iterations // // nb of unknowns array of unknowns // step size ddouble E(); // cost function void dE(double* grad); // returns the gradient Minproblem (double rhol, int pmaxl, const int nal, rho(rhol), pmax(pmaxl), na(nal), { beginning=true; finishing=false; a = new ddouble [nu] ; }; void descent(); // the conjugate gradient algo. double e (double rho, double EO, double* h) ; double armijorule(double rho,double dEO, double alpha, double EO, double* h) ; }; Thanks to automatic differentiation the function de is implemented by the following program. ALGORITHM 7.5. Computation of the gradient by automatic differentiation. void Minproblem::dE(double* grad) { for (int i =0; i<na,- i++) { 7.5. Finite-Dimensional Differentiable Optimization for(int a[j] a[i] .val grad[i] 233 j = 0 ; j < n a ;j + + ) .val [1] = 0; [1]=1; = E() .val [1] ; } J Armijo's rule is programmed as follows. ALGORITHM 7.6. Armijo's rule. double Minproblem::armijorule(double rho,double dEO, double alpha, double EO, double* h) { double El=e(rho, EO, h); int i = 0; if (El < alpha * rho * dEO) { do rho = 2*rho; while( e(rho, EO, h) < alpha * rho * dEO && i++ < 100); return rho/2; } else { do rho = rho/2; while( e(rho, EO, h) > alpha * rho * dEO && i++ < 100); return rho; } ] The following is Armijo's rule with the auxiliary function. ALGORITHM 7.7. Auxiliary function for Armijo's rule. double Minproblem::e(double rho, double EO, double* h) { for(int i = 0; i < nu; i++) u[i] += rho*h[i] ; double aux = E ( ) . v a l [ 0 ] - EO; f o r ( i n t i = 0; i < nu; i + + ) u[i] -= rho*h[i] ; return aux; ] Finally the conjugate gradient with Armijo's rule is given below. ALGORITHM 7.8. Conjugate gradient with Armijo's rule. void Minproblem::descent () { double normg2old = Ie60; for(int i =0; i<nu; i++) h[i]=0; for(int p = 0; p < pmax; p++) ( 234 Chapter 7. Sensitivities and Calibration double EO = E().val[0], normg2 =0; dE () ; for(int i =0; i<nu; i + +) normg2 += grad[i]*grad[i]; double gam = normg2/normg2old; for(int i =0; i<nu; i + +) h[i] = -grad[i] + gam*h[i]; normg2old = normg2; double dE2 = 0; for(int i =0; i<nu; i++) dE2 += grad[i] *h[i] ; for(int i =0; i<nu; i++) u[i] += rho*h[i] ; double El = E().val[0]; if(fabs(El-EO)<le-30) cout«"exit: no variation of Cost"«endl; if(fabs(El-EO)<le-30) break ,double rhom = a r m i j o r u l e ( r h o , d E 2 , 0 . 3 , EO, h) ; f o r ( i n t i =0; i<nu; i + + ) u[i] += rhom*h[i]; cout«p«' \t' «EO«' ' «normg2«' \t' «rhom«' \t' «gam«endl; El = E() .val[0] ; if(E1>EO) cout«El«" cost grows, wrong gradient "«endl; if(normg2<eps*eps) cout« "optimization done\n"; if (E1>EO || normg2<eps*eps) break; } } 7.6 Application: Calibration on a Basis of Solutions 7.6.1 The Method In the Black-Scholes model for an option of maturity T and strike AT, the calibration of the volatility so as to fit observable data is difficult because of stability issues. In the remaining chapters, we will give a general inverse method based on Tychonoff regularizations. Let us go back to the least squares problem (7.6). From formula (7.5), we see that the knowledge of the pricing function (K, T) H> v(K, r) implies the local volatility: therefore, a possibility is to look for a pricing function which fits the observed prices, then deduce the volatility. Instead of solving (7.4) by a finite element method, let us look for v in the form where the u; are linearly independent solutions to Dupire's equation (7.4) with a given volatility field aj(K, r) and such that vj(K, 0) = (K — S)+, with the natural conditions vi (T, 0) = 0, Iimjf^.oo(v7(r, K) — K) = S. Once the nonnegative parameters Oj are found such that the function v fits the observed prices, the local volatility will be given by (7.5). In that context, it seems important to obtain as many analytical solutions vj of Dupire's equations as possible. 7.6. Application: Calibration on a Basis of Solutions 235 For example, assume that the pricing functions u; correspond to constant volatilities a (K, T) = aj for j = 1, . . . , n; then the parametrization (fl/)./=i,...,« H» a is j This approach is very simple and very fast, and all equations are satisfied; however, the stability is ensured only if the basis {<r;-} is cleverly chosen (this is an open problem). 7.6.2 Numerical Results The numerical procedure of §7.6 was tested with the idea of recovering the target volatility Several put options on the same underlying asset S on day 0 with strike Kf and maturity 7} are observed (their price are udi). We took five different options, which is a very small number. The results of the calibration procedure with n = 5 and n = 20 are given in Figure 7.6. This method seems to have a good stability and a fair accuracy. It is clear that for practical use, more data are necessary. Figure 7.6. Result of the procedure in §1.6 with parameterization (7.9). Top: 5 basis Junctions have been used. Bottom: 20 basis functions have been used (note that the centering and the zoom are different from above). 236 Chapter 7. Sensitivities and Calibration Project 7.1. Build the program that produced the numerical results above and replace the optimization module by the BFGS optimization function of the GSL: gsl_multimin_ fdfminimizer_vector_bfgs. Then propose some other parameterization for a (such as B-splines) and rerun the calibration. 7.7 Appendix The complete implementation of the class ddouble is given below. It can also be found online at www.ann.jussieu.fr/pironneau. ALGORITHM 7.9. The ddouble library for automatic differentiation. // tfifndef tfdefine file ddouble.h, for automatic differentiation w/r one variable // adapted from M. Grundmann's MIPAD _DDOUBLE H_ _DDOUBLE H_ # include <stdlib.h> ^include <math.h> tfinclude <iostream.h> class ddouble { public: double val[2]; // val [0]=value, val[l]= derivative ddouble() { val[0] = 0; val[l] = 0 ; } ddouble(const ddoublefc a){ val [0] = a.val[0]; val[l] = a.val[l]; } ddouble(double a, double b=0){ val[0]=a; val[l]=b;} ddoublefc operator=(double a) { val[0] = a; val[l] = 0.0; return *this,-} ddouble& operator=(const ddoublefc a) { val[0] = a.valEO]; val[l] = a.valfl]; return *this,-} doublet operator[] (const int ii) { return this->val[ii] ;} double operator[] (const int ii) const { return this->val[ii] ; } ddoublefc ddoublefc ddouble& ddouble& ddouble& ddouble& ddouble& ddouble& ddouble& operator operator operator operator operator operator operator operator operator + += += -= -= *= *= /= /= 0 {return *this,-}; (double); (const ddouble&); (double ); (const ddouble&); (double); (const ddouble&); (double) ; (const ddouble&) ; ddouble operator++(int); ddouble operator--(int); ddouble& operator++(); ddouble& operator--(); friend ostream& operator « friend ddouble& operator « (ostream&, const ddouble&); (ddouble&,double) ; 7.7. Appendix 237 friend ddouble parameter(double); friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend int int int int int int int int int int int int int int int int int int operator operator operator operator operator operator operator operator operator operator operator operator operator operator operator operator operator operator friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend friend ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble ddouble != (const ddouble&,const ddoubleSc); != (double,const ddouble&); != (const ddouble&,double); == (const ddouble&,const ddoubleSc); == (double,const ddouble&); == (const ddouble&,double); >= (const ddouble&,const ddouble&); >= (double, const ddoubleSc); >= (const ddouble&,double); <= (const ddouble&,const ddoubleSc); <= (double,const ddoubleSc); <= (const ddouble&,double); > (const ddouble&,const ddoubleSc); > (double,const ddoubleSc); > (const ddouble&,double); < (const ddoubleSc,const ddoubleSc); < (double,const ddouble&); < (const ddouble&,double); operator + (const ddoubleSc x) ; operator + (const ddoubleSc, const ddoubleSc) ,operator + (double, const ddouble&); operator + (const ddoubleSc, double); operator - (const ddoubleSc x ,double y); operator - (const ddoublefc,const ddouble&); operator - (double, const ddouble&); operator - ( const ddouble& ); operator * (const ddouble&,const ddouble&); operator * (double, const ddoubleSc ) ; operator * (const ddoubleSc x, double y) ; operator / (const ddoubleSc x, double y) ; operator / (const ddoubleSc, const ddoublefc) ; operator / (double, const ddoubleSc) ; exp (const ddoubleSc) ; log (const ddoubleSc) ; sqrt (const ddoubleSc) ; sin (const ddoubleSc) ; cos (const ddoubleSc) ,tan (const ddoubleSc) ; pow (const ddoubleSc,double) ; pow (const ddoubleSc,const ddoubleSc); pow (const ddoubleSc, const int) ; abs (const ddoubleSc) ; }; inline double sign (const ddoubleSc x) { return ( x < 0.0 ? -1.0 : 1.0) ; } inline double sign (const ddoubleSc x, double y) { return ( x < 0.0 ? -fabs(y) : fabs (y) ); } // inline ddouble d_abs(ddouble * x){ return abs(*x); } used with f2c 238 inline inline inline inline inline Chapter 7. Sensitivities and Calibration ddouble ddouble ddouble ddouble ddouble d_cos(ddouble d_sin(ddouble d_tan(ddouble d_exp(ddouble d_log(ddouble * * * * * x){ x){ x){ x){ x){ return return return return return cos(*x); sin(*x); tan(*x); exp(*x); log(*x); } } } } } inline ddouble d_sign(ddouble * x){ return sign(*x); } inline ddouble d_sign(ddouble * x,double*y){ return sign(*x,*y); inline ddouble d_sqrt(ddouble * x){ return sqrt(*x); inline inline inline inline ddouble ddouble ddouble ddouble } } pow_dd(ddouble * x,ddouble*y) { return pow(*x,*y); pow_dd(double * x,ddouble*y) { return pow(*x,*y); pow_dd(ddouble * x,double*y) { return pow(*x,*y); pow_di(ddouble * x,int*y) { return pow(*x,*y); } } } } tfendif ALGORITHM 7.10. The file ddouble.cpp. ftinclude "ddouble.h" // file ddouble.cpp, for AD with one variable const double eps = l.Oe-50; // avoids NaN in (sqrt(y))'at 0 ostream& operator« (ostream& f, const ddouble& a) { f « "[" « a[0] « ','« a[l] « "]"; return f;} ddouble ddouble::operator++(int) { ddouble r=(*this); r[0]++; return r;} ddouble ddouble::operator--(int) { ddouble r=(*this); r[0]--; return r;} ddouble& ddouble::operator++(){ (*this) [0]++; return *this;} ddouble& ddouble::operator--(){ (*this) [0]--; return *this;} ddoublefc ddouble::operator += (double y) { (*this)[0] += y; return *this; } ddouble operator - (const ddoublefc a) { ddouble r; r[0] = -a[0]; r[l] = -a[l]; return r;} ddouble& ddouble::operator -= (double y) { (*this)[0]-=y; return *this;} ddouble& ddouble::operator += (const ddouble& y) { (*this) [0]+=y[0] ; (*this) [l]+=y[l] ; return * this; } ddouble& ddouble::operator -= (const ddouble& y) { (*this) [0]-=y[0] ; (*this) [1]-=y[l] ; return * this,- } ddoublefc ddouble::operator *= (double y) { (*this) [0] *=y; (*this) [1] *=y; return *this;} 7.7. Appendix 239 ddoublek ddouble::operator *= (const ddoublefc y) { return *this = *this * y;} ddouble& ddouble::operator /= (const ddouble& y) { return *this = *this / y;} ddouble& ddouble::operator /= (double y) { const double inv = 1.0 / y; (*this) [1] *= inv; (*this) [1] *= inv; return *this; } int operator != (const ddoublefc u,const ddoublefc v) { return u[0] != v[0] ; } int operator != (double u,const ddouble& v){ return u != v[0];} int operator return v[0] != u; } != (const ddouble& v,double u){ int operator == (const ddouble& u,const ddouble& v) { return u[0] == v[0] ; } int operator == (double u,const ddoublefc v){ return u == v[0];} int operator == (const ddouble& v,double u){ return'v[0] == u;} int operator <= (const ddoublek u,const ddouble& v) { return u[0] <= v[0];} int operator <= (double u,const ddouble& v){ return u <= v[0];} int operator <= (const ddoublefc v,double u){ return v[0] <= u;} int operator >= (const ddouble& u,const ddouble& v) { return u[0] >= v[0];} int operator >= (double u,const ddoublefc v){ return u >= v[0];} int operator >= (const ddoublefc v,double u){ return v[0] >= u;} int operator > (const ddoublefc u,const ddouble& v) { return u[0] > v[0];} int operator > (double u,const ddouble& v){ return u > v[0];} int operator > (const ddoublefc v,double u){ return v[0] > u;} int operator < (const ddouble& u,const ddouble& v){ return u[0] < v[0];} int operator < (double u,const ddoublefc v){ return u < v[0];} int operator < (const ddouble& v,double u){ return v[0] < u;} ddouble operator + (const ddouble& x, const ddoublefc y) { ddouble r; r[0] = x[0] + y[0];r[l] = x[l] + y[l]; return r; } 240 Chapter 7. Sensitivities and Calibration ddouble operator + (double x, const ddouble& y) { ddouble r ( y ) ; r [ 0 ] += x; return r;} ddouble operator + (const ddouble& y, double x) { ddouble r ( y ) ; r [ 0 ] += x; return r; } ddouble operator - (const ddouble& x, const ddoublefc y) { ddouble r ; r [ 0 ] = x [ 0 ] - y [ 0 ] ; r [ l ] = x [ l ] - y [ l ] ; return r ; } ddouble operator - (double x, const ddouble& y) { ddouble r; r[l] = - y[l]; r[0] = x - y [ 0 ] ; return r ; } ddouble operator - (const ddoublefc x, double y) { ddouble r ( x ) ; r [ 0 ] -= y; return r; } ddouble operator * (const ddoublefc x, const ddoublefc y) { ddouble r; r [ 0 ] = x [ 0 ] * y [ 0 ] ; r [1] =x[0] *y[l] +x [1] *y [0] ; return r; } ddouble operator * (double x, const ddouble& y) {ddouble r; r [ 0 ] = x * y [ 0 ] ; r[l] = x * y[l]; return r;} ddouble operator * ( const ddouble& y, double x) {return x * y;} ddouble operator / (const ddouble& x, const ddoublefc y) { ddouble r; r [ 0 ] = x [ 0 ] / y [ 0 ] ; r [1] = (x [1]-x [0] * y [ l ] / y [0] ) / y [ 0 ] / r e t u r n r ; } ddouble operator / (double x, const ddouble& y) { ddouble r ; r [ 0 ] = x / y [ 0 ] ; r [1] = - x * y [ l ] / y [ 0 ] / y [ 0 ] ; return r;} ddouble operator/(const ddoublefc x, double y) {ddouble r; r [ 0 ] = x [ 0 ] / y ; r [1] =x [1]/y; return r;} ddouble exp (const ddoublefc x) { ddouble r ; r [ 0 ] = e x p ( x [ 0 ] ) ; r[l] ddouble log (const ddoublefc x) { ddouble r ; r [ 0 ] = log(x [0] ) ;r [1] = x [1] *r[0] ; return r , - } = x [1]/x [0] ; return r;} ddouble sqrt (const ddoublet x) { ddouble r , - r [ 0 ] = s q r t ( x [ 0 ] ) ; r[l] = 0.5*x[1]/(eps+r [0]);return r; } ddouble sin (const ddoublefc x) { ddouble r; r [0] = s i n ( x [ 0 ] ) ; r [1] =x [1] *cos (x[0] ) ; ddouble cos (const ddouble& x) { ddouble r,- r [0] =cos (x [0] ) ; r [1] =-x [1] *sin(x [0] ) ; ddouble tan (const ddouble& x) { return (sin(x) / c o s ( x ) ) ; } ddouble pow (const ddouble& x,double y) {return expdog(x) * y) ;} ddouble pow (const ddoublefc x,const int y) {return expdog(x) * (double)y) ;} return return r;} r;} 7.7. Appendix 241 ddouble pow (const ddouble& x,const ddouble& y) {return expdog(x) * y) ;} ddouble abs (const ddouble& x) { ddouble y;if (x[0] >= 0) y=x; else y = -x; return y; } ALGORITHM 7.11. An example of automatic differentiation. ^include "ddouble.h" void main(void) { ddouble x(0,l); ddouble a (1),b,c; b = sin(x); c = (a+x) * b ; cout « sin(x) at x=0 is "«c « endl; } "the derivative of(l+x)* This page intentionally left blank Chapter 8 Calibration of Local Volatility with European Options In this chapter, we describe a least squares algorithm to calibrate the local volatility by fitting the prices of a set of vanilla European calls available on the market. As seen in Chapter 7, using Dupire's equation saves a lot of work for evaluating the least squares functional. For computing the gradient of the cost function with respect to volatility, we propose an optimal control approach involving an adjoint state. Coleman, Li, and Verma [29], Jackson, Siili, and Howison [77], and Lagnado and Osher [83, 84] use a rather similar method, but they do not rely on Dupire's equation, so they have to perform as many partial differential solves as observed prices. Also, their method differs in the computation of the gradient of the cost function: Coleman, Li, and Verma use automatic differentiation or finite differences to evaluate the gradient of the cost functional, and Jackson, Siili, and Howison use finite differences, whereas Lagnado and Osher derive a partial differential equation for the gradient of the option price with respect to a. Let us also mention Andersen and Brotherton-Ratcliffe [6] for another method special to vanilla options using discrete Green's functions, and Boyle and Thangaraj [17]. We will close the chapter by reviewing a different and attractive method proposed by Avellaneda et al. [7], using dynamic programming. It has the advantage of not relying on any parametrization of the volatility, and of leading to an unconstrained optimization problem, at the cost of solving nonlinear Hamilton-Jacobi-Bellman equations. Finally, note that other models also need calibration: for example, Cont and Tankov [31] calibrate jump diffusion models. 8.1 The Least Squares Problem Hereafter, we shall call rj the square of the local volatility. We shall localize Dupire's equation by picking K and f large enough, and by considering Dupire's equation in the rectangle Q = [0, K] x [0, f]. We must impose an artificial boundary condition on K = K, so we take C(K = K, T) = 0 for all T € (0, f]. Calling 50 the spot price, the price 243 244 Chapters. Calibration of Local Volatility with European Options C(K,-c} := C(S0,0, K,r) isa solution to the boundary value problem Here, 77 is a function of T and K. For simplicity only, we assume that the interest rate and the dividend yield are constant. Remark 8.1. Note that the boundary condition C(r, 0) = S0e~qT need not be imposed, because it is implied by the other equations in (8.1). As in Chapter 2, the notion of weak solution to (8.1) is helpful: denote V = [v e L2((0, K)) : x% € L2((0, #)), v(K) = 0}, and There exists a unique function C e C°([0, T]; L2((0, £))) n L2(0, T; V) such that C(0, K) = (S0 - K)+ and for a.e. T € (0, f), as soon as • ;/ is bounded; • rj is bounded from below by a positive constant r;; • | K |£ | is a bounded function. Exercise 8.1. Prove that since we work with the localized problem instead of the original one, the last condition above can be replaced by jfc e L°°((0, f); L2(0, K)) and II $k HL°°((o,f);L2(0,*)) smal1 enough (compared to j]). The calibration problem consists in finding rj from the observations of • the spot price 50 today; • the prices (c,),e/ of a family of European vanilla calls with different maturities and different strikes (T,-, /iT,),€/. 8.2. Which Space for 77 and Which Tychonoff Functional? 245 We can choose, for example, f > max;e/ TJ andK ^> max((^T,-)/ € /, 50). We consider the least squares problem: find 77 e 1-Lh minimizing where Hh is a suitable closed subset of a possibly infinite-dimensional function space, JR is a suitable Tychonoff regularization functional, and C is the solution to (8.1). Of course, with straightforward modifications, all that follows would carry over to the functional J(rf) — Y^iei wi\C(Ki' TJ) ~ ci:I2> where Wj are nonnegative weights. 8.2 Which Space for i) and Which Tychonoff Functional? The squared volatility rj will eventually belong to a finite-dimensional space (for example, a space made of piecewise polynomial functions), but since the dimension of this space may be large (especially if the degrees of the polynomials are low), it is safer to define JR in an infinite-dimensional space Y, in which it is meaningful to impose bounds on rj and its partial derivative with respect to K. Similarly, since K may be very large, it is safer to choose the functional JR as if K was infinite. We have seen above that we must impose constraints of the type 77 < 77 < fj and \Kj^\ < M. On the one hand, the space 7 must be chosen in such a way that these constraints define a closed subset of Y for the minimization problem to have a solution. On the other hand, we wish Y to be a Hilbert space, because Hilbertian norms are easy to differentiate. Let X be the space which is a Hilbert space with the norm We can check the Sobolev-type embedding X c L°°(R+) n C°(R+) with continuous injection. This comes from the facts that Hl(I) c C°(I) for any compact interval and that Krj(K) = J0 K-j$(K)dic — J0 r](ic)dic, and the Cauchy-Schwarz inequality yields that for all K > 0, \rj(K)\2 < f /0* (k||(/c)|2 + rjV)) die. In fact, from this inequality, we deduce that the embedding X c L°°(R+) is also compact, because it is possible to approximate a function 77 € X by means of a piecewise constant function 77^ with • nN(K) = OforK >N; • rjN(K) = 1 J^ n(K)dK for i + i < K < i + ^±i, 0 < i, ; < AT - 1, and prove that there exists a positive constant C such that \\rj — TJN ||L°°(R+) < -7^ IMIx- 246 Chapter 8. Calibration of Local Volatility with European Options We denote by Y the space of functions from E+ x (0, f) —> R defined by which is a Hilbert space with the norm We have that with a continuous and compact embedding. Therefore, • the set n = {rj e Y, 0 < rj < rj < rj, \KjL\ < M} is a closed subset of Y; • from a bounded sequence (rjn) in Y, one can extract a subsequence (rjn>) that converges in L°°(R+ x (0, f)) and such that K^- converges in L°°(R+ x (0, f)). Now, we change the definitions of X and Y by replacing R+ by (0, K) in (8.4), (8.5), (8.6). If the least squares minimization is set in Yh n "H, where Yh is a finite-dimensional subspace of Y, a good choice for the Tychonoff regularization functional is of the form with suitable positive parameters a/, / = 0,..., 5. A possible example for Yh C Y is the space of bicubic splines whose control nodes lie on the nodes of a quadrangular mesh of Q; see [39] for a review on splines, and [77] for a detailed description of splines in calibration. If the space Yh is not a subspace of Y, then the definition of JR has to be modified by using, for example, mesh dependent norms: for example, if Yh is made of piecewise bilinear functions on a quadrangular mesh Th of Q, then |^y is not a function, so it has to be replaced in each element by some differential quotient involving -j^ on the left and right adjacent elements. Remark 8.2. If the space where the minimization is carried out is of very small dimension with regular functions which are constant for K large enough, then almost any squared norm can be used for JR. 8.3. Existence of a Minimizer 247 For simplicity, we shall assume hereafter that the least squares minimization is set in *Hh = Y}, n "H, where Yh is a finite-dimensional subspace of Y, and that JR is given by (8.8). Remark 8.3. It is possible to add to J a squared error between rj and a Junction rj chosen a priori, often from historical considerations. For example, fj could be the result of calibration on a previous day. Adding such a term prevents the local volatility from varying too much from one day to another. 8.3 Existence of a Minimizer Lemma 8.1. Let Q = (0, K) x (0, f), with 0 < max(50, £,-) < K < K. Consider two functions r/i and n]i in T-ih, call 8rj = r]\ — rj2 and C(r/i) (resp., C(r/2)) the weak solutions to (8.1) corresponding to rj = n\ (resp., rj = rj2), and 8C = C(rji) — C(rj2). Then, for a constant c, Proof. It is possible to prove an analogue to Proposition 2.13, i.e., denoting V = {v e L2((0, K)): K^- e L2((0, £))}, that the weak solution to (8.1) belongs to C°([0, f]; V), QA is such that K2d^KC e L 2 (Q),and l|C07)ll L oo (( o,f);V) and \\K2dKKC(1l)\\L2(Q) are bounded independently of 77 for rj e HhThe function 8C satisfies Therefore, PC||Lcc({0!f);L2(0^)) + ||5C|| L 2 ((0ff);V) < c||5i/||Loc(C). By using an argument close to the proof of Proposition 2.13, it is even possible to prove that ||<$C||LOO((0 ^.y) — c r \\^ l\\L°o(Q)- Then (8.9) follows from a Sobolev-type estimate. Corollary 8.2. The functional J is continuous with respect to the norm || • ||L°°(0Proposition 8.3. There exists a minimizer of J + Jr in HhProof. A minimizing sequence (r]n) is bounded in the norm || • ||y because JR is coercive. It is possible to extract a subsequence (r]n>) which converges in Y/, to 77 e "H^. Therefore, from the continuity of JR and from Corollary 8.2, J(nn>) + JR(r]n>} converges to J(n) + JR(TI). Remark 8.4. The conclusions of Proposition 8.3 hold if the minimization is performed in H because T-L is closed and J + JR is lower semicontinuous. 248 8.4 Chapter 8. Calibration of Local Volatility with European Options The Gradient of J Theorem 8.4. The functional rj K-> J(ri) is Frechet differentiable in ~Hh> and its differential is where P(rj) e L2(Q) is the unique function such that, for any v e L 2 ((0, r), V) with 3Tv e L2(Q)andK2d2KKv e L2(Q), The function P(r]) is called the adjoint state. Proof. Consider 77 e HH and the variation of J produced by a small admissible variation of 77: Sri. The cost function J varies like From Lemma 8.1, there exists a constant c such that X^ € / ^(^M */)2 —c P 7 7lli«'(2)- The variation 8C is a solution to Of course, the regularity results for C hold for <5C. To express 8J explicitly in terms of Sq, an adjoint state function P is introduced: consider the adjoint problem where on the right-hand side the SK,T denote Dirac functions in time and strike, at r and K. The problem (8.14) is a backward parabolic problem in Q with singular data (singular 8.5. The Discrete Problem 249 in r and K}. Yet, it is possible to find very weak solutions to (8.14) by considering first the auxiliary boundary value problem If r] e Hh, (8.15) has a unique weak solution which is piecewise continuous in time with values in L2(0, K) and which belongs to L2((0, f), V), where V = [v e L2(0, K); KdKv e L2(0, K)}. The function P = 3jfW is the unique solution in L2(Q) to the following problem: find P e L 2 (g), such that for any u € L 2 ((0, f), V) with 3Tu e L 2 (Q) and # 2 3 2 ^ € L 2 (0), which is a very weak solution to (8.14). Then by multiplying (8.14) by 8C and integration on Q, the following is found: Note that K2 d2KKC € L2(Q),P e L2(Q),andSrj e L°°(Q), so the previous integral makes sense. Therefore, which implies that J is Frechet differentiable, and its differential is given by (8.11). Proposition 8.5 (necessary optimality conditions). A necessary condition for rj in Hh to be a minimum of J + JR is that for any n' 6 Hh, where P(rj) is the solution to (8.12). 8.5 The Discrete Problem We introduce a partition of the interval [0, f] into subintervals [tn-i,tn], 1 < n < N, with Afj = ti — ti-i, At = max, A*,-, and we assume that all the maturities r,, i e /, coincide with some grid node. We also introduce a partition of the interval [0, K] into subintervals a),- — [/c,_i, K{], 1 < i < Nh + 1, such that 0 = KQ < K\ < • • • < K^h < KA^+I = K. The 250 Chapters. Calibration of Local Volatility with European Options size of the interval o>, is called hj and we set h = max,=i Nt,+\ ht. The mesh Th of [0, K] is the set [u>\, . . . , coNh+i}. We assume that So and the strikes Ki,i € /, coincide with some mesh node. We use piecewise linear finite elements for the discretization with respect to K: we define the discrete space Vh by where P\ (a)) is the space of linear functions on a). The discrete problem arising from Euler's implicit scheme is as follows: Find (C n )o<«<# e Vh satisfying and for all m, 1 < m < N, where ar is defined in (8.2). Let (tu')i=o,...,Ar» be the nodal basis of Vh, and let M and Am in RW+DxM+D be the mass and stiff ness matrices defined by M,I; = (w1, wj),A.™j = a,m(w->, wl),0 < /, j < NhThe matrix Am is tridiagonal and its entries are Denoting C" = (C"(/c 0 ),..., Cm(KNJ)T, (8.19) is equivalent to The cost function is now Note that a variation Sr) of rj produces a variation <5Am of Ar 8.6. A Taste of the Program 251 whereas the variation of Cm satisfies <5C° = 0 and We have The discrete adioint state (P m W m <w is a solution to P^ = 0. and where A r>m is the matrix obtained by transposing Am. Therefore, we have m=l From this and from (8.21), it is easy to compute grad(J(n)). Exercise 8.2. Write down the adjoint problem when a Crank-Nicolson scheme is used for computing Cm. Exercise 8.3. Write down the adjoint problem when a transparent boundary condition is used for Dupire 's equation along with an Euler or Crank—Nicolson scheme. 8.6 A Taste of the Program Here, we focus on the code for computing the gradient of the functional J, assuming that (Cm)m=o,...,M has already been computed: the routine is as follows. 252 Chapter 8. Calibration of Local Volatility with European Options ALGORITHM 8.1. Gradient template <class Vecto, class Tab, class Mat> void dupire_cost<Vecto, Tab,Mat>: :comp_grad_J (const Tab &eta, const Tab &c , Tab & grad) { for(int tit=0;tit<grad.size();tit++) grad[tit]=0; for(int j=0;j<p.size();j++) p[j]=0; // constructs the right-hand side for the adjoint backward parabolic // problem // the observed prices are contained in the array c_ob f o r ( int i_ob=0;i_ob<c_ob.size() ; i_ob++) p[maturities [i_ob] ] [strikes [i_ob]] += 2*weights_ [i_ob] * (c [maturities [i_ob] ] [strikes [i__ob] ] -c_ob [i_ob] ) ; // solves the adjoint backward parabolic problem scheme->backward_loop(eta, p) ; // computes summ(Pm)TSAmUm scheme->Dif f_loop_CP (c,p,grad, eta) ; } The programs for the backward loop for computing the adjoint state and the program for (8.23) are as follows. ALGORITHM 8.2. Backward loop: Adjoint problem. template <class Vecto, class Tab, class Mat> void euler_scheme<Vecto,Tab, Mat>: :backward_loop_iv(const int init_time, const Tab& eta, Tab& y, const Tab &p, const Vecto & ob, const int strike) // p .- price of the put // y : adjoint state // ob: obstacle (K-x)_+ // strike: the index of the strike in the mesh { int ti=t.size()-1; dt=t [ti] -t[ti-l] ; // builds the matrix AT at final time disc- >Build_Imp_Euler_LHS_Matrix_T(dt, eta [ti] ,LhsmatT) ; // modifies the adjoint system in the exercise zone for (int i = 0 ; i < p [ t i ] . s i z e ( ) ; i + + ) if (p[ti] [i]==ob[i]&& disc->meshpoints () [ i ] < 2 * disc-xneshpoints() [strike]) { LhsmatT (i, i) = 1. ; if (i< p[ti] .sizeO -1) LhsmatT (i, i + 1) =0 . ; if ( i > 0 ) LhsmatT(i,i-l)=0; y[ti] [i]=0; } // solves for adjoint state at final time gauss(LhsmatT,y [ti] ) ; // loop on t for(int tit=t.size()-1;tit>init_time+l;tit--) 8.6. A Taste of the Program { 253 dt = t [ t i t - 1 ] - t [ t i t - 2 ] ; d i s c - > r a t e ( ) = r a t e [tit-1] ; // builds the matrix AT disc->Build_Imp_Euler_LHS_Matrix_T(dt,eta[tit-l],LhsmatT); // modifies the adjoint system in the exercise zone for (int i = 0 ; i < p [ t i t - 1 ] . s i z e ( ) ; i + + ) i f ( p [ t i t - l ] [ i ] = = o b [ i ] & & disc->meshpoints ( ) [ i ] < 2 * disc->meshpoints()[strike]) { LhsmatT(i,i)=1.; if (i< p [tit-1] .sizeO -1) LhsmatT(i,i+1)=0.; if (i>0) LhsmatT(i,i-1)= 0; } // Jbuilds the right-hand side of the adjoint problem for (int i = 0 ; i < y [ 0 ] . s i z e ( ) ; i + + ) y [tit-1] [ i ] + = M a s s m a t ( i , i ) * y [ t i t ] [ i ] ; for (int i = 0 ; i < y [ 0 ] . s i z e ( ) - 1 ; i + + ) y [tit-1] [ i ] + = M a s s m a t ( i , i + l ) * y [ t i t ] [i + 1] ; for (int i=l; i < y [ 0 ] . s i z e ( ) ; i + + ) y [tit-1] [ i ] + = M a s s m a t ( i , i - 1 ) * y [ t i t ] [i-1] ; // modifies the right-hand side in the exercise zone for (int i = 0 ; i < p [tit-1] . s i z e ( ) ; i + +) if (p [tit-1] [ i ] = = o b [ i ] & & disc->meshpoints () [i] <2 *disc->meshpoints() [strike] ) y[tit-l] [i]=0; // solves for the adjoint state gauss(LhsmatT,y[tit-1]); } y[init_time]=0; } It calls the following routine. ALGORITHM 8.3. Formula (8.23). template <class Vecto, class Mat> void dupire_fem<Vecto,Mat>::_Diff_LHS_matrix_UP(const double dt,const Vecto & u,const Vecto & p,Vecto & v,const Vecto & eta) { v=0; int i ; double xx,hp,hn; double a,b,c,d; double e=-0.5*dt; hn=h[0] ; for( 1=1;i<h.size()-1;i++) { hp=hn ; // diameter of previous element hn=h[i]; // diameter of current element xx=x[i]; // current node a=xx*xx; 254 Chapter 8. Calibration of Local Volatility with European Options b=a/hp; c=a/hn; v[i] +=e* (b+c) *u[i] *p[i] ; v [ i ] -=e*b*u[i-l] *p[i] ; v [ i ] -=e*c*u[i + l] *p[i] ; } hp=hn; hn=h[i]; xx=x[i]; a=xx*xx; b=a/hp; c=a/hn; v[i] +=e* ( b + c ) * u [ i ] *p[i] ; v[i] - = e * b * u [ i - l ] * p [ i ] ; // diameter of previous element // diameter of last element // last node ] 8.7 Results We consider a family of calls on the S&P 500 index. The spot price is 590 and the implied volatilities for the family of calls are given in Table 8.1. The volatility is discretized by functions that are the sum of • a piecewise affine function in the jc-variable which is constant in the regions K < 250 and x > 830 and affine in the region 250 < x < 830; • a bicubic spline in the region 250 < x < 830, —0.1 < T < 5.5, whose value and derivatives vanish on the boundary of this rectangle. The control points of the spline are plotted in Figure 8.1. We see that the control points are not uniformly distributed: the mesh is refined for small times r and at the money region. In the least squares functional, we have chosen to put a larger weight on the options with a strike close to the money region. Table 8.2 contains the relative errors between the actual observed prices (c,),e/ and the prices computed by the algorithm. The local volatility surface obtained after calibration is plotted in Figure 8.2. Table 8.1. The implied volatility observed on call options on the S&P 500. II 0.85 I 0.9 I 0.95 I I I 1.05 I LI I 1.15 I L2 I L3 I L4 I ° II I I I 0.175 II 0.19 I 0.168 I 0.133 I 0.113 I 0.102 I 0.097 I 0.120 I 0.142 I 0.169 I (X2~ 0.425 0.177 0.155 0.138 0.125 0.109 0.103 0.100 0.114 0.130 0.150 0.625 0.172 0.157 0.144 0.133 0.118 0.104 0.100 0.101 0.108 0.124 0.94 0.171 0.159 0.149 0.137 0.127 0.113 0.106 0.103 0.100 0.110 1 0.171 0.159 0.150 0.138 0.128 0.115 0.107 0.103 0.099 0.108 1.5 0.169 0.160 0.151 0.142 0.133 0.124 0.119 0.113 0.107 0.102 2 0.169 0.161 0.153 0.145 0.137 0.130 0.126 0.119 0.115 0.111 3 0.168 0.161 0.155 0.149 0.143 0.137 0.133 0.128 0.124 0.123 4 0.168 0.162 0.157 0.152 0.148 0.143 0.139 0.135 0.130 0.128 5 || 0.168 | 0.164 | 0.159 | 0.154 | 0.151 | 0.148 | 0.144 | 0.140 | 0.136 | 0.132 T\f 5 8.7. Results 255 Figure 8.1. The grid used for the local volatility. Table 8.2. The relative error between the observed and computed prices. T\f- II 0.175 0.425 0.625 0.94 1 1.5 2 3 4 5 T\K || 0.175 0.425 0.625 0.94 1 1.5 2 3 4 5 0.9 0.95 1 1.05 -0.00050360 -0.006577 -0.005356 -0.004170 -0.00416 -0.00222 -0.003215 -0.002092 -0.001912 -0.000979 -0.00134184 -0.011745 -0.004013 -0.003589 -0.00274 -0.00124 -0.002036 0.0006371 0.0006624 -0.001172 0.00874306 -0.022311 -0.004495 -0.011314 -0.01173 -0.00422 -0.002488 0.0009923 0.0011179 0.0003663 -0.00011394 -0.000725 -0.000188 0.0008474 -0.00061 1.76366e-5 0.0021965 0.0036407 0.0030971 0.0036968 0.000961893 0.0053118 0.0007585 -0.005444 0.002959 -0.00026 0.0064208 0.0078316 0.0033606 0.0035785 1.1 0.0119657 -0.047604 -0.027442 -0.000799 0.000552 0.000711 0.0135983 0.015847 0.0094648 0.0026771 1.15 -0.023659 -0.068850 0.0196397 0.0110919 0.027384 -0.00420 0.0461694 0.0208292 0.012883 0.0072061 1.2 0.0035202 0.0445737 -0.051659 0.0262597 0.113846 0.017756 0.172374 0.0444584 0.0186873 0.0136582 1.3 -0.411383 -0.722029 0.492077 0.66291 0.752714 0.190795 0.12785 0.0886675 0.0384731 0.0167708 1-4 -0.975634 -0.925981 -0.753774 -0.118613 0.018957 0.896564 0.0883746 0.0162867 0.0322194 0.0421486 0.85 | 256 Chapter 8. Calibration of Local Volatility with European Options Figure 8.2. Two views of the local volatility surface obtained by calibration. 8.8. A Stochastic Control Approach 8.8 257 A Stochastic Control Approach The method described below was proposed by Avellaneda et al. [7] and studied in a deeper way by Samperi [108]. It has the advantages of not relying on any parametrization of the volatility and of leading to an unconstrained optimization problem. 8.8.1 A Minimax Dual Program Following Avellaneda et al. [7], we assume that the risk neutralized price of the asset is the process where B, is a standard Brownian motion and where r is the interest rate, assumed constant here. From the observations, we know that where E'' is the expectation with respect to the measure on path space corresponding to a given choice of 77,. Let H be the set of real-valued processes for t € [0, f] that are progressively measurable with respect to some reference probability system and that satisfy 0 < r] < r]t < fj. Let 770 be a given value such that Q<T]0<fj. This value is a prior squared volatility which may be fixed from historical considerations. Let H be a smooth and strictly convex real-valued function defined on R, with minimal value 0 at r]0. The approach to calibration proposed in [7] consists of finding 77* that solves subject to the constraints (8.25). Note that E^/J e~rtH(nt)dt) probability measure. depends on rjt through H(r)t) but also through the Remark 8.5. It is possible to localize the problem for prices lying in [S_, S]. Then the functional in (8.26) should be changed. Remark 8.6. In [7], the function H is called a pseudoentropy, as a reference to relative entropies of probability measures. We define /fo) = -E"(/Qf e^'H^dt), and gt(n) = ^(e~^(STi - £,)+). Assuming that the data (c,),e/ and 50 are such that the problem is solvable, and calling ni the cardinal of /, then the problem is equivalent to finding 77* e H that solves and it is clear that 258 Chapter 8. Calibration of Local Volatility with European Options Denoting U(n) = inf M€R », f ( n ) + £\e/ ^(gi(rj) - c,) and V(fi) = &upnen f ( n ) + Y^iei A l '^'(^)' me problem of maximizing U on H is called the primal program, whereas the problem of minimizing W(yu-) = V(^JL) — ^i€l faCi on W is called the dual program. The gap between sup11€-H U(n) and inf MeR"/ W(^) is called the duality gap. The following lemma can be found in Samperi [108]. Lemma 8.6. Assume that there exists a convex open subset A ofR"' such that 1. for all [M G A, there exists a unique n(/A) e H such that u (u) solves V ( u ) = /(»7(A*)) + E,-€/ /*i& W/*))/ 2. the function V is differentiable in A and W(/LI) = (gi(/7(/<0),..., gn,(n(^}}}T',' 3. the function V is twice differentiable and strictly convex in A. Assume also that there exists ft* e A such that W (/A*) = (c,),r€/. Then the problem (8.26) has a solution, and the corresponding Lagrange multiplier can be found as a local minimum ofW. Proof. We know that there exists fi* such that VV(u*) = (c,)f e/ . This implies on the one hand that VW(u*) = 0, and since A is convex, and W is strictly convex, thanks to item 3, IJL* is the minimum of W on A. On the other hand, from item 2, gi(n(n*)) = c,, i e 7. Therefore, calling 77* = n(n*), we know that n* satisfies the constraints (8.25). On the other hand, it is clear that but which implies that f/(r/*) = sup,^ U(n). In [108], Samperi proves that under some assumptions, the modified value function V corresponding to the regularized problem where 0, (5, t) are smooth approximations of (5 — Ki)+8t=Ti with compact support in (5, 5), satisfies assumptions 1, 2, 3 of Lemma 8.6. To our knowledge, the theory for the genuine V is not complete. With this partial justification, the idea is to now to solve the dual program—minimize W on R";—rather than the primal one. Following the theory for stochastic dynamic programming (see [48,49] and §8.8.2 for a formal derivation), even though the regularity assumptions needed by the theory are not satisfied in the present case, one finds V(^JL) = V(S0,0) by solving the Hamilton-JacobiBellman (HJB) nonlinear partial differential equation: 8.8. A Stochastic Control Approach 259 with the Cauchy condition V(-, T) — 0. Here is the Legendre dual of O; the function <3> is convex, and we have Furthermore, 77 such that f(rj) + 5Z«e/ faSi(n) — ^(/-0 *s given by \ / The theory of HJB equations exceeds the scope of the book. The notion of viscosity solution [37, 49] was developed for that purpose. For the well-posedness, the following lemma is useful. Lemma 8.7. The function 4> is C1-regular and satisfies 4>(0) — 0, <3>'(0) = rj0, and where^^-issetto^>'(0)forx = 0. Furthermore, <$> is smooth and strictly convex in the open region where rj < <&'(x) < 77. There exists x\ < 0 < X2 such that 4>'(jc) = r\ o x < x\, and <J>'(x) = rj -o- x > x2, and <&" jumps at xi andx2. 8.8.2 Formal Derivation of (8.30) Let us replace the term e~rTi £];e/ /*,- (5T. - Jf,-)+ — /QT e~r V/ (Sv ~ Ki)+8v=ridv in ^-^ (T/) by J0r e~rv/jiify (Sv, v)dv, where 0, is a smooth function with compact support. The goal is to compute the function sup^e^ f(rj) + ^GCie/ fa lo e~rv4>i(Sv^ v)dv). The principle of dynamic programming is as follows: Define where Sv is the process given by (8.24) with St = S and where nv = r}(Sv, v). Let 77* be an optimal volatility, and denote V(S, t) = ertj(t, S, 77*). Take the volatility 771 to be We have that 260 Chapter 8. Calibration of Local Volatility with European Options Bute~rtV(S, 0 > J(t, S, rii)ande-"V(Ss,s) = J(s, Ss, r/*); therefore But Ito's formula yields that This is formal, because we do not check the assumptions required by Ito's lemma. Let us subtract (8.35) from (8.34), divide by 5 — t, and let s tend to r+; this gives, formally, and equality holds if rjt = rf: we have obtained formally the analogue of (8.30): 8.8.3 Verification To verify formally why (8.30) and (8.33) lead to the value function, let us assume that we are interested in computing V(/^), the value function of the regularized problem where </>, are smooth functions of 5 and t. Let V be a smooth enough solution to the HJB equation 8.8. A Stochastic Control Approach 261 with the Cauchy condition V(•, f) = 0. From Ito's lemma, we know that where the inequality stems from the definition (8.31) of O. Integrating with respect to time and taking the expectation, we obtain that This proves that V(S0, 0) is greater than V(X). Moreover, this inequality is an equality if r\ satisfies H(n) = rj^djsV(St, 0 - <D(f djsV(St, 0), and from (8.32) and the fact that Q is Cl -regular, if and only if rjt — 4>'(-^-9|5 V (5,, ?))• We have proved that if V is a smooth solution to (8.38), then the value function is V(50, 0) and that the minimum is reached for 77, given by rjt = <D'(f d2ssV(St, t)). 8.8.4 Algorithm Knowing the function V (S, t), the partial derivative Vt =av/auiis computed by solving the linear parabolic equation with the Cauchy condition V, (•, T) = 0. Therefore, it is possible to use a gradient-based algorithm for solving the dual problem, and when the dual problem is solved, a tentative solution to the primal problem is given by (8.33). The dual problem is unconstrained. The evaluation of V (/u.) necessitates W, solves of HJB equations, and VV (u) is computed by solving NI linear parabolic problems. This page intentionally left blank Chapter 9 Calibration of Local Volatility with American Options 9.1 The Calibration Problem In this chapter, we describe a least squares method to calibrate the local volatility a by fitting the prices of a set of vanilla American puts available on the market. In contrast to calibration with European options, it is not possible to use Dupire's equation here, because of the nonlinear character of the American options pricing problem. Therefore, as we shall see below, calibration with American options necessitates many more computations. The calibration problem consists in finding 77 = a2 from the observations of • the spot price 50 today; • the prices (P,),€/ of a family of American puts with different maturities and different strikes (Ti, £",)i € /. We call T = max,e/ 7}. We consider the following least squares problem: find 77 e T-L minimizing where 'H is a suitable closed subset of a possibly infinite-dimensional function space, JR is a suitable Tychonoff regularization functional, and 263 264 Chapter 9. Calibration of Local Volatility with American Options In [2], the inverse problem is studied and optimality conditions are given for suitable choices of T-L and JR. Here, we are interested in the discrete counterpart of the previous least squares problem. As in Chapter 6, we localize the problem (i.e., we consider only 5 e (0, S) for S » max(50, max,6/ AT,-)). We introduce a partition of the interval [0, T] into subintervals [tn-i,tn], 1 < n < N, with Af, = f/ — f,-_i, Af = max, Af,-, and a partition of the interval [0, 5] into subintervals o>, = [5,_i, 5,], 1 < i < Nh + 1, such that 0 = SQ < Si < • • • < SNh < SNh+i = S. The size of the interval o>, is called hi and we set h = max/^.^A^+i hi. We assume that for any i e /, the maturity 7} coincides with some node of the time grid, i.e., there exists Nf < N such that tNi = 7). We also assume that for any i e I, the strike K{ is a node of the 5-grid, i.e., there exists K, < Nh such that Ki = SKi. We introduce the function P0j(S) = (AT,- — S)+. We know from Theorem 6.3 that there exists a constant YQ, 0 < yQ < min,e/ AT,, independent of rj in the class of functions satisfying (9.8) and (9.9) below, such that for all i e /, P, (S, t) coincides with P0,/ (S) in the rectangle [0, 2yo] x [0, 7}]. We choose a mesh node 5 smaller than YQ. Let p < min,€/ /c, be the index such that Sp = 5. With V = [v € L2((0, S)) : 5f| e L2((0, 5)) u(5) = 0}, we introduce Vh as in (6.25), the nodal basis functions (u;')o<i<^» an(^ me closed sets With this notation, the new calibration problem is as follows: where 'H is a suitable closed subset of a finite-dimensional function space, JR is a suitable Tychonoff regularization functional, and P" is the solution of the following discrete problem: Find (/y)o<«<jv,., P" € /Cfcil- satisfying and for all n. 1 < n < Ni. with a, given by Many choices are possible for 'H. For example, let Y be a finite-dimensional vector space of Cl and piecewise smooth real-valued functions on [0, 5] x [0, T] (Y may be a space of bicubic spline functions on [0, S] x [0, T]). Then it will be convenient for what follows to take With 0 < ffmin < 1] < T] < TJmax and 0 < C i- 9.2. A Penalized Problem 265 The space Y can also be made of less regular functions such as continuous and piecewise bilinear functions of S and t on the elements of a Cartesian mesh. In any case, the functions of "H must be continuous and satisfy, for fixed constantsNmuin,rjmSK, and C,,, and With (9.8) and (9.9), the bilinear form at is continuous on V and we have Garding's inequality: there exists X > 0 independent of rj for rj satisfying (9.8) and (9.9), such that The Tychonoff functional JR is chosen as in Chapter 8. 9.2 A Penalized Problem Orientation. We want to find necessary optimality conditions for the least squares problem (9.3). A straightforward derivation of these conditions does not seem possible. For this reason, we are going to prove that the solutions P to (9.4), (9.5) can be found as the limits of the solutions Pe to suitably penalized nonlinear problems, when the penalty parameter € tends to zero. This result, stated in Proposition 9.1 below, is the discrete counterpart of the result stated in Theorem 6.1. Then, in Proposition 9.2 below, we derive optimality conditions for a new least squares problem where the state functions P are replaced by P€. Finally, we will pass to the limit in the optimality conditions as e —> 0. The final result is stated in Theorem 9.6 below. The Penalized Problem. We fix a strike K (assumed to be a mesh point) and a maturity T, we call P0(S) = (K - 5)+, 1C = [v e Vh, v > P0 v = P0 in (0, S)}, and we consider the following problem: Find (Pn)o<n<N, P" € 1C satisfying and for all n, 1 < n < N, We consider a smooth nonincreasing convex function V satisfying assumptions (6.16) (see Figure 6.2), and we denote Ve(x} = V(f). We denote Vh = {vh e Vht vh(Sfi = 0 Vi < p] and we define the discrete penalized problem as follows: Find fP^W.^v. P" e Vi, satisfvine 266 Chapter 9. Calibration of Local Volatility with American Options and for all n, 1 < n < N, P£ - P0 e Vh, and for any v e Vh, where Q, = Qt n (0, K) and £2, c (0, 5) is the support of u/, so ^ is the nodal basis function associated to 5,. In matrix form, (9.14) becomes the following: Find P" e RNh+l such that = f* wi, where wj where M and A" are the mass and stiffness matrices introduced in §4.3 and where G€ is the nonlinear function in R^*"*"1 such that, with obvious notation, (Ge(P))/ = lp<i<K^Ve(Pi — P0(5,)). The function G€ is obviously monotone, i.e., Denoting by X the constant in the Garding's inequality (9.10), we obtain, by using the Lipschitz regularity, the monotonicity of VE and a fixed point argument due to Stampacchia, that for A/ < ^-, (9.13), (9.14) has a unique solution. It is also possible to prove a priori bounds on (P")o<n<N- For this, using the identity for all v e Vh, and defining e" = P" — P0, we obtain that for any v € Vh, Taking v = e" in (9.17), using (9.10) and the nonincreasing character of V€, we obtain that 9.2. A Penalized Problem 267 since there exists a constant C such that, for any v e V, rn-l Multiplying (9.18) by Yi" =l (1 — 2AAf,-) and summing the equations on n, we obtai This proves that maxo<n<Ar Ik" II is bounded uniformly with respect to € (and also with respect to r\ for r\ satisfying assumptions (9.8) and (9.9)). This implies that (P")o<n<jv is bounded (in any norm since (V/,) N+1 is a finite-dimensional space) uniformly with respect to € (and also to 77). It is also clear that the real numbers Ve(P"(S{) — P0(St)) are bounded uniformly with respect to €. We aim at proving that the sequence (P")o<n<N converges to (Pn)o<n<N as e -> 0. To do so, we extract a subsequence that converges, and we want to prove that the limit is precisely (Pn)o<n<N- The main point consists in proving that the limit belongs to ()QN+1. For this, we need to use a discrete maximum principle. As seen in Chapter 3, this amounts to looking for monotonicity properties of the matrix M -f- Af w A". The matrix M + A?nA" cannot be an M-matrix, since the diffusion coefficient ^|- vanishes at S = 0. However, it is very reasonable to assume that the block of M + Af w A" associated to the nodes 5, greater than a given value is an M-matrix. If S_ > 0 and if the block of M + Afw A" associated to the nodes 5, greater than 5 is an M-matrix, then we will prove that P" € /C so the property will hold at the limit. For a matrix A , we call A^ the block of A corresponding to row and column indices greater than or equal to t. Assumption 9.1. We assume that S > 0, i.e., p > 0, and that the parameters h and ^ At are small enough so that the matrices A" and M/ + Af n A" are tridiagonal irreducible Mmatrices for all n, 1 < n < N, and /, p < I < Nh, and for all the functions 77 satisfying (9.8) and (9.9). Proposition 9.1. Let 77 satisfy (9.8) and (9.9), and choose At < -j, with X given in (9.10). Let Assumption 9.1 be satisfied. The sequence (P")o<n<N given by (9.13), (9.14) converges to (Pn)o<n<N given by (9.11), (9.12) in (Vh)N+l as € tends to 0. Proof. For p < i < Nh let us define IJL" f to be the real number, It is clear that the numbers /J," i are bounded uniformly with respect to €. From the uniform bounds on P" and //£,., we know that we can find a sequence €k converging to 0 such that 268 Chapter 9. Calibration of Local Volatility-with American Options (p?k)o<n<N converges to (Pn)Q<n<N in VhN+1, and ^ . converges to tf, p < i < Nh, i < 1 < N,ask tends to oc. It is clear that P° = P0, and that /n" > 0, p < i < Nh. Passing to the limit in (9.21), we obtain that By using (9.17) and the discrete maximum principle (because Mp -\- AfrtA£ is an M-matrix), it is possible to prove by induction on n that Passing to the limit, we obtain that Assume that for some i, p < i < Nh, and for some a > 0, P"(5,) > P0(S{) + a. Then for k large enough, P^(5,-) > P0(S«) + f. This and (9.21) yield that lim^oo ^ , = 0, i.e., /j,f = 0. We have proved that Therefore (Pn)0<n<N satisfies (9.22), (9.24), (9.25) and P"(S,) = P0(St) for i < p. These properties are equivalent to (9.12). Since (9.12) has a unique solution, we have proved that P" = P". The uniqueness of the limit shows that lime^0 P? = PnD Remark 9.1. As proven in [4], the result stated in Proposition 9.1 holds with Assumption 9.1 replaced with the following weaker assumption. Assumption 9.2. Let K' be the integer such that xt> y <£>• K' < i < Nh- We assume that the parameters h and ^ Af are small enough so that the matrices A" and M\ + A/n A" are tridiagonal irreducible M-matrices for all n, 1 < n < N, and I, K' < I < Nh, and for all the functions rj satisfying (9.8) and (9.9). With this assumption, we have P" — P0 > — Ce for a positive constant C. 9.3 Necessary Optimality Conditions For ease of exposition only, we first simplify problem (9.3) by assuming that only one option (with strike K and maturity 7) is observed; i.e., the family / has only one element. The simpler least squares problem reads as follows: Find r] € U minimizing J(n) + JR(n), J(rf) = \PN(S0) - P\2, where It is possible to formulate the discrete variational inequality (9.5) as an identity involving Pn and the real numbers /n" = (Pn - Pn~l, w') + AtnaT-tn(Pn, w'), with additional 9.3. Necessary Optimality Conditions 269 constraints: P" > P0, $ > 0, and ^(Pn(St) - P0(Sj}) - 0. It is then tempting to use the Lagrange machinery for the least squares problem. However, as observed by Bergougnioux and Mignot [ 15] for optimal control of obstacle problems, it is generally not possible to find a necessary optimality condition with as many Lagrange multipliers as there are constraints, because the additional constraints are not qualified and the Lagrange system that one would obtain has no solutions. So it is not easy to derive suitable optimality conditions from the variational inequality itself. Instead, following Ito and Kunish [75] and Hintermiiller [73], it is possible to consider a least squares problem for the penalized version of the inequality in (9.26): Find 77 e U minimizing Je(tf + JR(rj), J6(rj) = \P£N(S0) - P\\ where P° = P0. For 1 < n < N, P? - P0 € Vh, and for any v e Vh, Proceeding as in Chapter 8, it is possible to find necessary optimality conditions for (9.27). To do so, we introduce the adjoint state (y")i<n<N, y" e Vh, such that for all v e Vh, The existence and uniqueness of (9.28) are ensured if Af < -^, A. in (9.10). The existence of a solution to the least squares problem (9.27) is obtained by the same arguments as for Proposition 8.3. We state the necessary optimality condition for (9.27) without any proof. Proposition 9.2. Let n* be a solution of (9.27), and define P*'n to be the corresponding state junction and y*'n the adjoint state solution to (9.28) with rj = n*. For all rj e 1-1, denoting 8n = n — n*, we have 270 Chapter 9. Calibration of Local Volatility with American Options which can also be written as Let (e/),- € N be a sequence of penalty parameters tending to zero, and let 77* be a minimizer of (9.27) with 6 = €,;. Since H is a compact subset of Y, it is possible to extract a subsequence, still denoted £,, such that 77* converges to 77* in H. Arguing exactly as in the proof of Proposition 9.1, it is possible to prove the following result. Lemma 9.3. Let Assumption 9.1 or Assumption 9.2 be satisfied. Let (e,) be a sequence of penalty parameters converging to 0 and let n* be a minimizer of '(9.27) with € = €f. Let 77* converge to n* in 1-L as i -> oo; then (P*.'n)o<n<N converges to (P*'")o<n<N. P*'n € /C/,, the solution to where a>, u,) - (^Sff, Sff) + «~r + ^< 5 '0 + 5S?s <5' 0)S jj, 10) + r(u, u;). Furthermore, for any j, p<j< Nh, /**;". = rK Atn]-^-Vei(P*'n(Sj) - P0(Sj)) converges to At*'" = (P*-n - P*'"-1, wi) + &tna*j_tn(P*<n, w*). Proposition 9.4. With the assumptions of Lemma 9.3, let (e,-) fce a sequence of penalty parameters converging to 0, a/us? /ef n* fee a solution of (9.27) with e = e,. Let n* fee ?/ie /zmi'f 0/77* as / —> oo; f/ien 77* is a solution of (9.26). Proof. For 77 e H, /e.C?*,) + /R^*,) - ^e,(^) + JR(n) because 77* is a minimizer for (9.27) withe = e,*. But /e,ifo*.) = |P*iJV(50) - P\2 converges to J(n*)' = |P*'N(50) - P|2 from Lemma 9.3, and ^,(77) converges to J(N) from Proposition 9.1. Therefore, from the continuity of JR in H, we see that, for all 77 e H, Let 77* be a solution of (9.26) that can be approached by 77*, a solution of (9.27), with e = €,•. In what follows, we drop the index i in e, in order to alleviate the notation. The aim is to find optimality conditions satisfied by 77* by passing to the limit in the optimality conditions obtained for (9.27). For this, the following assumption can be useful. Assumption 9.3. Let 5 be positive. We assume that the parameters h and . h2^t are small enough so that the matrices (A")r and (M/ + Af n A") r are tridiagonal irreducible 9.3. Necessary Optimality Conditions 271 M-matrices for all n, 1 < n < N, and /, p < I < TV/,, and for all the functions r\ satisfying (9.8) and (9.9). Theorem 9.5. Let Assumption 9.1 or Assumption 9.2 be satisfied. Let n* be a solution oj (9.26) that can be obtained as the limit of a sequence (^*) e of solutions of'(9.27). Then there exist (y*'n)i<n<N> y*'n G Vh, and real numbers a", p < i < Nh, 1 < n < N, satisfying Vu e Vfc, (y*-N, v) + A^ (fl*(u, y*>N) + (aN', u>) = 2( M *' W (5 0 ) - P)u(5 0 ), VueVi,, (y*'B - y*'" +l , u) + Ar n ( a t . (u, y*' B ) + <a", u)) = 0, where a" is the linear form on Vh defined by with and such that for any rj € 'H, noting by Srj = rj — n*, which can also be written as 0 < (DJR(ri*), Srj) IfP*>N(S0) - P = 0, then y*>n = 0 and a" = Ofor \<n<N. If Assumption 9.3 is verified and P*'N(S0) - P ^ 0, then 1 < « < N, 272 Chapter9. Calibration of Local Volatility with American Options Proof. We take v = y*'N in the first line of (9.28), and v = y*'" in the second line. Using the nonincreasing character of V€, we obtain that Using (9.19) and the uniform bounds on (P*'n)o<n<N with respect to e and rj e H, we obtain that (y*'")i<n<N is uniformly bounded with respect to e and r] in H, and furthermore that where C depends neither on € nor on r\ eH. From (9.28) and the uniform bound on (y*'n)i<n<N, we infer that the real numbers are all bounded (in absolute value) by a constant independent of 6. Therefore, we can extract a subsequence still called (e) such that P*'n ->• P*'n in V/,, y*,» _^ y*,n m yh^ an(j an _^ an fQT ^j j^ n, p < j < NH, 1 < » < N, and passing to the limit in (9.28) (thanks to Lemma 9.3), we obtain (9.32). Assume that for i < K, P*'H(St) > P0(Si) + £, £ > 0. Fore small enough, P€*'"(5,-) > P0(Si) + | > P0(Si) + €, which implies that aj,- = 0. We have proved that or in equivalent manner (9.34). From the fact that a", v*'"^,) > 0 we deduce (9.35). The next thing to do is to study n*'"y*'n(St) as € -» 0: 9.3. Necessary Optimality Conditions 273 because V e (e) = 0. Since Ve is convex, 0 < Ve(P*'n –ªP0) - H(e) < Vf(P*'n – P0)(Pe*'" – PC - €). However, Ve(P*<n - P0) ^ 0 <s> Pe*'" – P0 < e, and on the other hand P*-n — P0 > —Ce (see the proof of Proposition 9.1 and Remark 9.1). Therefore, | V / (p *,« _ po)(pe*,« _ Po _ 6)| < Ce|V;(P;-n - P0)|. This implies that where we have used the fact that | Ve \ < 7. Finally, from (9.40) we obtain that which implies (9.36). Finally, (9.37) is obtained by passing to the limit in (9.29). Assume that P*'*(S0) - P /= 0 and, without limitations, that P*'N(So) - P > 0. Then for € small enough, P*'N(S0) — P > 0. If Assumption 9.3 is satisfied, then the matrix of the system of linear equations satisfied by (y*'")p<t<Nh is an M-matrix, because —rK V'e > 0. Using the discrete maximum principle, we can prove by induction on N — n that for all 1 < n < N and for all p < j < Nf,, y*'" > 0, and by passing to the limit that yTn > 0. P < l < Nh, 1 < n < N. We have proved (9.39). D Remark 9.2. With the assumptions of Theorem 9.5, and if, at the optimum, we have the strict complementarity then the pairs (y*'n, a n )i<«<# are defined uniquely by (9.32), (9.34), (9.36). In particular, y*'n e Vh satisfies, for all i, p < i < Nh, In this case, the whole sequence (y*'n) converges to (y*'n). Remark 9.3. In the case where the solution P*n" exhibits a free boundary, i.e., there exist N real numbers y£, 1 < n < N, such that for all i, 0 < i < Nh, P*'"(5,-) = P0(5I-) <=> Si < Yh>tnen tne la°k of strict complementarity can occur only at (tn, Yh)i<n<N- From the a priori estimates on y*'n, we can even say that if the strict complementarity condition is not true at (tn, y^)i<w<Ar, then |y*'"(>/^)| < c\fh. Then imposing y*'n(y£) = 0 does not yield a large error on the optimality condition. 274 Chapter 9. Calibration of Local Volatility with American Options Summary on the Optimality Conditions. the following result. We go back to problem (9.3). We have proved Theorem 9.6. Let n* be a minimizer of (9.3) which can be found as a limit of a sequence rfe of minimizers for the penalized problem, and let (P*'n ),-e/ be the solutions to (9.4), (9.5) with n — n*. There exist y*'n e Vh and a"j e R, 1 < n < Nir p < j < Nh, i e I, such that for all v e Vh, with, for all j, n, p < j < Nh, 1 < n < Af,-, such that for any n e H, denoting Sr/ = r/ — r]*, 9.4 Differentiability In [4], the following result is proved. Proposition 9.7. Let Assumption 9.1 or Assumption 9.2 be satisfied for all rj obeying (9.8) and (9.9). Let r] e 1-L be such that the strict complementarity conditions are fulfilled for all i 6 I and for all j, p < j < Nh, where P" is the solution to (9.4), (9.5), andtfj = (P/1 – P/1"1, tu') -|- AtnaT-.tn(P?, wj). The functional J is differentiate at n, and for any admissible variation x ofr/, 9.5. Algorithm 275 where yf = >'"(??),• e Vh, a"j e R, p < j < Nh, are the solution to, for all v e Vh, with Another way of writing (9.46) is 9.5 Algorithm We describe the simplest possible projected descent method in the space Y, where the descent direction is computed thanks to the considerations above. The degrees of freedom of a function x € Y are the values of x at some nodes of a grid and we call them (A£ (X))I<£<L (A^ is the linear form on Y which maps x to its value at a given node). We endow Y with the basis (A£(X))I<^<L defined by A^(A^) = 8^, and we define the inner product (/C*=i atA^' !^=i bt^t)y - Z}/=i atbtAlgorithm. • Choose r] € %, € > 0 and p > 0, set e = +00. • While e > € do 1. Compute (Pi)i€i by (9.4), (9.5), by using, for example, one of the algorithms proposed in §6.5 and J(n) + /afo), J(n) - £*€/ l/f'(So) – £ I2. 2. For all i e 7, compute (yf)!<«<#,., jf € \4 satisfying (9.44). 3. Compute £ € F such that for all x e 7, (C,X)y 276 Chapter 9. Calibration of Local Volatility with American Options 4. Set rj = nH(r] - p(gradJR(rj) projection on K. + £)), e = \\ij - /y||, r> = fj, where TTH is the • end_do The complete justification of the algorithm above is still an open question because it is not proved that -gradJ^(r/) — £ is always a descent direction. However, from Proposition 9.7 and Remark 9.3, we know that most often £ is exactly gradJ(rj): in this case, the algorithm coincides with a projected gradient method. In the numerical tests below, we have used variants of this algorithm (an interior point algorithm due to Herskovits [68]—a quasi-Newton algorithm which can handle general constraints), which have proved very robust. In particular, we never experienced breakdown caused by the fact that the direction Õ is not a descent direction. Parallelism. The algorithm above can be parallelized in a very natural way on a distributed memory machine with Np processors, because the computations of the pairs (P,, y,), i € /, N are independent of each other. We split I in / = U^/* in order to balance the amount of work among the processors, the processor labeled k being responsible for the sums over i e Ik in J(rj) and (9.48). Note that the complexity of the computation of P,, y{ depends on i, so load balancing is not straightforward. The data for TJ and £ are replicated on the Np processors. The processor labeled k computes its own contribution to J(rj) and to (9.48), i.e., the sums over i e /*, in an independent manner; then communications are needed for assembling the sums over i e I in J(n) and in (9.48). For programming, we have used C++ with the message passing library mpi. The following is a simple version of the code for computing the adjoint state y,•. ALGORITHM 9.1. Backward loop for the adjoint problem. template <class Vecto, class Tab, class Mat> void euler_scheme<Vecto,Tab, Mat>::backward_loop_iv(const int init_time, const Tab& eta, Tab& y, const Tab &p, const Vecto & ob,const int strike) // p .- price of the put // y : adjoint state // ob: obstacle (K-x)_+ // strike: the index of the strike in the mesh { int ti=t.size()-1; dt=t[ti]-t[ti-l]; // builds the matrix AT at final time disc->Build_Imp_Euler_LHS_Matrix_T(dt,eta[ti],LhsmatT); // modifies the adjoint system in the exercise zone for (int i = 0 ; i < p [ t i ] . s i z e ( ) ; i + + ) if (p[ti] [ i ] = = o b [ i ] & & disc->meshpoints () [i] <2 * disc->meshpoints() [strike]) { LhsmatT(i,i)=1.; if (i< p[ti] .sizeO -1) LhsmatT(i,i+1)=0.; if ( i > 0 ) LhsmatT(i,i-l)=0; y[ti] [ i ] = 0 ; 9.6. Results 277 } // solves for adjoint state at final time gauss(LhsmatT,y[ti]); // loop on t for(int tit=t.size()-1;tit>init_time+l;tit--) { dt=t [ t i t - 1 ] - t [ t i t - 2 ] ; disc->rate()=rate[tit-1]; // builds the matrix AT disc->Build_Imp_Euler_LHS_Matrix_T(dt,eta[tit-1],LhsmatT); // modifies the adjoint system in the exercise zone for (int i = 0 ; i < p [ t i t - 1 ] . s i z e ( ) ; i + + ) if (p [tit-1] [ i ] = = o b [ i ] & & disc->meshpoints () [ i ] < 2 * disc->meshpoints () [strike]) { LhsmatT(i,i)=l.; if (i< p [ t i t - l ] . s i z e O - 1 ) LhsmatT(i,i + 1 ) = 0 . ; if ( i > 0 ) LhsmatT(i, i - 1 ) = 0; } // builds the right-hand side of the adjoint problem for (int i=0; i<y[0] .size ( ) ; i + + ) y [ t i t - l ] [i]+=Massmat ( i , i ) * y [ t i t ] [i] ; for (int i = 0 ; i<y[0] .size ( ) - 1 ; i + + ) y [tit-1] [ i ] + = M a s s m a t ( i , i + l ) * y [ t i t ] [i+1]; f o r (int i=l; i<y[0] .size ( ) ; i + + ) y [tit-1] [ i ] + = M a s s m a t ( i , i - l ) * y [ t i t ] [i-1]; // modifies the right-hand side in the exercise zone for (int i = 0 ; i < p [ t i t - 1 ] . s i z e ( ) ; i + + ) if (p [tit-1] [ i ] = = o b [ i ] & & disc->meshpoints() [i] <2 *disc->meshpoints() [strike] ) y[tit-l] [i]=0; // solves for the adjoint state gauss(LhsmatT,y[tit-1]); } y [init_time]=0; } 9.6 Results 9.6.1 Testing the Method with a Target Volatility In order to test the method, we choose a given target squared volatility function rjg, and we compute the prices of a series of American puts (with ten different maturities and ten different strikes) by solving (9.4), (9.5) with rj = rjg. The chosen (squared) volatility surface 278 Chapter 9. Calibration of Local Volatility with American Options Figure 9.1. The squared volatility surface to be found by the calibration algorithm. is plotted in Figure 9.1. It is the interpolation on a Cartesian grid of the piecewise constant function and 5 and T are given below. We are aware that such a volatility is not realistic. The reason for choosing it is that the exercise prices of the options are not monotone functions of time. Note also that the function r)g is piecewise affine, and that 0.03 < r/g < 0.05. The other parameters of the computation are • interest rate: 0.06; • observed price: S0 = 590; • 5 = 5 x S0; • the maturities are TI = 0.5i, 1 < i < 10; we set T = 5; • the strikes are at 0.8550,0.950,0.95S0, 50, 1.05S0, 1.150, 1.250, 1.350, and 1.450; • the constraints on rj are 0.005 < r\ < 0.1. By running the calibration program, we aim at recovering the surface plotted in Figure 9.1. 9.6. Results 279 Finite Elements with a Uniform Mesh. In the first test, the squared volatility is described by piecewise bilinear functions ( Q \ ) of S and t, with a uniform 10x10 mesh. The discrete space for rj has dimension 100. The Tychonoff functional is of the form where a, b, c, and d are positive functions to be chosen properly. In particular, these functions play an important role in the out-of-money region, where we do not have any information. The mesh for u is obtained by refining the mesh for 77. It is uniform in the t variable and 25 times finer than the mesh for n. It is nonuniform in the S variable, with a refinement in the money region. The optimization loop is initialized with a uniform volatility: r] = 0.04. At convergence, we obtain the surface plotted in Figure 9.2. We see that the volatility obtained by the algorithm is very close to the goal. It is interesting to plot the relative error between the observed prices and the prices computed with the volatility rj at convergence: In Figure 9.3, we see that the relative error does not exceed 10~3 and is more often of the order 10~5. In Figure 9.4, we plot the graphs showing the convergence of the optimization loop: In the top panel, we see the value of J (n) as a function of the number of iterations, in logarithmic scale. We see that J is reduced by a factor 107. In the bottom panel, the norm of £ -f gradJ R (n), with £ given by (9.48), is displayed. We see the typical behavior of the Newton algorithm, with a quadratic rate near convergence. At convergence, £ + gradJ R (n) is 0, because the constraints on 77 are not active. Figure 9.2. The squared volatility surface obtained by running the calibration program. 280 Chapter 9. Calibration of Local Volatility with American Options Figure 9.3. Relative errors between the observed prices and those obtained with r] found after running the calibration program. It is also possible to use nonuniform meshes for the volatilities (see [4]). However, with finite elements, the number of unknowns for the volatility grows very rapidly, and the quasi-Newton method becomes rapidly expensive in terms of memory and CPU time. Bicubic Splines. We run the same test case, but now, the squared volatility is described by bicubic splines. More precisely, rj is chosen as the sum of • a piecewise affine function of 5 which takes two constant values in the regions 5 < 0.5S0 and S > 1.5S0, and which is linear in the region |5 - 50| < 0.550; • a bicubic spline in the region |5 - 50| < 0.550, \t - T/2\ < T/2, whose value and derivatives vanish on |5 — 50| = 0.5S0 and on \t — T/2\ = T/2. In this experiment, there are 10 x 10 control points. Therefore, the number of degrees of freedom for the volatility is 10 x 10 + 2. The optimization loop is initialized with a uniform volatility: 77 = 0.04. At convergence, we obtain the surface plotted in Figure 9.5. We see that the volatility obtained by the algorithm is not as close to the goal as when discretized by finite elements. The reason for that is clearly that ng is piecewise affine and cannot be represented exactly by bicubic splines. Nevertheless, the main qualitative features of the volatility surface are recovered. The accuracy of the method is best seen when we plot the relative errors between the observed prices and the prices computed with the volatility rj at convergence: In Figure 9.6, we see that the relative error does not exceed 5 x 10~3 and is most often smaller than 10~3. In Figure 9.7, we plot the graphs monitoring the optimization loop: we see that the convergence is much faster than with finite elements. 9.6. Results 281 Figure 9.4. J(t]) as a function of the number of iterations and the norm oft; + grad//j(77), with £ given by (9.48) as a Junction of the number of iterations. 9.6.2 Results with American Puts on the FTSE 100 Index In this paragraph, we consider American puts on the FTSE 100 index. The data correspond to June 6, 2001. We thank Jose" Da Fonseca for providing us with the data. The price of the underlying asset is JCQ = 5890. The American puts correspond to four different maturities: 0.122, 0.199, 0.295, and 0.55 years. We set T = 0.55. The interest rate r varies with time, so r is replaced by r(t) in (9.6), and this function is known. For 282 Chapter 9. Calibration of Local Volatility with American Options Figure 9.5. The squared volatility surface obtained by running the calibration program. Figure 9.6. Relative errors between the observed prices and those obtained with 77 found after running the calibration program. these maturities, the prices of the observed options versus strike are plotted in Figure 9.8. The aim is to find the volatility surface from these prices. The volatility is discretized by functions that are the sum of • a piecewise affine function in the 5-variable which is constant in the regions 5 < 1000 and 5 > 9000 and affine in the region 1000 < 5 < 9000; • a bicubic spline in the region 1000 < 5 < 9000, \t - T/2\ < T/2 + 0.1, whose value and derivatives vanish on the boundary of this rectangle. The control points of the spline are plotted in Figure 9.9, where the time variable is T — t. We see that the 9.6. Results 283 Figure 9.7. J(n) as a function of the number of iterations and the norm of t; + grad7/?(^), with £ given by (9.48) as a junction of the number of iterations. control points are not uniformly distributed: the mesh is refined for small times t and at the money region. The grid for u is nonuniform with 745 nodes in the S-direction and 210 nodes in the f-direction. For simplicity, the grid is chosen in such a way that the points (7}, J£,),e/ coincide with some grid nodes. 284 Chapter 9. Calibration of Local Volatility with American Options Figure 9.8. The data for the inverse problem: the prices of a family of American puts on the FTSE 100 index. Figure 9.9. The control points of the bicubic splines. The (squared) volatility obtained at convergence is displayed in Figure 9.10: the surface has a smile shape. The relative errors between the observed prices and those computed at convergence are plotted in Figure 9.11, top. They are larger than those observed for the test problem in §9.6.1. However, we have to realize that the available observed prices are themselves given with a roundoff error, which is exactly 0.5. In Figure 9.11, bottom, we 9.6. Results 285 Figure 9.10. The squared volatility surface obtained by running the calibration program. have plotted the relative roundoff error on the observed prices. Doing so, we see that the relative errors on the prices at convergence are of the same order as the roundoff error on the observed prices. Therefore, it is very natural that the optimization program cannot improve on this level of error. 286 Chapter 9. Calibration of Local Volatility with American Options Figure 9.11. Top: relative errors between the observed prices and those obtained with rj found after running the calibration program. A curve corresponds to a given maturity. Bottom: relative roundoff error on observed prices. The two errors are of the same order. Bibliography [1] Milton Abramowitz and Irene A. Stegun, editors. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Dover, New York, 1992. [2] Yves Achdou. An inverse problem for a parabolic variational inequality arising in volatility calibration with American options. SIAMJ. Control Optim., 43:1583–1615, 2005. [3] Yves Achdou, Bruno Franchi, and Nicoletta Tchou. A partial differential equation connected to option pricing with stochastic volatility: Regularity results and discretization. Math. Comp., 74:1291-1322, 2005. [4] Yves Achdou and Olivier Pironneau. A numerical procedure for the calibration of American options. To appear inAppl. Math. Finance. [5] Yves Achdou and Nicoletta Tchou. Variational analysis for the Black and Scholes equation with stochastic volatility. M2ANMath. Model. Numer. Anal, 36:373-395, 2002. [6] L.B.G Andersen and R. Brotherton-Ratcliffe. The equity option volatility smile: An implicit finite difference approach. J. Comput. Finance, 1:5-32, 1998. [7] M. Avellaneda, M. Friedman, C. Holmes, and D. Samperi. Calibrating volatility surfaces via relative entropy minimization. Appl. Math. Finance, 4:37–64, 1997. [8] Owe Axelsson. Iterative Solution Methods. Cambridge University Press, New York, 1994. [9] Vlad Bally. An elementary introduction to Malliavin calculus. INRIA Research Report, 4718(February), 2003. [10] Vlad Bally, L. Caramello, and A. Zanette. Pricing and hedging American option by Monte-Carlo methods using a Malliavin calculus approach. INRIA Research Report, 4804(April), 2003. [11] Guy Barles, Julien Burdeau, Marc Romano, and Nicolas Samsoen. Estimation de la frontiere libre des options amdricaines au voisinage de 1'e'che'ance. C. R. Acad. Sci. Paris Ser. I Math., 316:171–174, 1993. [12] A. Bensoussan. On the theory of option pricing. ActaAppl. Math., 2:139158–,1984. 287 288 Bibliography [13] Alain Bensoussan and Jacques-Louis Lions. Impulse Control and Quasivariational Inequalities. \JL. Gauthier-Villars, Montrouge, 1984. Translated from the French by J. M. Cole. [14] Amal Bergam, Christine Bernardi, and Zoubida Mghazli. A posteriori analysis of the finite element discretization of a nonlinear parabolic equation. Math. Comput., 74: 1097–1116,2005. [15] Mai'tine Bergounioux and Fulbert Mignot. Optimal control of obstacle problems: Existence of Lagrange multipliers. ESAIM Control Optim. Calc. Var., 5:45-70, 2000. [16] F. Black and M. Scholes. The pricing of options and corporate liabilities. J. Pol. Econ., 81:637–659, 1973. [17] Phelim P. Boyle and Draviam Thangaraj. Volatility estimation from observed option prices. Decis. Econ. Finance, 23:31-52, 2000. [18] Dietrich Braess. Finite Elements: Theory, Fast Solvers, and Applications in Solid Mechanics. Cambridge University Press, Cambridge, 2001. Second Edition. [19] Michael J. Brennan and Eduardo S. Schwartz. The valuation of the American put option. J. Finance, 32:449-462, 1977. [20] S.C. Brenner and R. Scott. The Mathematical Theory of Finite Element Methods. Volume 15 of Texts in Applied Mathematics. Springer-Verlag, New York, 1994. [21] H. Brezis. Analyse Fonctionnelle, Theorie et Applications. Masson, Paris, 1983. [22] Mark Broadie and Paul Glasserman. Pricing American-style securities using simulation. J. Econom. Dynam. Control, 21:1323-1352, 1997. [23] Hans-Joachim Bungartz and Michael Griebel. Sparse grids. Acta Numerica, 13:1– 123, 2004. [24] P. Carr and D. Madan. Option valuation using the fast Fourier transform. J. Comput. Finance, 2:61-73, 1998. [25] Thierry Cazenave and Alain Haraux. An Introduction to Semilinear Evolution Equations. The Clarendon Press, Oxford University Press, New York, 1998. Translated from the 1990 French original by Yvan Martel and revised by the authors. [26] Terence Chan. Pricing contingent claims on stocks driven by Le'vy processes. Ann. Appl. Probab., 9:504–528, 1999. [27] P.G Ciarlet. The Finite Element Method for Elliptic Problems. North-Holland, Amsterdam, 1978. Revised Edition: SIAM, Philadelphia, PA, 2002. [28] P.G Ciarlet. Basic error estimates for elliptic problems. In Handbook of Numerical Analysis, Vol. II, 17-351. North-Holland, Amsterdam, 1991. [29] T.F. Coleman, Y. Li, and A. Verma. Reconstructing the unknown local volatility function. J. Comput. Finance, 2:77-102, 1999. Bibliography 289 [30] R. Cont and P. Tankov. Financial Modelling with Jump Processes, Chapman and Hall, Boca Raton, FL, 2003. [31] Rama Cont and Peter Tankov. Nonparametric calibration of jump-diffusion option pricing models. J. Comput. Finance, 7:1-49, 2004. [32] Rama Cont and Ekaterina Voltchkova. Finite Difference Methods for Option Pricing in Jump-Diffusion and Exponential Levy Models. Rapport Interne 513, CMAP, Ecole Polytechnique, 2003. [33] Rama Cont and Ekaterina Voltchkova. Integra-differential Equations for Option Prices in Exponential Levy Models. Rapport Interne 547, CMAP, Ecole Polytechnique, 2004. [34] R. Courant. Variational methods for the solution of problems of equilibrium and vibrations. Bull. Amer. Math. Soc., 49:1-23, 1943. [35] R. Courant, K. Friedrichs, and H. Lewy. On the partial difference equations of mathematical physics. IBM J. Res. Develop., 11:215-234, 1967. [36] J.C. Cox and M. Rubinstein. Option Market. Prentice-Hall, Englewood Cliffs, NJ, 1985. [37] Michael G. Crandall, Hitoshi Ishii, and Pierre-Louis Lions. User's guide to viscosity solutions of second order partial differential equations. Bull. Amer. Math. Soc. (N.S.), 27:1-67, 1992. [38] lonut Danaila, Fre'de'ric Hecht, and Olivier Pironneau. Simulation Numerique en C++. Dunod, Paris, 2003. [39] Carl de Boor. A Practical Guide to Splines. Volume 27 of Applied Mathematical Sciences. Springer-Verlag, New York, 2001. Revised Edition. [40] S. DelPino and O. Pironneau. FreeFemBD. www.ann.jussieu.fr. [41] B. Dupire. Pricing with a smile. Risk, 7:18-20, 1994. [42] Ernst Eberlein. Application of generalized hyperbolic LeVy motions to finance. In Levy Processes, 319-336. Birkhauser Boston, Boston, MA, 2001. [43] Ernst Eberlein and Karsten Prause. The generalized hyperbolic model: Financial derivatives and risk measures. In Mathematical Finance—Bachelier Congress, 2000 (Paris), Springer Finance, 245-267. Springer-Verlag, Berlin, 2002. [44] Ernst Eberlein and Sebastian Raible. Term structure models driven by general Levy processes. Math. Finance, 9:31-53, 1999. [45] Kenneth Eriksson, Don Estep, Peter Hansbo, and Claes Johnson. Introduction to computational methods for differential equations. In Theory and Numerics of Ordinary and Partial Differential Equations (Leicester, 1994), Adv. Numer. Anal., IV, 77-122. Oxford University Press, New York, 1995. 290 Bibliography [46] Kenneth Eriksson and Claes Johnson. Adaptive finite element methods for parabolic problems. I. A linear model problem. SIAM J. Numer. Anal., 28:43–77, 1991. [47] Kenneth Eriksson and Claes Johnson. Adaptive finite element methods for parabolic problems. II. Optimal error estimates in L^L-i and L^Loo- SIAM J. Numer. Anal., 32:706–740, 1995. [48] Wendell H. Fleming and Raymond W. Rishel. Deterministic and Stochastic Optimal Control. Volume 1 of Applications of Mathematics. Springer-Verlag, New York, 1975. [49] Wendell H. Fleming and H. Mete Soner. Controlled Markov Processes and Viscosity Solutions. Volume 25 of Applications of Mathematics. Springer-Verlag, New York, 1993. [50] P.A. Forsyth and K.R. Vetzal. Quadratic convergence for valuing American options using a penalty method. SIAM J. Sci. Comput., 23:2095-2122, 2002. [51] Jean-Pierre Fouque, George Papanicolaou, and K. Ronnie Sircar. Derivatives in Financial Markets with Stochastic Volatility. Cambridge University Press, Cambridge, 2000. [52] Eric Fournie", Jean-Michel Lasry, Je'rome Lebuchoux, and Pierre-Louis Lions. Applications of Malliavin calculus to Monte-Carlo methods in finance. II. Finance Stock., 5:201-236,2001. [53] Eric Fournie', Jean-Michel Lasry, Je'rome Lebuchoux, Pierre-Louis Lions, and Nizar Touzi. Applications of Malliavin calculus to Monte Carlo methods in finance. Finance Stock., 3:391^12, 1999. [54] Leopoldo P. Franca, Sergio L. Frey, and Thomas J. R. Hughes. Stabilized finite element methods. I. Application to the advective-diffusive model. Comput. Methods Appl. Meek. Engrg., 95:253-276, 1992. [55] A. Friedman. Partial Differential Equations of Parabolic Type. Prentice-Hall, Englewood Cliffs, NJ, 1964. [56] Avner Friedman. Regularity theorems for variational inequalities in unbounded domains and applications to stopping time problems. Arch. Rational Meek. Anal., 52:134–160, 1973. [57] Avner Friedman. Stochastic games and variational inequalities. Arch. Rational Meek. Anal, 51:321-346, 1973. [58] K.O. Friedrichs. The identity of weak and strong extensions of differential operators. Trans. Amer. Math. Soc., 55:132-151,1944. [59] M. Galassi, J. Davies, J. Theiler, B. Gough, G Jungman, M. Booth, and F. Rossi. The GNU Scientific Library, www.gnu.org/software/gsl. Bibliography 291 [60] Paul Glasserman. Monte Carlo Methods in Financial Engineering. Volume 53 of Applications of Mathematics. Springer-Verlag, New York, 2004. [61] Roland Glowinski, Jacques-Louis Lions, and Raymond Tremolieres. Numerical Analysis of Variational Inequalities. Volume 8 of Studies in Mathematics and Its Applications. North-Holland, Amsterdam, 1981. Translated from the French. [62] Gene H. Golub and Charles F. Van Loan. Matrix Computations. The Johns Hopkins University Press, Baltimore, MD, 1989. Second Edition. [63] M. Griebel. Adaptive sparse grid multilevel methods for elliptic PDEs based on finite differences. Computing, 61:151-179, 1998. [64] M. Griebel and P. Oswald. Tensor-product-type subspace splittings and multilevel iterative methods for anisotropic problems. Adv. Comput. Math., 4:171–206, 1995. [65] M. Griebel, M. Schneider, and C. Zenger. A combination technique for the solution of sparse grid problems. In Proceedings of the IMACS International Symposium on Iterative Methods in Linear Algebra, 263-281, Elsevier, Amsterdam, 1992. [66] Andreas Griewank. Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation. Volume 19 of Frontiers in Applied Mathematics. SIAM, Philadelphia, PA, 2000. [67] J. Michael Harrison and Stanley R. Pliska. Martingales and stochastic integrals in the theory of continuous trading. Stochastic Process. AppL, 11:215–260, 1981. [68] J. Herskovits. Feasible direction interior-point technique for nonlinear optimization. J. Optim. Theory AppL, 99:121-146, 1998. [69] Magnus R. Hestenes and Eduard Stiefel. Methods of conjugate gradients for solving linear systems. J. Research Nat. Bur. Standards, 49:409-436, 1952. [70] S. Heston. A closed-form solution for options with stochastic volatility with application to bond and currency options. Rev. Financial Studies, 6:327-343, 1993. [71] N. Hilber, A.M. Matache, and C. Schwab. Sparse Wavelets Methods for Option Pricing under Stochastic Volatility. Technical report, Seminar for Applied Mathematics, ETH Zurich, 2004. [72] M. Hintermuller, K. Ito, and K. Kunisch. The primal-dual active set strategy as a semismooth Newton method. SIAM J. Optim., 13:865-888, 2002. [73] Michael Hintermuller. In verse coefficient problems for variationa! inequalities: Optimality conditions and numerical realization. M2AN Math. Model. Numer. Anal., 35:129–152,2001. [74] J.C. Hull and A. White. The pricing of options on assets with stochastic volatilities. J. Finance, 42:281-300, 1987. 292 Bibliography [75] K. Ito and K. Kunisch. Optimal control of elliptic variational inequalities. Appl. Math. Optim., 41:343–364, 2000. [76] Kazufumi Ito and Karl Kunisch. Semi-smooth Newton methods for variational inequalities of the first kind. M2AN Math. Model. Numer. Anal., 37:41–62, 2003. [77] N. Jackson, E. Siili, and S. Howison. Computation of deterministic volatility surfaces. App. Math. Finances, 2:5-32, 1998. [78] Patrick Jaillet, Damien Lamberton, and Bernard Lapeyre. Variational inequalities and the pricing of American options. ActaAppl. Math., 21:263-289, 1990. [79] I. Karatzas and S. E. Shreve. Brownian Motion and Stochastic Calculus. SpringerVerlag, New York, 1991. Second Edition. [80] Joseph B. Keller and Dan Givoli. Exact nonreflecting boundary conditions. J. Comput. Phys., 82:172-192, 1989. [81] C.T. Kelley. Iterative Methods for Linear and Nonlinear Equations. Volume 16 of Frontiers in Applied Mathematics. SIAM, Philadelphia, PA, 1995. [82] D. Kinderlehrer and G Stampacchia. An Introduction toVariational Inequalities and Their Application. Academic Press, New York, 1980. [83] R. Lagnado and S. Osher. Reconciling differences. Risk, 10:79-83, 1997. [84] R. Lagnado and S. Osher. A technique for calibrating derivative security pricing models: Numerical solutions of an inverse problem. J. Comput. Finance, 1:13-25, 1997. [85] D. Lamberton and B. Lapeyre. Introduction au Calcul Stochastique Applique a la Finance. Ellipses, Paris, 1997. [86] Damien Lamberton. Critical price for an American option near maturity. In Seminar on Stochastic Analysis, Random Fields and Applications (Ascona, 1993). Volume 36 of Progress in Probability, 353-358. Birkhauser, Basel, 1995. [87] B. Lapeyre and A. Sulem. Simulation of Financial Models: Mathematical Foundations and Applications. Cambridge University Press, Cambridge, to appear. [88] P.D. Lax and R.D. Richtmyer. Survey of the stability of linear finite difference equations. Comm. Pure Appl. Math., 9:267-293, 1956. [89] Jacques-Louis Lions. Quelques Methodes de Resolution des Problemes aux Limites non Lineaires. Dunod, Paris, 1969. [90] Jacques-Louis Lions and Enrico Magenes. Problemes aux Limites non Homogenes et Applications, Vols. I and II. Dunod, Paris, 1968. [91] Yuh-Dauh Lyuu. Financial Engineering and Computation: Principles, Mathematics, Algorithms. Cambridge University Press, Cambridge, 2002. Bibliography 293 [92] D. Madan. Financial modeling with discontinuous price processes. In O.E. BarndorffNielsen, T. Mikosh, and S. Resnick, editors, Levy Processes—Theory and Applications. Birkhauser Boston, Boston, MA, 2001. [93] A.-M. Matache, P.-A. Nitsche, and C. Schwab. Wavelet Galerkin Pricing of American Options on Levy Driven Assets. 2003. Research Report SAM 2003-06. [94] A.-M. Matache, C. Schwab, and T.P. Wihler. Fast Numerical Solution of Parabolic Integra-differential Equations with Applications in Finance. Technical report no. 1954, IMA University of Minnesota, Minneapolis, MN, 2004. [95] A.-M. Matache, T. von Petersdoff, and C. Schwab. Fast deterministic pricing of Levy driven assets. M2AN Math. Model. Numer. Anal, 38:37–72, 2004. [96] Stephen F. McCormick, editor. Multigrid Methods. Volume 3 of Frontiers in Applied Mathematics. SI AM, Philadelphia, PA, 1987. [97] Robert C. Merton. Theory of rational option pricing. Bell J. Econom. Management Sci., 4:141–183, 1973. [98] A. Pazy. Semigroups of Linear Operators and Applications to Partial Differential Equations. Volume 44 of Applied Mathematical Sciences. Springer-Verlag, New York, 1983. [99] HuyenPham. Optimal stopping of controlled jump-diffusion processes: A viscosity solution approach. J. Math. Systems, 8:1-27,1998. [100] O. Pironneau and F. Hecht. freefem++, www.freefem.org. [101] Elijah Polak. Optimization: Algorithms and Consistent Approximations. Volume 124 of Applied Mathematical Sciences. Springer-Verlag, New York, 1997. [102] M.H. Protter and H.F. Weinberger. Maximum Principles in Differential Equations. Springer-Verlag, New York, 1984. Corrected reprint of the 1967 original. [103] P.-A. Raviart and J.-M. Thomas. Introduction a Vanalyse numerique des equations auxderivees partielles. Masson, Paris, 1983. [104] A. Revuz and M. Yor. Continuous Martingale Calculus. Springer-Verlag, New York, 1990. [105] Robert D. Richtmyer and K. W. Morton. Difference methods for initial-value problems. Interscience Tracts in Pure and Applied Mathematics, No. 4. John Wiley & Sons, New York, London, Sydney, 1967. Second Edition. [106] Y. Saad. Iterative Methods for Sparse Linear Systems. PWS Publishing Company, Boston, MA, 1996. Second Edition: SLAM, Philadelphia, PA, 2003. [107] Y. Saad and M.H. Schultz. GMRES: A generalized minimal residual algorithm for solving nonsymmetric linear systems. SIAM J. Sci. Statist. Comput., 7:856–869, 1986. 294 Bibliography [108] Dominick Samperi. Calibrating a diffusion pricing model with uncertain volatility: Regularization and stability. Math. Finance, 12:71–87, 2002. [109] Dominik Schotzau and Christoph Schwab, /z/7-discontinuous Galerkin time-stepping for parabolic problems. C. R. Acad. Sci. Paris Ser. I Math., 333:1121–1126, 2001. [110] E. Stein and J. Stein. Stock price distributions with stochastic volatility: An analytic approach. Rev. Financial Studies, 4:727-752, 1991. [Ill] G Strang and GJ. Fix. An Analysis of the Finite Element Method. Prentice-Hall, Englewood Cliffs, NJ, 1973. [112] Vidar Thomee. Galerkin Finite Element Methods for Parabolic Problems. Volume 25 of Springer Series in Computational Mathematics. Springer-Verlag, Berlin, 1997. [113] H.A. van der Vorst. Bi-CGSTAB: A fast and smoothly converging variant of Bi-CG for the solution of nonsymmetric linear systems. SIAMJ. Sci. Statist. Comput., 13:631-644, 1992. [114] T. von Petersdoff and C. Schwab. Numerical solutions of parabolic equations in high dimensions. M2AN Math. Model. Numer. Anal., 38:93-128, 2004. [115] T. Werder, K. Gerdes, D. Schotzau, and C. Schwab, hp-discontinuous Galerkin time stepping for parabolic problems. Comput. Methods Appl. Mech. Engrg., 190:66856708,2001. [116] Paul Wilmott, Jeff Dewynne, and Sam Howison. Option Pricing. Oxford Financial Press, Oxford, 1993. [117] Paul Wilmott, Sam Howison, and Jeff Dewynne. The Mathematics of Financial Derivatives: A Student Introduction. Cambridge University Press, Cambridge, 1995. [118] C. Zenger. Sparse grids. In W. Hackbusch, editor, Parallel Algorithms for Partial Differential Equations. Volume 31 of Notes on Numerical Fluid Mechanics. Vieweg, Braunschweig/Wiesbaden, 1991. [119] R. Zvan, P.A. Forsyth, and K.R. Vetzal. Penalty methods for American options with stochastic volatility. /. Comput. Appl. Math., 91:199-218, 1998. Index A posteriori error estimates, 96 A posteriori error indicators, 156 A priori error estimates, 95 Adaptive mesh refinement, 151 Adaptive method for American options, 208 for basket options, 172 for European options, 165 Adjoint state, 248, 269 Algorithm Brennan and Schwartz, 201 front tracking, 201 projected SOR, 199 SOR, 199 Algorithms for the American puts, 198 American options, 185 calibration with, 263 Antithetic variate, 13 Arbitrage, 2 Armijo's rule, 231 Asian option, 85 Automatic differentiation, 222 with American options, 263 with European options, 243 Central limit theorem, 11 CFL condition, 63 CMGY process, 45, 117 Compressed row storage, 137 Consistency definition, 60 of the Crank–Nicolson scheme, 70 of the Euler explicit scheme, 61 of the Euler implicit scheme, 67 Control variate, 13 Convergence definition, 61 of the Euler explicit scheme, 64 of the Euler implicit scheme, 69 of the Euler implicit scheme in the primitive variables, 80 of the finite element method, 95 of the finite element method for the American put, 195 Convexity of the European put's price, 38 Crank–Nicolson scheme, 69 Barrier options, 43 Barycentric coordinates, 101 Basket options, 46, 83, 126, 172 Binomial option pricing, 17 Binomial tree, 17 Black–Scholes formula, 6 Brownian motion, 3 Diagonal dominant matrix, 72, 199 Dividends, 27 discretely paid dividends, 27 Drift, 3 Dupire's equation, 40 for calibration, 243 Entropy, 257 Euler explicit scheme, 58 Euler implicit scheme, 66 Exercise boundary, 189 discrete, 198 Calibration, 4 of jump diffusion models, 243 stochastic control approach, 257 295 Index 296 Filtration, 2 natural, 2 Finite difference scheme, 57 for Asian options, 85 for basket options, 83 for European options, 81 Finite elements adaptive, for American options, 208 adaptive, for basket options, 172 adaptive, for European options, 165 adaptivity, 151 for American options, 192 for basket options, 126 for European options, 107 for options on Levy driven assets, 114 for stochastic volatility models, 133 stabilization, 103 with variable meshes, 155 Free boundary for the American put, 189 in the discrete problem for the American put, 198 Garding's inequality, 32–35, 77, 153, 187, 193, 194, 196, 198 GNU Scientific library, 7 Gradient method, 230 Greeks, 223 delta, 223 gamma, 223 kappa, 223 rho, 223 time–decay, 223 Hamilton–Jacobi–Bellman equation, 258 Hedging, 4 High dimensions, 142 Infinitesimal generator, 24 Interest rate, 3 Ito's formula, 23, 24, 51, 260 multidimensional, 46 two–dimensional, 49, 50 Jump diffusion, 44 Lagrange finite elements, 99 Least squares inverse problem, 243 Line search rules, 232 Local volatility, 27, 104, 209 Localization, 39 Logarithmic prices, 26 Levy driven assets, 44, 114 LeVy process, 44 M–matrix, 72, 267, 268 Martingale, 2 Mass lumping, 102, 106 Mass matrix, 100 Matrix assembly in the finite element method, 128 Maturity, 1 Maximum principle, 35, 190 consequences, 37 discrete, 72, 267, 268 Monte–Carlo, 8 Nodal basis, 101 Optimality conditions for calibration with American options, 268 for calibration with Dupire's equation, 249 Optimization problem ill–posed, 229 stiff, 230 unstable, 229 Option American, 15 Asian, 16 barrier, 5, 10 cash or nothing, 5 European call, 1 European put, 5 exercise the, 1 lookback, 17 on a basket, 6 vanilla, 1 Payoff, 5 Penalized problem for the American put, 188 297 Index discrete, 265 Primitive variables (Black-Scholes equation in the), 76 Put-call parity, 5, 38 Random variable numerical, 8 with the GSL, 12 Security, 1 Shape functions, 102 Smile, 228 Sparse tensor product spaces, 142 Spot price, 1 Stability by the energy method, 79 definition, 60 in the finite element method, 156 of the Crank-Nicolson scheme, 70 of the Euler explicit scheme, 61 of the Euler implicit scheme, 68 of the Euler scheme for the American puts, 194 Stability condition, 63 Steepest descent, 231 Step size, 230 Stiffness matrix, 100 Stochastic control, 257 Stochastic volatility, 48, 133 Stopping time, 2 Strike, 1 Super-replication principle, 38 Transparent boundary condition, 110 Triangulation, 95 Tychonoff functional, 245 Tychonoff regularization, 229 Underlying asset, 1 Upwinding, 71, 85 Variance Gamma process, 45 Variance reduction, 12 Variational inequality, 186 Volatility, 3 historical, 228 implied, 228 local, 4, 228 Wavelets, 142 Weak (or variational) formulation, 31, 96, 186