Title: | Symbolic Representation of Matrix Determinant |
Version: | 2.0.0 |
Description: | Creates a numeric guide for writing the formula for the determinant of a square matrix (a detguide) as a function of the elements of the matrix and writes out that formula, the symbolic representation. |
License: | MIT + file LICENSE |
SystemRequirements: | gmp (>= 4.2.3) |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.0 |
Suggests: | knitr, rmarkdown, Hmisc |
VignetteBuilder: | knitr |
Imports: | arrangements, fs, stats, utils |
Maintainer: | William Fairweather <wrf343@flowervalleyconsulting.com> |
NeedsCompilation: | no |
Packaged: | 2021-02-10 17:48:01 UTC; NO |
Author: | William Fairweather [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2021-02-10 18:00:03 UTC |
Create Determinant Guide (detguide) for pxp Matrix
Description
A determinant guide is a list of 2 levels, each of which contains a list of p!/2 levels, which codes the use of each element of a pxp matrix in the calculation of the determinant of that matrix. From the guide, the symbolic representation of the determinant can be produced directly.
Usage
anewdetguide(p,storage,verbose=TRUE)
Arguments
p |
Size of matrix (pxp) |
storage |
Name of directory where detguides are stored. |
verbose |
Logical. TRUE causes printing of function ID before and after running |
Details
Each determinant guide (detguide) is created by cofactor expansion from the detguide of the next smaller square matrix. If p is set larger than any existing detguide, all lower detguides larger than the largest existing one are first created in turn.
Value
"list"
comp1 |
Products in determinant with +1 coefficient |
comp2 |
Products in determinant with -1 coefficient |
Author(s)
William R. Fairweather
Examples
anewdetguide(p=5,storage=tempdir(),verbose=TRUE)
Create Determinant Guide (Minidetguide) for pxp Matrix
Description
A minidetguide is a series of p directories, each of which contains a matrix of size (p-1) x (p-1)!/2, which codes the use of each element of a pxp matrix in the calculation of the determinant of that matrix. From the minidetguide, the symbolic representation of the determinant can be produced directly.
Usage
anewminidet(p,storage,cols,verbose=TRUE)
Arguments
p |
Size of matrix (pxp) |
storage |
Name of directory where detguides are stored. |
cols |
Numbers of columns to be created. Default is 1:p, indicating all columns |
verbose |
Logical. TRUE causes printing of function ID before and after running |
Details
Each determinant guide (minidetguide) is created by creating the set of all possible permutations of the numbers 1 through p except j and storing them as a matrix in subdirectory R1Cj. This represents the set of columns corresponding to rows 2 through p of the products with leading element 1,j of the determinant.
Value
matrix described in details above
Author(s)
William R. Fairweather
Examples
anewminidet(p=5,storage=tempdir(),cols=1:5,verbose=TRUE)
Confirm Accuracy of Symbolic Determinant Created by anewdetguide() Function
Description
Compares the determinant calculated by multiplying eigenvalues of a matrix to that calculated by applying the symbolic representation created by this package.
Usage
confirm.det(x=NULL, p, storage, verbose=TRUE)
Arguments
x |
a user-defined matrix, or NULL |
p |
size of matrix (pxp) for which a detguide has been prepared |
storage |
Quoted name of directory from which to get detguide |
verbose |
Logical. T causes printing of function ID before and after running |
Value
Determinant of x produced obtained by multiplying its eigenvalues and determinant of x obtained by applying the detguide defined by p
Author(s)
William R. Fairweather
Examples
confirm.det(x=NULL, p=5,storage=tempdir(),verbose=TRUE)
Confirm Accuracy of Symbolic Determinant Created by anewminidet Function
Description
Compares the determinant calculated by multiplying eigenvalues of a matrix to that calculated by applying the symbolic representation created by this package
Usage
confirm.minidet(x=NULL, p, storage, verbose=TRUE)
Arguments
x |
a user-defined matrix, or NULL |
p |
size of matrix (pxp) for which a detguide has been prepared |
storage |
Quoted name of directory from which to get detguide |
verbose |
Logical. T causes printing of function ID before and after running |
Value
Determinantof x produced obtained by multiplying its eigenvalues and determinant of x obtained by applying the minidetguide defined by p
Author(s)
William R. Fairweather
Examples
confirm.minidet(x=NULL, p=5,storage=tempdir(),verbose=TRUE)
Index of Determinant Guides and Symbolic Representation Files
Description
Produces a table of existing detguides and parsed detguides for all p or a list of minidetguides and parsed minidetguides for a particular p
Usage
detindex(storage, mini=c("B","D","M"), pmini=1, verbose=TRUE)
Arguments
storage |
Quoted name of storage directory |
mini |
Index includes (B)oth detguides and minidetguides, (D)etguides only, (M)inidetguides only |
pmini |
p for minidetguides and related files; ignored if mini='D' |
verbose |
Logical. TRUE causes printing of function ID before and after running |
Details
Provide full path in storage. Example: storage="c:/determinants". If storage directory "name" is in same folder as R Workspace, storage="./name" is sufficient.
Value
Detguides |
Table of existing detguides and existing results of parsing the detguides for each p in the storage directory |
Minidetguides |
Table of existing minidetguides and existing results of parsing the minidetguides for p=pmini |
Call |
Call to this function |
Author(s)
William R. Fairweather
Examples
detindex(storage=tempdir(),mini="B",pmini=5,verbose=TRUE)
Display Symbolic Representation of Determinant of pxp Matrix
Description
Produces symbolic (textual) representation of determinant of pxp matrix from previously defined determinant guide (detguide) for that matrix
Usage
parsedetguide(p, storage,
browser="C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
symmetric=FALSE, verbose=TRUE)
Arguments
p |
Size of matrix (pxp) |
storage |
Name of directory where detguide is stored |
browser |
Name of program to be used as HTML browser |
symmetric |
Logical. T causes printing of determinant for symmetric matrix |
verbose |
Logical. TRUE causes printing of function ID before and after running |
Value
Returns symbolic representation to screen and to existing external storage.
Author(s)
William R. Fairweather
Examples
## Not run: parsedetguide(p=5, storage=tempdir(),
browser="C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
symmetric=FALSE,verbose=TRUE)
## End(Not run)
Display Symbolic Representation of Determinant of pxp Matrix
Description
Produces symbolic (textual) representation of determinant of pxp matrix from previously defined determinant guide (minidetguide) for that matrix
Usage
parsemini(p, storage, symmetric, cols=1:p, verbose=TRUE)
Arguments
p |
Size of matrix (pxp) |
storage |
Name of directory where detguide is stored |
symmetric |
Logical. T causes printing of determinant for symmetric matrix |
cols |
Column numbers of minidetguide to be calculated. Default (1:p) causes all to be calculated |
verbose |
Logical. TRUE causes printing of function ID before and after running |
Value
Returns symbolic representation to screen and to existing external storage.
Author(s)
William R. Fairweather
Examples
parsemini(p=5, storage=tempdir(), symmetric=FALSE,cols=1:5, verbose=TRUE)
Calculates Size of Elements of Determinant Guide and of Symbolic Representation
Description
In order to anticipate the impact of p on calculation time and storage, some indication can be found from size.predictor( ).
Usage
predictor(p,verbose=TRUE)
Arguments
p |
Size of matrix (pxp) |
verbose |
Logical. TRUE causes printing of function ID before and after running |
Details
Provide full path in storage, using double backslashes. Example: storage="c:\determinants". If storage directory is in same folder as R Workspace, storage=".\name" is sufficient.
Value
Summary of calculations in other functions of this package and their relationship to p, including the number of levels of positive terms and of negative terms, the number of elements of the matrix in each term of the determinant, and the number of lines of text required for the symbolic representation of the determinant.
Author(s)
William R. Fairweather
Examples
predictor(p=10,verbose=TRUE)
Retrieve Specific Detguide or Parsed Detguide
Description
Retrieves a specified file from storage directory
Usage
retrieve(p, storage,
browser="C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe", verbose=TRUE)
Arguments
p |
Size of matrix (pxp) |
storage |
Quoted name of directory for storage of detguides |
browser |
Name of program to be used as HTML browser |
verbose |
Logical. TRUE causes printing of program ID before and after running |
Details
Provide full path to storage. Example: storage="c:/determinants". File to be retrieved is indicated interactively from console.
Value
Selects and retrieves a detguide file from the storage/p/ subdirectory or displays the symbolic determinant in an HTML editor
Author(s)
William R. Fairweather
Examples
## Not run: retrieve(p=5,storage=tempdir(),
browser="C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
verbose=TRUE)
## End(Not run)
Retrieve Specific Minidetguide or Parsed Minidetguide
Description
Retrieves a specified file from storage directory
Usage
retrieve.mini(p, storage,
browser="C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
verbose=TRUE)
Arguments
p |
Size of matrix (pxp) |
storage |
Quoted name of directory for storage of detguides |
browser |
Name of program to be used as HTML browser |
verbose |
Logical. TRUE causes printing of program ID before and after running |
Details
Provide full path in storage. Example: storage="c:/determinants". File to be retrieved is indicated interactively from console.
Value
Selects and retrieves a minidetguide file from the storage/p/ subdirectory or displays the symbolic determinant in an HTML editor
Author(s)
William R. Fairweather
Examples
## Not run: retrieve.mini(p=5,storage=tempdir(),
browser="C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
verbose=TRUE)
## End(Not run)