Description Usage Arguments Author(s) References Examples
Calculates the partial first derivative of any dependent vector to any independent vector. Returns a Vector
1 |
j |
|
Y |
|
X |
Rafael Ventura
Klaus A Hoffmann & Steve T Chiang. Computational Fluid Dynamics Vol 1. Wichita, Kan: Engineering Eductation System, 2000. Junsei Kondo and Nobuko Saigusa. Modelling the Evaporation from Base Soil with a Formula for Vaporization in the Soil Pores. Meteorological Society of Japan.
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 | ##---- 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 (j = 4, Y = matrix(rep(0, 4), nrow = 4, ncol = 1), X = matrix(rep(0,
4), nrow = 4, ncol = 1))
{
nrow <- dim(X)[[1]]
jminus1 <- if (j > 1) {
j - 1
}
else {
1
}
paddingj <- matrix(rep(0, nrow - j), nrow = nrow - j, ncol = 1)
paddingjminus1 <- matrix(rep(0, nrow - jminus1), nrow = nrow -
jminus1, ncol = 1)
xj <- rbind(paddingj, X[1:j, , drop = FALSE])
xjminus1 <- rbind(paddingjminus1, X[1:xminus1, , drop = FALSE])
yj <- rbind(paddingj, Y[1:j, , drop = FALSE])
yjminus1 <- rbind(paddingjminus1, X[1:xminus1, , drop = FALSE])
dxj <- xj - xjminus1
dydx <- mapply(function(x, y) x/y, yj - yjminus1, dxj)
return(dydx)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.