-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hard test.R
48 lines (28 loc) · 1.03 KB
/
Hard test.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#Editor:-Arnab Suklabaidya
#Date:-21/03/21
#installing all package dependencies
install.packages("Rcpp")
install.packages("RcppEigen")
install.packages("BH")
install.packages("lpSolveAPI")
install.packages("cubature")
#Using devtools to install volesti Rcpp Package
Rcpp::compileAttributes()
library(devtools)
devtools::build()
devtools::install()
#Rstudio as well to open volesti.Rproj and then click build source Package and then Install and Restart in Build at the menu bar.
#installing volesti package
install.packages("volesti")
library(volesti)
myfunction <- function(x) {
y = exp(-a *sum(x^2))
}
## SIMPLE MONTE CARLO USING UNIFORM DISTRIBUTION
P = gen_cube(d, 'H')
points = sample_points(P1, random_walk = list("walk" = "Baw"), n = 10000,
seed = 5)
## SIMPLE MONTE CARLO USING GAUSSIAN DISTRIBUTION
P <- gen_cube(d,"H")
points = sample_points(P, n=10000 , distribution = list("density" = "gaussian", "variance" = 1)
plot(points[1,],points[2,])