## Transcribed Text

Mathematics of Finance
Background
The script MonteCarlo2.m on Blackboard generates 10,000 year long daily price paths for a stock with initial price
$100, expected annual return r = 10% (=0.1) and annual volatility a = 30% The matrix C of size 10,000 x 252 stores
all those pasths in its rows. The script then calculates an approximation to E(In(ST)) where ST is the final price of
the stock. It does so by simply taking the mean of the last column of C:
LogLastPrice = og(C(i, 252));
C(:, 252) is the 252nd column; ":" stands for "any row"
The Task
Use the above script as a template (if you're not working with Matlab) or modify its code to
1.
Generate 100 (idenally 10,000 or more) 3 month long price paths for a stock with initial price $50, expected annual
return r = 10% (=0.1) and annual volatility (T = 30% Assume that there are 21 trading days in a month.
2. Suppose that you want to sell a put option on the stock in part 1 with the strike price K = $50 and expiration
date in 3 months. You need to find how much to charge your customers for the option. You could proceed in
two stepes
Find the expected payoff of the put option
where ST is the stock's price in 3 months (i.e., in 63 days). You would use here the same method Monte-
Carlo2.m uses to find E(In(ST)].
Finde the price by discounting the expected payoff obtained above to the present, i.e., with the factorÂ¹
c-r(T-2).
In order to make the obtained price robust, run your script several times and take the average of the results.
How much would you charge for the option?

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

% 1. Generate 100 (ideally 10,000 or more) 3 month long price paths for a stock with initial price $50, expected annual

% return r = 10% (=0.1) and annual volatility = 30%. Assume that there are 21 trading days in a month.

% Clearing memory and screen

clear;

clc;

s=50; %Stock's price now

mu=0.1; %Annual return rate

dt=1/252; %Time increment in years

sigma=0.3; %Annual volatility (risk)

C=[]; %The matrix in which each row will hold a price path

%We are creating 20000 3 month long price paths

for q=1:20000

M=[];...