d {salad}R Documentation

get list of derivatives

Description

Get value, differential of a dual object, and the names of associated variables.

Usage

d(x, varnames)

value(x)

## S3 method for class 'dual'
value(x)

## S3 method for class 'numeric'
value(x)

varnames(x)

## S3 method for class 'dual'
varnames(x)

## S3 method for class 'numeric'
varnames(x)

Arguments

x

a dual (or numeric) oject

varnames

(optional) a vector or varnames to take derivatives along

Details

If 'varnames' is provided to the function 'd', a list of derivatives along the given variables will be sent back. In general, it sends back the derivatives along all associated variables.

The 'varnames' function sends back the names of all variables for which a derivative is defined.

Value

A named list of derivatives.

Examples

x <- dual(c(3,2))
varnames(x^2)
x**2
value(x**2)
d(x**2)
d(x**2, "x1")
# you can use these methods with a numerical constant
value(1)
varnames(1)
d(1, "x1")


[Package salad version 1.0 Index]