Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import numpy as np | |
import numpy.random as nr | |
def gen(N): | |
X = nr.choice([0,1],size=N,p=[0.6,0.4]) | |
D = nr.choice([0,1],size=N,p=[0.6,0.4]) | |
epsi = nr.uniform(0,2,N) | |
Y = X+D*epsi | |
return X,D,epsi,Y | |
def estim(D,Y): |
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
import itertools as it | |
NTHUGS = 3 | |
NCASES = 2 | |
BOATCAP = 3 | |
thugs = set() | |
cases = set() | |
owner = dict() | |
nresults = 0 |
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
# Basic RBC model with full depreciation | |
# U(c) = log(c) | |
# F(K) = Z k^\alpha | |
# where Z is a finite-state Markov chain | |
# | |
# Original version: | |
# Jesus Fernandez-Villaverde | |
# Haverford, July 3, 2013 | |
# https://github.com/jesusfv/Comparison-Programming-Languages-Economics/blob/master/RBC_Python.py | |
# |
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
{-#LANGUAGE BangPatterns #-} | |
{- | |
Enumerate all closed Knight's Tours in an | |
arbitrarity sized chessboard. Multi-threaded version. | |
Usage: | |
KnightTours m n +RTS -N | |
Compile with: |
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
/* | |
A multi-threaded brute-force search for closed Knight's tours (used OpenMP) | |
Usage: knights_tours [m] [n] | |
to search for tour on a m x n board | |
rows are denoted by letters A.., columns by numbers 0.. | |
Compile with | |
g++ -O3 -Wall -std=c++11 -fopenmp knight_tours.cc -o knight_tours |
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
/* | |
A multi-threaded brute-force search for closed Knight's tours (used OpenMP) | |
Usage: knights_tours [m] [n] | |
to search for tour on a m x n board | |
rows are denoted by letters A.., columns by numbers 0.. | |
Compile with | |
g++ -O3 -Wall -std=c++11 -fopenmp knight_tours.cc -o knight_tours |
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
""" | |
Simulate the fictitious play dynamic | |
for the game in section 5.3 of | |
Shapley, Lloyd S. "Some topics in two-person games." | |
Advances in game theory 52 (1964): 1-29. | |
Author: Jyotirmoy Bhattacharya, jyotirmoy@jyotirmoy.net | |
The author has placed this program in the public domain |
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/python | |
""" | |
Random walk on two-dimensional grid | |
(c) Jyotirmoy Bhattacharya, jyotirmoy@jyotirmoy.net | |
LICENSE: GPL3 | |
""" | |
import random | |
import gtk,gobject,cairo | |
import math |
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
""" | |
A script to keep score for a version of Rosenthal's centipede game. | |
The rules are: | |
1. There are two players. | |
2. At the beginning of the game the players have 1 point each. | |
3. The players get turns alternately. | |
4. On their turn a player can choose to continue (C) or stop (S). | |
5. If the player chooses C, 1 point is taken from their account | |
and 2 points are added to the other player's account. | |
6. If the player chooses S, the game stops. |