The ResistorArray
package gives functionality for calculating
electrical properties of resistor networks. Any array of resistors may
be implemented and a number of special arrays are given as data. For
example, a skeleton cube has 8 nodes and a conductance matrix for unit
resistors along each edge is given by cube()
:
cube()
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## [1,] 3 -1 0 -1 -1 0 0 0
## [2,] -1 3 -1 0 0 -1 0 0
## [3,] 0 -1 3 -1 0 0 -1 0
## [4,] -1 0 -1 3 0 0 0 -1
## [5,] -1 0 0 0 3 -1 0 -1
## [6,] 0 -1 0 0 -1 3 -1 0
## [7,] 0 0 -1 0 0 -1 3 -1
## [8,] 0 0 0 -1 -1 0 -1 3
A common puzzle is to calculate the resistance of such a cube between diagonally opposite corners, the answer being (the trick being to observe that nodes equidistant from the corners are at the same potential). This is easily reproduced in the package:
resistance(cube(),1,7)
## [1] 0.8333333
However, the trick does not work for general resistances but the package has no problem:
resistance(cube(1:12),1,7)
## [1] 4.766791
The package includes many other convenience functions; it is still under development.
To install the most recent stable version on CRAN, use
install.packages()
at the R prompt:
R> install.packages("ResistorArray")
To install the current development version use devtools
:
R> devtools::install_github("RobinHankin/ResistorArray")
And then to load the package use library()
:
library("ResistorArray")
R. K. S. Hankin 2006. “Resistor networks in R: introducing the
ResistorArray
package”. R News, 6(2),52-54
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.