# deriv: Differentiation of 'freealg' objects In freealg: The Free Algebra

## Description

Differentiation of freealg objects

## Usage

 1 2 ## S3 method for class 'freealg' deriv(expr, r, ...) 

## Arguments

 expr Object of class freealg r Integer vector. Elements denote variables to differentiate with respect to ... Further arguments, currently ignored

## Details

Function deriv(S,v) returns \mjeqn\frac\partial^r S\partial v_1\partial v_2...\partial v_rd^rS/dv1...dvr.

The Leibniz product rule

\mjdeqn\left

(u\cdot v\right)'=uv'+u'vomitted; see latex

operates even if (as here) u,v do not commute.

A term of a freealg object can include negative values which correspond to negative powers of variables. Thus:

 1 2 3 4 5 6 7 8  > deriv(as.freealg("aaaa"),1) # d(a^4)/da = 4a^3 free algebra element algebraically equal to + 4*aaa > deriv(as.freealg("A"),1) # d(a^-1)/da = -a^-2 free algebra element algebraically equal to - 1*AA 

(see also the examples). Vector r may include negative integers which mean to differentiate with respect to the inverse of the variable:

 1 2 3 4 5 6 7 > deriv(as.freealg("AAAA"),-1) # d(a^-4)/d(a^-1) = 4a^-3 free algebra element algebraically equal to + 4*AAA > deriv(as.freealg("aaa"),-1) # d(a^3)/d(a^-1) = 3a^4 free algebra element algebraically equal to - 3*aaaa > 

Function deriv() calls helper function lowlevel_diffn() which is documented at Ops.freealg.Rd.

## Author(s)

Robin K. S. Hankin

## Examples

 1 2 3 4 5 6 x <- rfalg() deriv(x,1:3) y <- rfalg(7,7,17,TRUE) deriv(y,1:5)-deriv(y,sample(1:5)) # should be zero 

freealg documentation built on Nov. 19, 2021, 9:07 a.m.