Learn R Programming

stokes (version 1.2-0)

Alt: Alternating multilinear forms

Description

Converts a k-tensor to alternating form

Usage

Alt(S,give_kform)

Value

Returns an alternating k-tensor. To work with k-forms, which are a much more efficient representation of alternating tensors, use as.kform().

Arguments

S

A multilinear form, an object of class ktensor

give_kform

Boolean, with default FALSE meaning to return an alternating k-tensor [that is, an object of class ktensor that happens to be alternating] and TRUE meaning to return a k-form [that is, an object of class kform]

Author

Robin K. S. Hankin

Details

Given a k-tensor T, we have

Alt(T)(v_1,...,v_k)= 1k!_ S_ksgn() T(v_(1),...,v_(k)) omitted; see latex

Thus for example if k=3:

Alt(T)(v_1,v_2,v_3)= 16(arrayc +T(v_1,v_2,v_3) -T(v_1,v_3,v_2)
-T(v_2,v_1,v_3) +T(v_2,v_3,v_1)
+T(v_3,v_1,v_2) -T(v_3,v_2,v_1) array ) omitted; see latex

and it is reasonably easy to see that Alt(T)Alt(T) is alternating, in the sense that

Alt(T)(v_1,...,v_i,...,v_j,...,v_k)= -Alt(T)(v_1,...,v_j,...,v_i,...,v_k) omitted; see latex

Function Alt() is intended to take and return an object of class ktensor; but if given a kform object, it just returns its argument unchanged.

A short vignette is provided with the package: type vignette("Alt") at the commandline.

See Also

kform

Examples

Run this code


(X <- ktensor(spray(rbind(1:3),6)))
Alt(X)
Alt(X,give_kform=TRUE)

S <- as.ktensor(expand.grid(1:3,1:3),rnorm(9))
S
Alt(S)

issmall(Alt(S) - Alt(Alt(S)))  # should be TRUE; Alt() is idempotent

a <- rtensor()
V <- matrix(rnorm(21),ncol=3)
LHS <- as.function(Alt(a))(V)
RHS <- as.function(Alt(a,give_kform=TRUE))(V)
c(LHS=LHS,RHS=RHS,diff=LHS-RHS)

Run the code above in your browser using DataLab