R/rm_numdiff_discrete_differences.R

Defines functions rm_numdiff_discrete_differences

## File Name: rm_numdiff_discrete_differences.R
## File Version: 0.08

rm_numdiff_discrete_differences <- function(ll0, ll1, ll2, h)
{
    # first derivative
    # f(x+h)-f(x-h)=2*f'(x)*h
    d1 <- ( ll1 - ll2  ) / ( 2 * h )
    # second order derivative
    # f(x+h)+f(x-h)=2*f(x) + f''(x)*h^2
    d2 <- ( ll1 + ll2 - 2*ll0 ) / h^2
    #--- output
    res <- list(d1=d1, d2=d2)
    return(res)
}

Try the sirt package in your browser

Any scripts or data that you put into this service are public.

sirt documentation built on May 29, 2024, 8:43 a.m.