# arithops: Basic Arithmetic Operations. In shabbychef/madness: Automatic Differentiation of Multivariate Operations

## Description

These perform basic arithmetic operations on `madness` objects: unary plus and minus, addition, subtraction, multiplication, division and power.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80``` ```## S4 method for signature 'madness,missing' e1 + e2 ## S4 method for signature 'madness,missing' e1 - e2 ## S4 method for signature 'madness,madness' e1 + e2 ## S4 method for signature 'madness,numeric' e1 + e2 ## S4 method for signature 'madness,array' e1 + e2 ## S4 method for signature 'numeric,madness' e1 + e2 ## S4 method for signature 'array,madness' e1 + e2 ## S4 method for signature 'madness,madness' e1 - e2 ## S4 method for signature 'madness,numeric' e1 - e2 ## S4 method for signature 'madness,array' e1 - e2 ## S4 method for signature 'numeric,madness' e1 - e2 ## S4 method for signature 'array,madness' e1 - e2 ## S4 method for signature 'madness,madness' e1 * e2 ## S4 method for signature 'madness,numeric' e1 * e2 ## S4 method for signature 'madness,array' e1 * e2 ## S4 method for signature 'numeric,madness' e1 * e2 ## S4 method for signature 'array,madness' e1 * e2 ## S4 method for signature 'madness,madness' e1 / e2 ## S4 method for signature 'madness,numeric' e1 / e2 ## S4 method for signature 'madness,array' e1 / e2 ## S4 method for signature 'numeric,madness' e1 / e2 ## S4 method for signature 'array,madness' e1 / e2 ## S4 method for signature 'madness,madness' e1 ^ e2 ## S4 method for signature 'madness,numeric' e1 ^ e2 ## S4 method for signature 'madness,array' e1 ^ e2 ## S4 method for signature 'numeric,madness' e1 ^ e2 ## S4 method for signature 'array,madness' e1 ^ e2 ```

## Arguments

 `e1, e2` `madness` or numeric values

## Author(s)

Steven E. Pav [email protected]

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```set.seed(123) y <- array(rnorm(3*3),dim=c(3,3)) dy <- matrix(rnorm(length(y)*2),ncol=2) dx <- crossprod(matrix(rnorm(ncol(dy)*100),nrow=100)) obj0 <- madness(val=y,vtag='y',xtag='x',dvdx=dy,varx=dx) z <- array(rnorm(3*3),dim=c(3,3)) anobj <- + obj0 anobj <- - obj0 anobj <- 6 - obj0 anobj <- 1 + obj0 anobj <- obj0 - 3 anobj <- z + obj0 anobj <- obj0 - z obj1 <- obj0 ^ 2 anobj <- (0.3 * obj0) + (5.1 * obj1) anobj <- 2 ^ obj0 anobj <- obj1 ^ obj0 anobj <- obj1 / obj0 anobj <- z / obj0 ```

shabbychef/madness documentation built on Feb. 12, 2020, 3:12 a.m.