public JarrowRudd(StochasticProcess1D process, double end, int steps, double strike) : base(process, end, steps) { // drift removed up_ = process.stdDeviation(0.0, x0_, dt_); }
public TrinomialTree(StochasticProcess1D process, TimeGrid timeGrid) : this(process, timeGrid, false) { }
public EqualJumpsBinomialTree(StochasticProcess1D process, double end, int steps) : base(process, end, steps) { }
/*! Returns an approximation of the variance defined as * \f$ \sigma(t_0, x_0)^2 \Delta t \f$. */ public double variance(StochasticProcess1D process, double t0, double x0, double dt) { double sigma = process.diffusion(t0, x0); return(sigma * sigma * dt); }
public ShortRateDynamics(StochasticProcess1D process) { process_ = process; }
public AdditiveEQPBinomialTree(StochasticProcess1D process, double end, int steps, double strike) : base(process, end, steps) { up_ = -0.5 * driftPerStep_ + 0.5 * Math.Sqrt(4.0 * process.variance(0.0, x0_, dt_) - 3.0 * driftPerStep_ * driftPerStep_); }
public Trigeorgis factory(StochasticProcess1D process, double end, int steps, double strike) { return(new Trigeorgis(process, end, steps, strike)); }
/*! Returns an approximation of the drift defined as \f$ \mu(t_0, x_0) \Delta t \f$. */ public double drift(StochasticProcess1D process, double t0, double x0, double dt) { return process.drift(t0, x0)*dt; }
/*! Returns an approximation of the variance defined as \f$ \sigma(t_0, x_0)^2 \Delta t \f$. */ public double variance(StochasticProcess1D process, double t0, double x0, double dt) { double sigma = process.diffusion(t0, x0); return sigma*sigma*dt; }
protected ShortRateDynamics(StochasticProcess1D process) { process_ = process; }
/*! Returns an approximation of the diffusion defined as \f$ \sigma(t_0, x_0) \sqrt{\Delta t} \f$. */ public double diffusion(StochasticProcess1D process, double t0, double x0, double dt) { return process.diffusion(t0, x0) * Math.Sqrt(dt); }
public Joshi4 factory(StochasticProcess1D process, double end, int steps, double strike) { return(new Joshi4(process, end, steps, strike)); }
public LeisenReimer factory(StochasticProcess1D process, double end, int steps, double strike) { return(new LeisenReimer(process, end, steps, strike)); }
public Tian factory(StochasticProcess1D process, double end, int steps, double strike) { return(new Tian(process, end, steps, strike)); }
public JarrowRudd factory(StochasticProcess1D process, double end, int steps, double strike) { return(new JarrowRudd(process, end, steps, strike)); }
/*! Returns an approximation of the drift defined as * \f$ \mu(t_0, x_0) \Delta t \f$. */ public double drift(StochasticProcess1D process, double t0, double x0, double dt) { return(process.drift(t0, x0) * dt); }
public CoxRossRubinstein factory(StochasticProcess1D process, double end, int steps, double strike) { return(new CoxRossRubinstein(process, end, steps, strike)); }
/*! Returns an approximation of the diffusion defined as * \f$ \sigma(t_0, x_0) \sqrt{\Delta t} \f$. */ public double diffusion(StochasticProcess1D process, double t0, double x0, double dt) { return(process.diffusion(t0, x0) * Math.Sqrt(dt)); }
public void testSingle(StochasticProcess1D process, string tag, bool brownianBridge, double expected, double antithetic) { ulong seed = 42; double length = 10; int timeSteps = 12; var rsg = (InverseCumulativeRsg<RandomSequenceGenerator<MersenneTwisterUniformRng> ,InverseCumulativeNormal>) new PseudoRandom().make_sequence_generator(timeSteps, seed); PathGenerator<IRNG> generator = new PathGenerator<IRNG>(process, length, timeSteps, rsg, brownianBridge); int i; for (i=0; i<100; i++) generator.next(); Sample<Path> sample = generator.next(); double calculated = sample.value.back(); double error = Math.Abs(calculated-expected); double tolerance = 2.0e-8; if (error > tolerance) { Assert.Fail("using " + tag + " process " + (brownianBridge ? "with " : "without ") + "brownian bridge:\n" //+ std::setprecision(13) + " calculated: " + calculated + "\n" + " expected: " + expected + "\n" + " error: " + error + "\n" + " tolerance: " + tolerance); } sample = generator.antithetic(); calculated = sample.value.back(); error = Math.Abs(calculated-antithetic); tolerance = 2.0e-7; if (error > tolerance) { Assert.Fail("using " + tag + " process " + (brownianBridge ? "with " : "without ") + "brownian bridge:\n" + "antithetic sample:\n" //+ setprecision(13) + " calculated: " + calculated + "\n" + " expected: " + antithetic + "\n" + " error: " + error + "\n" + " tolerance: " + tolerance); } }
public AdditiveEQPBinomialTree factory(StochasticProcess1D process, double end, int steps, double strike) { return(new AdditiveEQPBinomialTree(process, end, steps, strike)); }