Skip to content

Instantly share code, notes, and snippets.

View drvinceknight's full-sized avatar
😀
👍

Vince Knight drvinceknight

😀
👍
View GitHub Profile
@drvinceknight
drvinceknight / continuous_pi.py
Created October 23, 2015 13:08
Calculate steady state
from sympy import Matrix
Q = [[-2, 1, 1],[3, -5, 2], [1, 1, -2]]
M = Matrix(Q)
pi = M.transpose().nullspace()[0]
pi = list(pi / sum(pi))
print pi
from __future__ import division
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import random
import math
import tqdm
def lognormal_cdf(x, m, s):
x1 = x[0]
x2 = x[1]
"""
Code and go
"""
import random
import math
import ciw
ciw = False
class Pet:
noise = ""
def make_noise(self):
return self.noise
class Dog(Pet):
noise = "Woof"
class Cat(Pet):
noise = "Meow"
\documentclass{article}
\usepackage{hyperref}
\begin{document}
If you're awesome you should use \cite{hypothesisx.y}.
\bibliographystyle{plain}
\bibliography{demo.bib}
import axelrod as axl
players = [axl.Cooperator(), axl.Defector(), axl.TitForTat(),
axl.PSOGambler(), axl.BackStabber(), axl.ThueMorse()]
tournament = axl.Tournament(players, processes=2)
results = tournament.play()
print(results.ranked_names)
from collections import Counter
responses = ['E', 'B', 'C', 'E', 'E', 'B', 'A']
counts = Counter(responses)
# Print all of the counter object:
print counts
# Iterate through everything in counts and print them (a Counter acts like a
# dictionary).
import json
import time
from multiprocess import Process, Queue
import axelrod as axl
def match_generator(players, turns=100, repetitions=1000):
for rep in range(repetitions):
for player1 in players:
import axelrod as axl
import random
from sys import argv
random.seed(1)
if len(argv) == 1:
processes = None
else:
processes = 2
import doctest
import os
import unittest
def load_tests(loader, tests, ignore):
for root, dirs, files in os.walk("./docs"):
for f in files:
if f.endswith(".rst"):
tests.addTests(