Creating an n x n autocorrelation matrix

Walking around in old Lisbon.

Between covid-19 news and announcements of imminent Russia-Ukraine wars I needed a bit of a distraction. Sooo, here it is how to create an n x n autocorrelation matrix based on a correlation rho, with a simple 5 x 5 example in R:

This produces the following output: A 5 x 5 autocorrelation matrix… Continue reading Creating an n x n autocorrelation matrix

The beauty of code vectorisation

Garden wind sculpture

I came across this problem in Twitter: Description of the problem by Fermat's Library. The basic pieces of the problem are: We need to generate pseudorandom numbers with an identical distribution, add them up until they go over 1 and report back how many numbers we needed to achieve that condition.Well, do the above "quite… Continue reading The beauty of code vectorisation

Recreational programming

Screenshot of problem 1, Advent of Code 2021

I think programming, aka coding, is a fun activity. We are solving a problem subject to a set of constraints that can be time, memory, quantity of code, language, etc. Besides being a part of my work, coding is also a good distraction when doing it for the sake of it. In this type of… Continue reading Recreational programming