# each row of M = a pair of symmetrical nodes; each element of v is a
# node on the vertical axis
M <- matrix(c(6,4,13,11,7,3,2,8,9,1,14,10),byrow=TRUE,ncol=2)
v <- c(5,12) # on vertical axis
sym_7_3 <- symmetry_object(k7_3, M, v)
k <- symmetrize(as.minobj(k7_3), sym_7_3)
knotplot2(k) #nice and symmetric!
## OK now convert to and from a mimimal vector for a symmetrical knot:
mii <- make_minsymvec_from_minobj(k, sym_7_3)
pii <- make_minobj_from_minsymvec(mii,sym_7_3)
knotplot2(pii)
## So 'mii' is a minimal vector for a symmetrical knot, and 'pii' is
## the corresponding minobj object. Note that you can mess about with
## mii, but whatever you do the resulting knot is still symmetric:
mii[2] <- 1000
knotplot2(make_minobj_from_minsymvec(mii,sym_7_3)) # still symmetric.
## and, in particular, you can optimize the badness, using nlm():
if (FALSE) {
fun <- function(m){badness(make_minobj_from_minsymvec(m,sym_7_3))}
o <- nlm(fun,mii,iterlim=4,print.level=2)
knotplot2(make_minobj_from_minsymvec(o$estimate,sym_7_3))
}
Run the code above in your browser using DataLab