Skip to contents

JordanCanonical: Jordan canonical form A = P J P^-1 of an integer matrix with integer spectrum in exact (rational) arithmetic: characteristic polynomial by Faddeev-LeVerrier, integer roots by the rational-root theorem, block counts from rank N^(k-1) - rank N^k and Jordan chains grown from the longest blocks down. GaloisGroup: Galois group over Q of an integer polynomial of degree 1 to 4 (Kappe-Warren test for quartics). ShuntingYard: Dijkstra's infix to reverse Polish conversion and evaluation. Identical to the Python arm morie.fn.symalg; exact while the integers involved stay below 2^53.

Usage

JordanCanonical(A)

GaloisGroup(poly)

ShuntingYard(tokens, variables = NULL)

Arguments

A

Square integer matrix.

poly

Integer coefficients, highest degree first.

tokens

Expression string or character vector of tokens.

variables

Named list of variable values.

Value

List. JordanCanonical: J, P, blocks (eigenvalue, size), charpoly, eigenvalues. GaloisGroup: group, order, degree, monic, discriminant, resolvent and roots or factors. ShuntingYard: rpn, value, tokens.

References

Horn, R. A. and Johnson, C. R. (2013). Matrix Analysis, 2nd edn. Cambridge University Press.

Kappe, L.-C. and Warren, B. (1989). An elementary test for the Galois group of a quartic polynomial. American Mathematical Monthly 96, 133-137.

Dijkstra, E. W. (1961). Algol 60 translation. Mathematisch Centrum report MR 35/61, Amsterdam.

Examples

JordanCanonical(rbind(c(5, 4, 2, 1), c(0, 1, -1, -1), c(-1, -1, 3, 0), c(1, 1, -1, 2)))$J
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    0    0    0
#> [2,]    0    2    0    0
#> [3,]    0    0    4    1
#> [4,]    0    0    0    4
GaloisGroup(c(1, 0, 0, 0, -2))$group
#> [1] "D4"
ShuntingYard("3 + 4 * 2 / (1 - 5) ^ 2 ^ 3")$value
#> [1] 3.000122