Monthly Archives: August 2016

The Breathtaking 1-Matrix

La luna sale a caminar siguiendo tus pupilas (Ojos color sol, Calle 13)

This is a 5×5 1-matrix:

\begin{bmatrix} 1 &1 &1 &1 &1 \\ 1 &1 &1 &1 &1 \\ 1 &1 &1 &1 &1 \\ 1 &1 &1 &1 &1 \\ 1 &1 &1 &1 &1 \end{bmatrix}

And this is a 20×20 1-matrix visualized:

Rplot001

Maybe in some other galaxy, aliens represent matrix in this way.

par(mar = c(1, 1, 1, 1), bg="violetred4")
circlize::chordDiagram(matrix(1, 20, 20),
                       col="white",
                       symmetric = TRUE,
                       transparency = 0.85,
                       annotationTrack = NULL)
Advertisements

Gummy Worms

Just keep swimming (Dory in Finding Nemo)

Inspired by this post, I decided to create gummy worms like this:

worm
Or these:

When I was young I used to eat them.

Do you want to try? This is the code:

library(rgl)
library(RColorBrewer)
t=seq(1, 6, by=.04)
f = function(a, b, c, d, e, f, t) exp(-a*t)*sin(t*b+c)+exp(-d*t)*sin(t*e+f)
v1=runif(6,0,1e-02)
v2=runif(6, 2, 3)
v3=runif(6,-pi/2,pi/2)
open3d()
spheres3d(x=f(v1[1], v2[1], v3[1], v1[4], v2[4], v3[4], t),
          y=f(v1[2], v2[2], v3[2], v1[5], v2[5], v3[5], t),
          z=f(v1[3], v2[3], v3[3], v1[6], v2[6], v3[6], t),
          radius=.3, color=sample(brewer.pal(8, "Dark2"),1))