Final Projects Introduction to Numerical Analysis atzberg/fall2006/index.html Professor: Paul J.

Similar documents
Final Projects Introduction to Numerical Analysis Professor: Paul J. Atzberger

Lecture Quantitative Finance Spring Term 2015

Project 1: Double Pendulum

MATH3075/3975 FINANCIAL MATHEMATICS TUTORIAL PROBLEMS

NEWCASTLE UNIVERSITY SCHOOL OF MATHEMATICS, STATISTICS & PHYSICS SEMESTER 1 SPECIMEN 2 MAS3904. Stochastic Financial Modelling. Time allowed: 2 hours

FX Smile Modelling. 9 September September 9, 2008

Lecture 6: Option Pricing Using a One-step Binomial Tree. Thursday, September 12, 13

IEOR E4602: Quantitative Risk Management

Markov Decision Processes: Making Decision in the Presence of Uncertainty. (some of) R&N R&N

Chapter 15: Jump Processes and Incomplete Markets. 1 Jumps as One Explanation of Incomplete Markets

Department of Mathematics. Mathematics of Financial Derivatives

Derivative Securities

Mathematics of Finance Final Preparation December 19. To be thoroughly prepared for the final exam, you should

Utility Indifference Pricing and Dynamic Programming Algorithm

F A S C I C U L I M A T H E M A T I C I

Risk Management Using Derivatives Securities

FIN FINANCIAL INSTRUMENTS SPRING 2008

Monetary Economics Final Exam

The Black-Scholes Model

Lecture Note 8 of Bus 41202, Spring 2017: Stochastic Diffusion Equation & Option Pricing

MATH 476/567 ACTUARIAL RISK THEORY FALL 2016 PROFESSOR WANG. Homework 3 Solution

A simple wealth model

The Black-Scholes Model

The Black-Scholes Equation

4. Black-Scholes Models and PDEs. Math6911 S08, HM Zhu

DRAFT. 1 exercise in state (S, t), π(s, t) = 0 do not exercise in state (S, t) Review of the Risk Neutral Stock Dynamics

Problem set 5. Asset pricing. Markus Roth. Chair for Macroeconomics Johannes Gutenberg Universität Mainz. Juli 5, 2010

ECON FINANCIAL ECONOMICS

Valuing Stock Options: The Black-Scholes-Merton Model. Chapter 13

Evaluating the Black-Scholes option pricing model using hedging simulations

Exercises on the New-Keynesian Model

PhD Qualifier Examination

Solutions of Exercises on Black Scholes model and pricing financial derivatives MQF: ACTU. 468 S you can also use d 2 = d 1 σ T

Mathematics in Finance

Solving the Black-Scholes Equation

Lecture Quantitative Finance Spring Term 2015

Probability in Options Pricing

Problem 1: Markowitz Portfolio (Risky Assets) cov([r 1, r 2, r 3 ] T ) = V =

A No-Arbitrage Theorem for Uncertain Stock Model

ECON 6022B Problem Set 2 Suggested Solutions Fall 2011

1 Implied Volatility from Local Volatility

Practical example of an Economic Scenario Generator

Risk Measurement in Credit Portfolio Models

2.1 Mean-variance Analysis: Single-period Model

Advanced Financial Economics Homework 2 Due on April 14th before class

Chapter 8. Markowitz Portfolio Theory. 8.1 Expected Returns and Covariance

Exercises for Chapter 8

Financial Giffen Goods: Examples and Counterexamples

P VaR0.01 (X) > 2 VaR 0.01 (X). (10 p) Problem 4

Version A. Problem 1. Let X be the continuous random variable defined by the following pdf: 1 x/2 when 0 x 2, f(x) = 0 otherwise.

Handout 8: Introduction to Stochastic Dynamic Programming. 2 Examples of Stochastic Dynamic Programming Problems

Forwards and Futures. Chapter Basics of forwards and futures Forwards

The test has 13 questions. Answer any four. All questions carry equal (25) marks.

Ph.D. Preliminary Examination MICROECONOMIC THEORY Applied Economics Graduate Program June 2017

Chapter 6 Analyzing Accumulated Change: Integrals in Action

13.3 A Stochastic Production Planning Model

The Black-Scholes Model

Problem Set 4 Answers

Homework Set 6 Solutions

From Discrete Time to Continuous Time Modeling

Problem Set #2. Intermediate Macroeconomics 101 Due 20/8/12

INTERTEMPORAL ASSET ALLOCATION: THEORY

Assicurazioni Generali: An Option Pricing Case with NAGARCH

FINANCIAL OPTION ANALYSIS HANDOUTS

STOCHASTIC CALCULUS AND BLACK-SCHOLES MODEL

The Use of Importance Sampling to Speed Up Stochastic Volatility Simulations

Two Types of Options

Introduction to Financial Mathematics

Part 1: q Theory and Irreversible Investment

Microeconomic Theory August 2013 Applied Economics. Ph.D. PRELIMINARY EXAMINATION MICROECONOMIC THEORY. Applied Economics Graduate Program

Lecture 3: Return vs Risk: Mean-Variance Analysis

1 The Solow Growth Model

SDP Macroeconomics Final exam, 2014 Professor Ricardo Reis

Hedging Credit Derivatives in Intensity Based Models

THE OPTIMAL ASSET ALLOCATION PROBLEMFOR AN INVESTOR THROUGH UTILITY MAXIMIZATION

Microeconomic Theory May 2013 Applied Economics. Ph.D. PRELIMINARY EXAMINATION MICROECONOMIC THEORY. Applied Economics Graduate Program.

A Brief Introduction to Stochastic Volatility Modeling

Handout 4: Deterministic Systems and the Shortest Path Problem

ECE 586GT: Problem Set 1: Problems and Solutions Analysis of static games

Lecture 2: Stochastic Discount Factor

The Theory of Interest

Stochastic Volatility (Working Draft I)

LECTURE NOTES 3 ARIEL M. VIALE

Introducing nominal rigidities. A static model.

Using Monte Carlo Integration and Control Variates to Estimate π

LECTURE 2: MULTIPERIOD MODELS AND TREES

INTRODUCTION TO ARBITRAGE PRICING OF FINANCIAL DERIVATIVES

Economi Capital. Tiziano Bellini. Università di Bologna. November 29, 2013

Hull, Options, Futures, and Other Derivatives, 9 th Edition

Confidence Intervals for the Difference Between Two Means with Tolerance Probability

Optimization Models in Financial Mathematics

Stock Loan Valuation Under Brownian-Motion Based and Markov Chain Stock Models

Optimal Investment with Deferred Capital Gains Taxes

Economics 101. Lecture 3 - Consumer Demand

14.02 Solutions Quiz III Spring 03

The Binomial Lattice Model for Stocks: Introduction to Option Pricing

MASM006 UNIVERSITY OF EXETER SCHOOL OF ENGINEERING, COMPUTER SCIENCE AND MATHEMATICS MATHEMATICAL SCIENCES FINANCIAL MATHEMATICS.

Solving the Black-Scholes Equation

Math489/889 Stochastic Processes and Advanced Mathematical Finance Solutions to Practice Problems

Pricing Implied Volatility

Transcription:

Final Projects Introduction to Numerical Analysis http://www.math.ucsb.edu/ atzberg/fall2006/index.html Professor: Paul J. Atzberger Instructions: In the final project you will apply the numerical methods developed in the class to a problem in finance or physics and engineering. For your assigned project you are to write a report which answers each of the stated questions. For the numerical solutions, you are to give the numerical results in the form of an appropriate table or list. All codes should be written in Matlab/Octave using the algorithms discussed in class. Project 1: (Black-Scholes-Merton Option Pricing) When making investments in an asset in the marketplace (such as a stock) there are typically substantial risks in the future value of the asset. To facilitate management of these risks, banks sell contracts to protect investors against either large increases or large decreases in the value of an asset. A common class of contracts used for this purpose are referred to as options. For example, to manage price changes of a stock a European Put Option is a contract which gives the holder the right to sell at a specified price K (called the strike price) a given number of units of the stock at a specific time in the future T (called the maturity time). Similarly, a European Call Option gives the holder the right to buy at a specified price K at a specific time T in the future. An important problem for banks who buy and sell such contracts is to determine a reasonable price for the contracts. Given the nature of the contracts, the price charged by a bank must somehow reflect the current value of the asset in the marketplace while at the same time reflecting the future liabilities the bank assumes by issuing the contract. This is in general a challenging problem given all of the uncertainties in the future behavior of the marketplace. However, when certain assumptions are made about the marketplace such a price can be determined. A well-known approach used in practice is the Black-Scholes- Merton Option Pricing Theory, see Options, Futures, and Other Derivatives by J. Hull, if you are interested in more details. From the Black-Scholes-Merton Option Pricing Theory the price of a European call option (c) and put option (p) are given by: c(s 0,K,T) = s 0 N(d 1 ) Ke rt N(d 2 ) p(s 0,K,T) = Ke rt N( d 2 ) s 0 N( d 1 ) where s 0 is the current price of the stock (spot price), K is the agreed upon selling price (strike price), and T is the time at which the contract may be executed (maturity time). We also have d 1 = d 2 = 1 σ T 1 σ T ( log ( log ( ) s0 K ) ( s0 K + (r + 1 ) 2 σ2 )T + (r 1 ) 2 σ2 )T where r is the current compounding interest rate and σ 2 is a parameter characterizing how much prices are expected to fluctuate in the marketplace (volatility). In the notation N

denotes the cumulative normal distribution function: N(d) = 1 2π d e y2 2 dy. We also remark that d 2 = d 1 σ T. In order to use this formula in practice the expressions above must be numerically evaluated. In this project you will develop Matlab/Octave codes for the algorithms discussed in class to price various call and put options. (a) Implement a Matlab/Octave code for a function called cumulativenormal which takes d as input. The function should use the methods discussed in class for approximating integrals. To approximate the y 1 = term use at least y 1 10 in the range of the integral. What value of the grid spacing h ensures the integral is evaluated to 3 significant digits when d = 0? Note that for d = 0 the exact value is 1/2. (b) Suppose the current price of Microsoft stock is $110 today, compute the price of a put option which gives a holder the right to sell the stock 100 days from today for $109. Assume that the current compounding interest rate r = 0.05/365 and the market volatility is σ 2 = 0.2/365. Note that this means s 0 = 110,K = 109,T = 100. (c) Make a plot of the the price of the put option in part (b) as the strike price K is varied from 80 to 160. Give a labeled plot of p vs. K. Discuss what happens to the price of the put option as the strike price is decreased? Can you explain intuitively why this is expected to happen? (d) Suppose the current price of Apple stock is $110 today, compute the price of a call option which gives a holder the right to buy the stock 100 days from today for $109. Assume that the current compounding interest rate r = 0.05/365 and the market volatility is σ 2 = 0.2/365. (Note: s 0 = 110,K = 109,T = 100) (e) Make a plot of the the price of the call option in part (b) as the strike price K is varied from 80 to 160. Give a labeled plot of c vs K. Discuss what happens to the price of the call option as the strike price is decreased? Can you explain intuitively why this happens? (f) Suppose an investor goes long (buys) a call option and goes short (sells) a put option. Using your data from part (c) and (e) make a plot of c p vs K (now assuming they are for the same underlying stock). The price of a forward contract, in which two parties agree to a selling price of an asset at some future time T is given by f(s 0,K,T) = s 0 e rt K. Add to your plot of the portfolio c p a plot of the price of the forward contract. How do they compare? Can you explain why? The strike price at which the forward contract is worth 0 is call the fair price of the contract. At this strike price neither party makes a net financial gain by entering into the contract. For what value of K does the forward become worth zero for the contract with the parameters above? We remark that this relationship between the forwards and the portfolio of the European call and put options is called put-call parity.

Project 2: (Markowitz Portfolio Theory) When making investments in the marketplace a trade-off usually needs to be made between the expected return (payoff) of an asset and the riskiness in obtaining that return or a loss. The central tenet of Markowitz Portfolio Theory is that if two investment opportunities have the same expected return, then the one which is less risky is more desirable to investors. When faced with the opportunity to invest in many different assets an interesting problem arises in how to choose an optimal portfolio, which attempts to maximize the investment return while minimizing risks. In this project you will explore one model of investments which attempts to capture these trade-offs and use this model to construct optimal portfolios for a collection of assets. In the notation we shall denote the expected return of the i th asset by µ i and the riskiness of the asset by σ 2 i, the variance. (a) Consider two assets with expected returns µ 1, µ 2, variance σ 2 1, σ 2 2, and covariance σ 1,2. From Markowitz Portfolio Theory a portfolio which invests a fraction w 1 of an investors wealth in asset 1 and a fraction w 2 in asset 2 has the expected return: and variance µ p = w 1 µ 1 + w 2 µ 2 (1) σ 2 p = w 2 1σ 2 1 + 2w 1 w 2 σ 1,2 + w 2 2σ 2 2. (2) Now let us suppose an investor wishes to invest w = $100, 000 in the assets to attain a return µ p = 0.08. We can express the weights as w 1 = (1 α), w 2 = α. Let the assets have µ 1 = 0.03, µ 2 = 0.09, σ 1 = 0.2, σ 2 = 0.4, σ 1,2 = 0.02. Write a Matlab/Octave code which implements both a Bisection Method and a Newton Method to find the value of α which makes µ p = 0.08 in equation 1. This is easily solved analytically, so check your code returns the correct result. What are the weights w 1,w 2? What is the variance σ 2 p of the portfolio with return 0.08? Using that the fluctuations in the future value of the investment is modeled by the range V 1 (T) = we µpt σp T and V 2 (T) = we µpt+σp T. What is the range [V 1,V 2 ] of typical fluctuations at time T = 1 for the investment of w = $100, 000 made above? Would you make this investment? Why? (Make a comparison with the returns you may get from this investment µ p T ± σ p T and what you would get from putting your money in a bank account paying a continuous compounding interest rate of r = 4%. Is the return worth the risk?) (b) Suppose the investor wants most to reduce the riskiness of the investment made in the two assets. Use your code to determine the optimal value of α which minimizes the variance of the portfolio for any return. This is equivalent of finding a zero of the function λ 1 (α) = σ2 p α = 2 ( ) w 1 σ1 2 + (w 1 w 2 )σ 1,2 + w 2 σ2 2. (3) This can again be solved analytically, so check your code gives the correct result for α. What are the weights w 1,w 2? What is the return µ p of this optimal portfolio? What is the range of typical fluctuations [V 1,V 2 ]? Would you make this investment? Why?

(c) We shall now consider certain assets (such as a factory) which has an economy of scale so that the expected return may in fact increase as more resources are invested in the asset. Let us consider assets with returns µ 1 (w 1 ) = 0.0005e 3w 1 µ 2 (w 2 ) = 0.07 and variances σ 2 1(w 1 ) = e 3w 1 σ 2 2(w 2 ) = 0.4. The portfolio then has µ p = w 1 µ 1 (w 1 ) + w 2 µ 2 (w 2 ) σp 2 = w1σ 2 1(w 2 1 ) + 2w 1 w 2 σ 1,2 (w 1,w 2 ) + w2σ 2 2(w 2 2 ). Let the assets have σ 1,2 = 0.01. Use that w 1 = (1 α) and w 2 = α and your Matlab/Octave code to find the α which for a w = $1, 000, 000 investment gives a portfolio with expected return µ p = 0.05. Allow α to vary in the range [ 1, 1], where negative weights correspond to going short on an asset. What are the weights w 1,w 2? What is the variance σ 2 p of this portfolio? What is the range of typical fluctuations [V 1,V 2 ]? Would you make this investment? Why? (d) Suppose that an investor wishes to invest w = $1, 000, 000 in the least risky portfolio comprised of the two assets. Find the value of α which gives this portfolio. Allow α to vary in the range [ 1, 1], where negative weights correspond to going short on an asset. Use your Matlab/Octave code to find the zero of the derivative of the variance σ 2 p of part (c), which in this case is given by: σ 2 p α = λ 1(α) + 3w 2 1σ 2 1. What are the weights w 1,w 2? What is the expected return of this portfolio µ p? What is the range of typical fluctuations [V 1,V 2 ]? Would you make this investment? Why? Project 3: (Operations Project) Consider two firms competing over a common pool of customers. Let the number of customers who subscribe to firm A s services be denoted by x and those subscribing to firm B s services by y. Suppose each month the firms can adjust their advertising and other incentives to attract more customers. In this project you will develop a fixed point iteration code to compute the number of customers each firm attracts. We shall model how the customer subscriptions change each month by: x n+1 = φ 1 (x n,y n ) (4) y n+1 = φ 2 (x n,y n ). (5)

(a) Write a function fixedpoint in Matlab/Octave which for a given function g(x) and threshold ǫ computes x n+1 = g(x n ). The function should give as output x = x n+1 when iterates satisfy the threshold x n+1 x n / x n < ǫ. Use your code to find the fixed point of g(x) = πe x x to 3 significant digits. Since this can be solved analytically x = log(π) check your code gives the correct result. Give the last 5 iterates in a table and specify the initial value x 0 which was used. (b) Let us suppose that the two firms copy the others advertising and incentive campaigns each month. Let the change in customers be modeled by: φ 1 (x,y) = 7e 2x y x (6) φ 2 (x,y) = 7e 2y x y. (7) Modify your fixed point iteration code from part (a) to compute x n+1 and y n+1 in equation 4 and 5 until the fixed point criteria holds. Now consider the case where firm A initially has more customers x 0 = 0.7 than firm B which has y 0 = 0.3. Starting from these values, what is the equilibrium number of customers x, y each firm has? Make a plot of φ 1 vs x, for y. Similarly, make a plot of φ 2 vs y, for x. Give an explanation in terms of what happens to the number of customers firm A attracts for points x when near the fixed point x? (In particular, does the sequence return monotonically or by oscillating?) What happens on the next iteration if x n exceeds x? What happens on the next iteration if x n is less than x? (c) Let us suppose that the firms strictly compete for the same customers, so any customer gained by firm A is lost by firm B. If there are M total customers then x n + y n = M must hold at all times. Suppose firm A is able to use the same strategy as in part (b), then since y = M x we have: φ(x) = 7e x M x. Modify your fixed point iteration code from part (a) to compute x n+1 using this φ until the fixed point criteria holds, when M = 1 (units thousands of customers). What are the equilibrium values of x, y = M x? Make a plot of φ vs x. Can you give an explanation in terms of what happens to number of customers firm A attracts for points x near the fixed point? (Does it return monotonically or by oscillating?) (d) Let us suppose that the firms merge with the agreement that customers will be shared equally among the two firms each month. This gives for the strategies φ 1 (x,y) = 7e 2x y x φ 2 (x,y) = 7e 2y x y the modified result each month φ 1 (x n,y n ) = φ 1 ((x n + y n )/2, (x n + y n )/2), and φ 2 (x n,y n ) = φ 2 ((x n + y n )/2, (x n + y n )/2) for each iteration. Modify your fixed point iteration code to compute x n+1,y n+1 using this φ 1, φ 2 until the fixed point criteria holds. What are the equilibrium values of x, y? Make a plot of φ 1 vs x, for fixed y. Give an explanation in terms of what happens to number of customers firm A attracts for points x near the fixed point in

this case. (Does it return monotonically or by oscillating?)

Project 4: (Physics and Engineering) Suppose that you are faced with the task of planning a highway through a mountainous landscape. Given that the highway will be used repeatedly for many decades by cars and trucks, designing the highway so that vehicles make efficient use of fuel when traveling on the roadway could have major economic consequences. In this project you will consider a model for the vehicle fuel consumption and use numerical methods to determine a good plan for the highway. In order to model the mountainous landscape consider a function in two variables f(x,y) which gives the elevation of the land above sea level. The path taken by the highway will be represented by the parameterized curve given by x = γ 1 (s) and y = γ 2 (s), which for brevity will be notated by γ(s) = [γ 1 (s),γ 2 (s)] T. One rough measure of the relative fuel consumption required for different roadways between the same two points is to consider the average height of the landscape along the road: E[γ] = 1 L L 0 f(γ(s))ds where L is the arc length of the curve γ. Finding the optimal roadway requires minimizing over arbitrary paths γ(s), which in general is a challenging problem. In this project you will explore one approach to constructing approximate solutions to this problem. (a) Write a function in Matlab/Octave called arclengthp ath which for a given collection of ordered points (x 0,y 0 ),, (x N,y N ) gives the arc length computed by piecewise linear interpolation of the points. (b) Write a function in Matlab/Octave called interppath which interpolates a given collection of ordered points (x 0,y 0 ),, (x N,y N ) using a natural cubic spline. For the given arc length s use the method to compute a point (x(s),y(s)) having approximate arc length s along the curve. (Hint: For each point (x j,y j ) use the arc length s j from part (a) and interpolate separately the data for x(s) given by {(s j,x j )} and the data for y(s) given by {(s j,y j )}.) (c) Write a function in Matlab/Octave called updatep oint which takes as input a parameter h and for a given point (x,y) computes f = [ f, f x y ]T and gives the new point (x h f x,y h f ) as output. y (d) To find an approximately optimal route for the highway connecting (x 0,y 0 ) and (x N,y N ) let us first consider an initial path obtained by linear interpolation (x j,y j ) = (1 α j )(x 0,y 0 )+ α j (x N,y N ), where α j = j/n. We shall iteratively attempt to find successively better routes by using the following strategy: (i) Move each of the points with indices j = 1,,N 1 downward on the landscape. (ii) Redistribute the points on the path to be the same arc length distance apart with neighbors to avoid clustering, then repeat (i)

The first step (i) can be accomplished by calling updatepoint on each of the points (x j,y j ) in the range j = 1,,N 1. The second step (ii) can be accomplished by calling arclengthpath and then calling interppath for each arc length s j = jl/n with j = 1,,N 1 to obtain the new (x j,y j ). While this iteration scheme will not strictly give the optimal paths of E, it is expected to give decent results for the roadways. Obtaining better results would require a more sophisticated choice for the descent routine (updatepoint). Write a Matlab/Octave code to carry out this strategy. Use this code for the initial path given by linear interpolation between (x 0,y 0 ) = (0.5, 0) and (x N,y N ) = (0.5, 1) with N at least 10 when the landscape is given by f(x,y) = 1 r(r 1) 2, where r = (x 0.52) 2 + (y 0.51) 2. Run your code until successive iterates appear to change very little between iterations, say by no more than 10 1. What values for the measure of efficiency E does the initial route and the one you found give? By what factor is E improved? Give a plot of the landscape f(x,y) and the route γ(s) you obtained. (Hint: Use Matlab/Octave surf(), mesh(), plot(), holdon, commands). (e) Using your code from part (d) find the optimal route from (x 0,y 0 ) = (0, 0) to (x N,y N ) = (1, 1) for the the landscape f(x,y) = 3(cos 2 (2πkx) sin 2 (2πky) + 1), (k = 2). Give a plot of the landscape f(x,y) and the route γ(s) you obtain.