logo

Article | Monte Carlo Simulation

   

Added on  2022-08-10

26 Pages2362 Words12 Views
Monte Carlo Simulation
Problem .1
Monte Carlo simulation is a mathematical method that is used to
measure and account for risk when making decisions.
This is a probability structure that determines the outcomes of events in a
particular event. Hence future values of uncertainty can be predicted.
It is a tool that can be used to solve problems in different fields such as
supply chain
finance, engineering, and health
Integration procedure:
You start by defining the function of integration.
Identify the integrand and the limits of integration.
Find the integral value of the function.
The Theoretical Solution.
=
0
1
4
1x2dx=4
0

2
1sin 4 ucos(u)cos(u) du
=
0

2
cos 4 ( u ) du
=4*( u
2 + 2u
4 )|/20
=(

2 )
The Coded Solution:
>> ##define the integrated function
> integrand<-function(x) {(4*(1-x^2)^1/2)}
> ##integrate the function from 0 to 1

> integrate(integrand,lower=0,upper=1)
1.333333 with absolute error < 1.5e-14
Problem 2.
The cumulative distribution is plotted against the the upper class limit
values of the the distribution.Each subsequent and previous frequencies are
added to obtain cumulative frequencies
(2a)
Estimation of the integral of f(x)=
{4 x 0 x 1
2
4 1
2 x 1
Diagrams of Plots of density and CDF
> x<-log(rgamma(100,10))
> df<-approxfun(density(4*x))
> plot(density(4*x))
>

xx
> x<-log(rgamma(100,10))
> df<-approxfun(density(4-4*x))
> plot(density(4-4*x))
>

> n=1000
> x1=runif(n,lower=0,upper=1)
> y1=runif(n,lower=0,upper=1)
> f1<-4*x
ii)CDF Plots

> x=rnorm(1000)
> P=ecdf(4*x)
> P(0.01)
[1] 0.513
> plot(P)
>
X is a sample of 1000 which is normally distributed random variables

P is a function giving the empirical CDF of X
P(0.01) takes back the empirical CDF to zero.P value should be close to 0.
> x=rnorm(1000)
> P=ecdf(4-4*x)
> P(0.01)
[1] 0.157
> plot(P)
>

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Applied Engineering Statistics | Questions-Answers
|33
|3277
|30

MATLAB Interpolation Techniques
|56
|6920
|97

Univariate Analysis II Regression
|28
|5189
|25

Statistics 630 Assignment 3: Chapter 2 Problems and Solutions
|8
|835
|445

Stock Price Simulation and Option Pricing
|7
|1286
|142

Linear Regression and Correlation Analysis Assignment
|13
|1372
|109