In: Statistics and Probability
Write a R-script to (and show the outputs of your code)
(a) Create a sequence of numbers starting at 3.5 and ending at 10.7 with increments of 0.79. Find the variance and mean of those numbers. And finally sort the vector in a decreasing manner
(b) Create a 3 different 3 by 3 matrices such that each of the numbers 1,2,...,9 appear exactly once (Sudoku style) in each of the matrices.
(a)
vector <- seq(3.5, 10.7, by = 0.79)
mean(vector) #Ans: 7.055
var(vector) #Ans: 5.720917
sort(vector, decreasing = T) #Ans: 10.61 9.82 9.03 8.24 7.45 6.66
5.87 5.08 4.29 3.50
(b)
library(sudoku)
#Generate Sudoku: 1
set.seed(1)
sudoku1 <- generateSudoku(Nblank = 0, print.it = T)
#Generate Sudoku: 2
set.seed(2)
sudoku1 <- generateSudoku(Nblank = 0, print.it = T)
#Generate Sudoku: 3
set.seed(3)
sudoku1 <- generateSudoku(Nblank = 0, print.it = T)
**If this answers do not match or any kind of confusion you have please comment