-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62e8f90
commit 54dc418
Showing
5 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Package: numDeriv | ||
Version: 2016.8-1 | ||
Version: 2016.8-1.1 | ||
Title: Accurate Numerical Derivatives | ||
Description: Methods for calculating (usually) accurate | ||
numerical first and second order derivatives. Accurate calculations | ||
|
@@ -18,6 +18,6 @@ Author: Paul Gilbert and Ravi Varadhan | |
Maintainer: Paul Gilbert <[email protected]> | ||
URL: http://optimizer.r-forge.r-project.org/ | ||
NeedsCompilation: no | ||
Packaged: 2016-08-21 23:03:32 UTC; paul | ||
Packaged: 2019-06-04 11:04:44 UTC; hornik | ||
Repository: CRAN | ||
Date/Publication: 2016-08-27 00:25:32 | ||
Date/Publication: 2019-06-06 09:51:09 UTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
### R code from vignette source 'Guide.Stex' | ||
|
||
################################################### | ||
### code chunk number 1: Guide.Stex:6-7 | ||
################################################### | ||
options(continue=" ") | ||
|
||
|
||
################################################### | ||
### code chunk number 2: Guide.Stex:13-15 | ||
################################################### | ||
library("numDeriv") | ||
|
||
|
||
|
||
################################################### | ||
### code chunk number 3: Guide.Stex:24-41 | ||
################################################### | ||
grad(sin, pi) | ||
grad(sin, (0:10)*2*pi/10) | ||
func0 <- function(x){ sum(sin(x)) } | ||
grad(func0 , (0:10)*2*pi/10) | ||
|
||
func1 <- function(x){ sin(10*x) - exp(-x) } | ||
|
||
curve(func1,from=0,to=5) | ||
x <- 2.04 | ||
numd1 <- grad(func1, x) | ||
exact <- 10*cos(10*x) + exp(-x) | ||
c(numd1, exact, (numd1 - exact)/exact) | ||
|
||
x <- c(1:10) | ||
numd1 <- grad(func1, x) | ||
exact <- 10*cos(10*x) + exp(-x) | ||
cbind(numd1, exact, (numd1 - exact)/exact) | ||
|
||
|
||
################################################### | ||
### code chunk number 4: Guide.Stex:46-49 | ||
################################################### | ||
func2 <- function(x) c(sin(x), cos(x)) | ||
x <- (0:1)*2*pi | ||
jacobian(func2, x) | ||
|
||
|
||
################################################### | ||
### code chunk number 5: Guide.Stex:54-60 | ||
################################################### | ||
x <- 0.25 * pi | ||
hessian(sin, x) | ||
|
||
fun1e <- function(x) sum(exp(2*x)) | ||
x <- c(1, 3, 5) | ||
hessian(fun1e, x, method.args=list(d=0.01)) | ||
|
||
|
||
################################################### | ||
### code chunk number 6: Guide.Stex:65-68 | ||
################################################### | ||
func <- function(x){c(x[1], x[1], x[2]^2)} | ||
z <- genD(func, c(2,2,5)) | ||
z | ||
|
||
|
Binary file not shown.