3import umontreal.ssj.rng.*;
5import java.io.IOException;
7import umontreal.ssj.probdist.NormalDist;
8import umontreal.ssj.mcqmctools.*;
9import umontreal.ssj.stat.Tally;
10import umontreal.ssj.util.*;
18 double[] sigmaSqrtDelta;
22 public AsianGBM2(
double r,
double sigma,
double strike,
double s0,
int s,
double[] zeta) {
25 discount = Math.exp(-r * zeta[s]);
26 double mu = r - 0.5 * sigma * sigma;
27 muDelta =
new double[s];
28 sigmaSqrtDelta =
new double[s];
29 logS =
new double[s + 1];
31 for (
int j = 0; j < s; j++) {
32 delta = zeta[j + 1] - zeta[j];
33 muDelta[j] = mu * delta;
34 sigmaSqrtDelta[j] = sigma * Math.sqrt(delta);
36 logS[0] = Math.log(s0);
41 for (
int j = 0; j < s; j++)
48 for (
int j = 1; j <= s; j++)
49 average += Math.exp(logS[j]);
52 return discount * (average - strike);
57 public int getDimension() {
62 return "Asian option under GBM, for testing";
69 public static void main(String args[])
throws IOException {
71 double[] zeta =
new double[s + 1];
73 for (
int j = 1; j <= s; j++)
74 zeta[j] = (
double) j / (double) s;
76 Tally statValue =
new Tally(
"Stats on value of Asian option");
81 System.out.println(statValue.
report(0.95, 3));
82 System.out.println(
"Total CPU time: " + timer.
format() +
"\n");
String getTag()
Returns a short model name (tag) to be used in reports.
double getPerformance()
Recovers and returns the realization of the performance measure, of type double.
void simulate(RandomStream stream)
Simulates the model for one run.
String toString()
Returns a description of the model and its parameters.
Extends the class ContinuousDistribution for the normal distribution (e.g., tjoh95a (page 80)).
static double inverseF01(double u)
Same as inverseF(0, 1, u).
Extends RandomStreamBase using a composite linear feedback shift register (LFSR) (or Tausworthe) RNG ...
void setConfidenceIntervalStudent()
Indicates that a confidence interval on the true mean, based on the normality assumption,...
String report()
Returns a formatted string that contains a report on this probe.
String format()
Converts the CPU time used by the program since its last call to init for this AbstractChrono to a St...
The Chrono class extends the umontreal.ssj.util.AbstractChrono class and computes the CPU time for th...
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...
double nextDouble()
Returns a (pseudo)random number from the uniform distribution over the interval , using this stream,...