Ancenstral sampling

Didn’t know the name ancestral sampling before. It is just sampling p(x,y,z) as p(x) p(y|x) p(z|x,y). Or basically, it is just a special case of Gibbs sampling.

Marching cube

A great explanation of the Marching Cube algorithm is here. The algorithm’s goal is to draw meshes of an implicit surface function . Based on the 8 corner points for each tiny cube is above or below the threshold, the mesh triangles for the cube can be easily determined. The algorithm then just iterates over…

Byzantine general problem

I thought I studied this before but can’t find a post from my blog. Byzantine generals problem was named by Leslie Lamport, the creator of LaTex. They consider a distributed consensus problem with the allegory that every general will need to agree on a broadcast message so that they can unify their attacks. It seems…

Bandlimited channel

By Shannon-Nyquist theorem, a bandlimited signal can be completely reconstructed with samples per second. Think of the opposite way, this means that each second we have independent components that we can vary for each second. The total noise power per second is and as it is spread over channel, the noise per component is ….

Differential privacy

I need to work on a data privacy project and so am spending some time to review some notes I wrote couple years ago. I guess it would be a great exercise to reorganize them into a post series.  And this will be my first post of this series. 🙂 Introduction to data privacy From…

Public key cryptography and RSA encryption algorithm

Let say if Alice would like to send a secret message to Bob, she may want to first encrypt the message before sending it. Modern cryptographic techniques all use some secret keys to encrypt and decrypt a message. For example, we may generate a random sequence with a predefined seed (the key) and take the…

Goagent experience

I am in Shanghai a couple days and it is quite inconvenient with many websites blocked. I heard about “breaking” the wall but I didn’t realize it is quite fast and easy. All one needs is a software called goagent. It takes advantage of the google app engine. Here, I will assume that ones already…

M/M/1 Simulation with Matlab

A simple simulation of M/M/1 queue with Matlab. The distribution of the number of “packets” in the system is computed and compared with the theoretical result. delta=0.1; % simulation step in sec lambda=0.1; % arrival rate in packets per second mu=0.2; % departure rate in packets per second rho=lambda/mu; M=50*3600/delta; % number of simulation step…

Simulating Poisson process in Matlab

Below is a simple Matlab code to simulate a Poisson process. The interarrival times were computed and recorded in int_times. The times are then grouped into bins of 10 seconds in width and the counts are stored in count. lambda=1/60; % arrival rate per second (1 minute per packet) T=10*3600; % simulation time in second…