Displaying 2 results from an estimated 2 matches for "n_parent".
Did you mean:
c_parent
2017 Nov 09
2
R-help
...b) then n daughters are assigned i.i.d. uniformly to these parents and
such that each daughter is located i.i.d. uniformly in a disk of radius r =
0:1 centred at her parent, under the periodic boundary conditions (i.e. the
square = a torus).
My attempt so far is:
set.seed(1) library(spatstat)
n_parent <- 2
n_daughter <- 4
r = 0.1
cnt <- n
W <- disc(radius=3, centre=c(0,0)) i <- 1
while(i <= n_daughter){
d_x <- runif(1)
d_y <- runif(1)
if (d_x ^2+d_y^2 <r) {
i = i+1}}
#need a condition here such that (d_x,d_y) lies in B(0,r)
#where B(0,r) is a ball of ce...
2017 Nov 09
0
R-help
...to these parents and such
> that each daughter is located i.i.d. uniformly in a disk of radius r =
> 0:1 centred at her parent, under the periodic boundary conditions (i.e. the
> square = a torus).
>
>
> My attempt so far is:
>
>
> set.seed(1) library(spatstat)
>
> n_parent <- 2
>
> n_daughter <- 4
>
> r = 0.1
>
> cnt <- n
>
> W <- disc(radius=3, centre=c(0,0)) i <- 1
>
> while(i <= n_daughter){
>
> d_x <- runif(1)
>
> d_y <- runif(1)
>
> if (d_x ^2+d_y^2 <r) {
>
> i = i+1}}
>
>...