This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// processing script to simulate Brownian random motion | |
int n_particles = 200; // number of particles | |
// prepare arrays to store particle coordinates | |
float[] x = new float[n_particles]; | |
float[] y = new float[n_particles]; | |
void setup() { | |
size(512, 512); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Estimate per-step and per-trajectory diffusion coefficients from SPT data | |
# | |
# Created by: Raibatak Das | |
# Jan 2016 | |
library(readxl) | |
library(dplyr) | |
# Function to compute per-step diffusion coefficients | |
singlestepDmle = function(frame, x, y, pxl, dt){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Monte Carlo simulation to compute the probability that in a random sample of | |
# 50 individuals, 4 share a birthday and the other 46 have distinct birthdays | |
bdayOneTrial = function(){ | |
# Simulate a single trial | |
bdays = sample.int(365, size=50, replace=T) | |
counts = as.data.frame(table(bdays)) | |
sorted.counts = sort(counts$Freq, decreasing=T) | |
success = sorted.counts[1]==4 && sorted.counts[2]==1 | |
return(success) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
A python generator for the sequence 1, 2,.., 9, 10, 20,.., 90, 100, 200,.. up to n_max | |
Created by: Raibatak Das | |
''' | |
from math import floor, log10 | |
def logseq(n_max): |