1 / 5

Ejemplo

Ejemplo. 0 4 1 3 2 4 3 5 4 2 5 4 6 3 7 4 8 5 9 1 10 4 11 3 12 4 13 5 14 2 15 4 16 3 17 4. Con N=18, encontrar el elemento que estaba en la posición 0 requiere 4 iteraciones; El de la posición 6, 3 iteraciones; etc., etc. Probemos con vectores más grandes:.

norina
Download Presentation

Ejemplo

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ejemplo 0 4 1 3 2 4 3 5 4 2 5 4 6 3 7 4 8 5 9 1 10 4 11 3 12 4 13 5 14 2 15 4 16 3 17 4 Con N=18, encontrar el elemento que estaba en la posición 0 requiere 4 iteraciones; El de la posición 6, 3 iteraciones; etc., etc.

  2. Probemos con vectores más grandes:

  3. Buscando el ajuste perfecto con R* bbinaria = function(N) { m = floor(log2(N+1)) x = 1:m u = 2^(x-1) if (sum(u) < N) { p = c(u/N, 1-sum(u)/N) x = c(x, m+1) } else { p = u/N } return (list(x=x, p=p)) } T=1:100 T=500*T mu=array(NA, dim=100) for (i in 1:100) { F = bbinaria(T[i]) mu[i] = sum(F$x*F$p) } lT=log2(T) mod=lm(mu~lT) summary(mod) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.986585 0.027777 -35.52 <2e-16 *** lT 1.003313 0.001946 515.65 <2e-16 *** Aproximadamente: mu = log(N) – 1 = log(N/2) * http://www.r-project.org/

  4. Pseudo-Random vs. True Random A Simple Visual Example http://www.boallen.com/random-numbers.html http://www.microsiervos.com/archivo/azar/ http://est-fib.blog.com/

More Related