#reproduce first example on ?cube:
v <- c(0,rep(NA,5),1,NA)
circuit(cube(),v)
circuit(cube(),v+1000)
# problem: The nodes of a skeleton cube are at potentials
# 1,2,3,... volts. What current is needed to maintain this? Ans:
circuit(cube(),1:8)
#sanity check: maintain one node at 101 volts:
circuit(cube(),c(rep(NA,7),101))
#now, nodes 1-4 have potential 1,2,3,4 volts. Nodes 5-8 each have one
#Amp shoved in them. What is the potential of nodes 5-8, and what
#current is needed to maintain nodes 1-4 at their potential?
# Answer:
v <- c(1:4,rep(NA,4))
currents <- c(rep(NA,4),rep(1,4))
circuit(cube(),v,currents)
Run the code above in your browser using DataLab