mod((-3:5),4 ) # 1 2 3 0 1 2 3 0 1
modS((-3:5),4) # -3 -2 -1 0 1 2 3 0 1
x <- 200; y <- x + 0.1
equalFuzzy(x,y,0.1*c(10^(-3:0))) # FALSE TRUE TRUE TRUE
equalFuzzy(x,y,0.1*c(10^(-3:0)),FALSE) # FALSE FALSE FALSE TRUE
safeDiv(0:3,c(0,0:2)) # 1.552518e+231
solveQeq(0,0,1) # NA NA
solveQeq(0,1,0) # 0
solveQeq(0,1,1) # -1
solveQeq(1,0,0) # 0 0
solveQeq(1,0,1) # 0-1i 0+1i
solveQeq(1,1,0) # -1 0
solveQeq(1,1,1) # -0.5-0.866025i -0.5+0.866025i
solveQeq(sample(1:4,1),sample(1:4,1),sample(1:4,1))
x <- matrix(rnorm(9),3,3)
s <- svd(x)
lV(s$d)
norm(chsvd(s) - x) # 9.4368957e-16
submod(8.1,c(10.3, 31) ) # 0.0 8.1
submod(18.1,c(10.3, 31) ) # 1.0 7.8
Run the code above in your browser using DataLab