G <- function(x, g) {
-1000*g + sin(x)
}
gTrue <- function(x) (1000*sin(x) - cos(x))/1000001
xF <- 1; x0 <- 0
g0 <- -1/1000001 # initial value
NAkhtar <- 800
nAkhtar <- 2500
MAkhtar <- 1e-3
RAkhtar <- 1e-6
gAkhtar <- ODE.ADA(G, initvalue = g0, endpoint = xF, X0 = x0,
npoints = nAkhtar, M=MAkhtar, R = RAkhtar, N = NAkhtar)
plot(gAkhtar, type = "l")
Run the code above in your browser using DataLab