0% found this document useful (0 votes)
20 views6 pages

Assignment 3 Surya Elements of Computing

Uploaded by

amritasurya22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views6 pages

Assignment 3 Surya Elements of Computing

Uploaded by

amritasurya22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

22MAT110

MATHEMATICS FOR COMPUTING 1

Assignment – III(MATLAB)

I Semester
I Year ,AIE
Amrita school of Computing, Chennai

Name : - K.K.SURYESH
Roll no :- Ch.sc.u4aie24036
Case Study 1: Monte Carlo Simulation of European Call Option Pricing
Design a Monte Carlo simulation to price a European call option using the following parameters:

Initial stock price (S₀): $100

Strike price (K): $100

Risk-free interest rate (r): 5%

Volatility (σ): 20%

Time to maturity (T): 1 year

Requirements:
1. Implement a Monte Carlo simulation with at least 10,000 iterations

2. Use the Geometric Brownian Motion model for stock price simulation

3. Calculate the option price using risk-neutral valuation 4. Compute and report:

o Option price

o Standard error

o 95% confidence interval

MATLAB CODE :-
% Case Study 1: Monte Carlo Simulation for European Call Option Pricing
% Parameters
S0 = 100; % Initial stock price
K = 100; % Strike price
r = 0.05; % Risk-free interest rate
sigma = 0.2; % Volatility
T = 1; % Time to maturity
N = 10000; % Number of simulations
dt = T; % Time step
% Monte Carlo Simulation
% Geometric Brownian Motion Stock Price Path Simulation
rng(123); % Set random seed for reproducibility
% Simulate stock price paths
Z = randn(N, 1);
ST = S0 * exp((r - 0.5 * sigma^2) * T + sigma * sqrt(T) * Z);
% Option Payoff Calculation
payoff = max(ST - K, 0);
% Option Price Calculation
option_price = exp(-r * T) * mean(payoff);
% Standard Error Calculation
std_error = std(payoff * exp(-r * T)) / sqrt(N);
% Display Results
fprintf('European Call Option Price: $%.2f\n', option_price);
fprintf('Standard Error: $%.4f\n', std_error);
fprintf('95%% Confidence Interval: [%.2f, %.2f]\n', ...
option_price - 1.96*std_error, option_price + 1.96*std_error);
Assignment 2: Monte Carlo Simulation of Project Investment Risk
Develop a Monte Carlo simulation to assess the financial risk of a 5-year investment project with
the following characteristics:

Initial investment: $100,000

Discount rate: 10%

Revenue and Cost Distributions (Triangular Distribution):

Revenue Range: o Minimum: $50,000

Most Likely: $85,000

Maximum: $120,000

Cost Range:

Minimum: $40,000

Most Likely: $60,000

Maximum: $90,000

MATLAB CODE :-
% Case Study 2: Monte Carlo Simulation for Project Investment Risk Assessment
% Parameters
initial_investment = 100000; % Initial project cost
years = 5; % Project duration
num_simulations = 10000; % Number of Monte Carlo simulations
% Probabilistic Input Parameters (Triangular Distribution)
% Revenue Parameters
min_revenue = 50000;
most_likely_revenue = 85000;
max_revenue = 120000;
% Cost Parameters
min_cost = 40000;
most_likely_cost = 60000;
max_cost = 90000;
% Random Seed
rng(456);
% Monte Carlo Simulation
results = zeros(num_simulations, 1);
for i = 1:num_simulations
% Generate random revenues and costs using triangular distribution
revenue = trirnd(min_revenue, most_likely_revenue, max_revenue);
cost = trirnd(min_cost, most_likely_cost, max_cost);
% Calculate Net Present Value (NPV)
annual_cashflow = revenue - cost;
npv = -initial_investment;
% Assume 10% discount rate
for j = 1:years
npv = npv + annual_cashflow / (1 + 0.1)^j;
end
results(i) = npv;
end
% Analysis of Simulation Results
mean_npv = mean(results);
std_npv = std(results);
prob_positive_npv = sum(results > 0) / num_simulations * 100;
% Percentile Calculations
npv_5th_percentile = prctile(results, 5);
npv_95th_percentile = prctile(results, 95);
% Display Results
fprintf('Investment NPV Analysis:\n');
fprintf('Mean NPV: $%.2f\n', mean_npv);
fprintf('NPV Standard Deviation: $%.2f\n', std_npv);
fprintf('Probability of Positive NPV: %.2f%%\n', prob_positive_npv);
fprintf('5th Percentile NPV: $%.2f\n', npv_5th_percentile);
fprintf('95th Percentile NPV: $%.2f\n', npv_95th_percentile);
% Helper function for triangular distribution random number generation
function r = trirnd(a, b, c)
% a: minimum, b: mode, c: maximum
u = rand();
fc = (b - a) / (c - a);
if u < fc
r = a + sqrt(u * (b - a) * (c - a));
else
r = c - sqrt((1 - u) * (c - b) * (c - a));
end
end

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy