R/cdm_ll_numerical_differentiation.R

Defines functions cdm_ll_numerical_differentiation

## File Name: cdm_ll_numerical_differentiation.R
## File Version: 0.04

cdm_ll_numerical_differentiation <- function(ll0, ll1, ll2, h)
{
    d1 <- ( ll1 - ll2  ) / ( 2 * h )    # negative sign?
    # 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 CDM package in your browser

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

CDM documentation built on Aug. 25, 2022, 5:08 p.m.