Learn R Programming

salad (version 1.2)

Arithmetic: Arithmetic Operators

Description

Arithmetic operators for objects of class 'dual'

Usage

# S4 method for dual,dual
+(e1, e2)

# S4 method for dual,numericOrArray +(e1, e2)

# S4 method for numericOrArray,dual +(e1, e2)

# S4 method for dual,missing +(e1, e2)

# S4 method for dual,dual -(e1, e2)

# S4 method for dual,missing -(e1, e2)

# S4 method for dual,numericOrArray -(e1, e2)

# S4 method for numericOrArray,dual -(e1, e2)

# S4 method for dual,dual *(e1, e2)

# S4 method for dual,numeric *(e1, e2)

# S4 method for numeric,dual *(e1, e2)

# S4 method for dual,numeric /(e1, e2)

# S4 method for numeric,dual /(e1, e2)

# S4 method for dual,dual /(e1, e2)

# S4 method for dual,numeric ^(e1, e2)

# S4 method for numeric,dual ^(e1, e2)

# S4 method for dual,dual ^(e1, e2)

Value

An object of class 'dual'.

Arguments

e1

object of class 'dual' or 'numeric'

e2

object of class 'dual' or 'numeric'

Details

The usual operations are performed, with appropriate propagation of the derivatives

Examples

Run this code
x <- dual( c(1,2) )
a <- 2 * x + 3
a
d(a)
b <- x[1] + 3*x[2]
b
d(b)

Run the code above in your browser using DataLab