deriv: Differentiation of mvp objects

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Differentiation of mvp objects

Usage

1
2
3
4
## S3 method for class 'mvp'
deriv(expr, v, ...)
## S3 method for class 'mvp'
aderiv(expr, ...)

Arguments

expr

mvp object

v

Character vector. Elements denote variables to differentiate with respect to

...

Further arguments, ignored in deriv() but specifies the differentials in aderiv()

Details

Function deriv(S,v) returns d^rS/dv1...dvr.

Function aderiv() uses the ellipsis construction with the names of the argument being the variable to be differentiated with respect to. Thus aderiv(S,x=1,y=2) returns d^3S/dxdy^2.

Value

Returns its argument invisibly

Author(s)

Robin K. S. Hankin

See Also

taylor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
p <- rmvp(10,9,9,letters[1:4])
deriv(p,letters[1:3])
deriv(p,rev(letters[1:3]))  # should be the same

aderiv(p,a=1,b=2,c=1)

## verify the chain rule:
x <- rmvp(7,symbols=6)
v <- allvars(x)[1]
s <- as.mvp("1  +  y  -  y^2 zz  +  y^3 z^2")
LHS <- subsmvp(deriv(x,v)*deriv(s,"y"),v,s)   # dx/ds*ds/dy
RHS <- deriv(subsmvp(x,v,s),"y")              # dx/dy

LHS - RHS # should be zero

mvp documentation built on Feb. 4, 2019, 5:05 p.m.