Tinker9
70bd052 (Thu Nov 9 12:11:35 2023 -0800)
Loading...
Searching...
No Matches
include
math
ou.h
1
#pragma once
2
#include <cmath>
3
4
namespace
tinker
{
19
inline
double
OUProcess
(
double
t,
double
x0,
double
gamma,
double
a,
double
b,
20
double
R)
21
{
22
if
(gamma == 0) {
23
return
x0 + a * t + b * R * std::sqrt(t);
24
}
else
{
25
auto
gt = -gamma * t;
26
auto
egt = std::exp(gt);
27
auto
c1 = (1 - egt) / gamma;
28
auto
c2 = (1 - egt * egt) / (2 * gamma);
29
return
x0 * egt + a * c1 + b * R * std::sqrt(c2);
30
}
31
}
32
}
tinker::OUProcess
double OUProcess(double t, double x0, double gamma, double a, double b, double R)
Returns the value of an Ornstein-Uhlenbeck process after time t.
Definition:
ou.h:19
tinker
Definition:
testrt.h:9
Generated by
1.9.5