1 |
n |
|
s |
|
t |
|
x |
|
y |
|
L |
|
U |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (n, s, t, x, y, L, U)
{
if (max(x - U, y - U, L - x, L - y) >= 0) {
1
}
else {
j <- 1:(ceiling(n/2))
P <- -2/(t - s)
D <- U - L
D1 <- D * j + L
D2 <- D * j - U
z <- y - x
if (even(n)) {
sum(exp(P * (D1 - x) * (D1 - y)) + exp(P * (D2 +
x) * (D2 + y)) - exp(P * j^2 * D^2 - P * j *
D * z) - exp(P * j^2 * D^2 + P * j * D * z))
}
else {
sum(exp(P * (D1 - x) * (D1 - y)) + exp(P * (D2 +
x) * (D2 + y))) - sum(exp(P * j[1:length(j) -
1]^2 * D^2 - P * j[1:length(j) - 1] * D * z) +
exp(P * j[1:length(j) - 1]^2 * D^2 + P * j[1:length(j) -
1] * D * z))
}
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.