Created
March 5, 2015 01:10
-
-
Save mkowoods/2790d2269be28024d69d to your computer and use it in GitHub Desktop.
subspace vs space in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgl) | |
x <- rep(NA, 20000) | |
y <- rep(NA, 20000) | |
z <- rep(NA, 20000) | |
color <- rep(NA, 20000) | |
#subspace | |
for(i in 1:10000){ | |
a1 = runif(1, -100, 100) | |
a2 = runif(1, -100, 100) | |
a3 = runif(1, -100, 100) | |
x[i] <- a1*3 + a2*-3 + a3*1 | |
y[i] <- a1*0 + a2*1 + a3*-1 | |
z[i] <- a1*0 + a2*1 + a3*1 | |
color[i] <- "black" | |
} | |
#space of all points (orthogonal vectors) | |
for(i in 10001:20000){ | |
a1 = runif(1, -500, 500) | |
a2 = runif(1, -500, 500) | |
a3 = runif(1, -500, 500) | |
x[i] <- a1*1 + a2*0 + a3*0 | |
y[i] <- a1*0 + a2*1 + a3*0 | |
z[i] <- a1*0 + a2*0 + a3*1 | |
color[i] <- "blue" | |
} | |
plot3d(x,y,z, col = color) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment