dual-class {dual}R Documentation

Dual object class An S4 Class for dual numbers

Description

The method initialize sets the initial values of a new object of the class dual.

The function dual generates an object of class dual for the representation of dual numbers.

The function is.dual returns TRUE if x is of the class dual. It retuns FALSE otherwise.

The method show shows the content of a dual object.

Usage

dual(f, grad)

## S4 method for signature 'dual'
initialize(.Object, f = numeric(0), grad = numeric(0))

dual(f, grad)

is.dual(x)

## S4 method for signature 'dual'
show(object)

Arguments

f

a single numeric value denoting the "Real" component of the dual number.

grad

a numeric vector rappresenting the "Dual" components of the dual number.

.Object

an object of class dual to be initialized

x

an object of class dual.

object

an object of class dual to be shown

Value

an object of the class dual.

a logical value indicating if the object is of the class dual or not.

Slots

f

a single numeric value denoting the "Real" component of the dual number

grad

a numeric vector rappresenting the "Dual" components of the dual number

Examples

x <- dual(3, 0:1)
library(dual)
x <- new("dual", f = 1, grad = 1)
is.dual(3)
is.dual(x)

[Package dual version 0.0.5 Index]