(p <- rmvp(10,4,15,5))
deriv(p,"a")
deriv(p,"a",3)
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
Run the code above in your browser using DataLab