Skip to content

Instantly share code, notes, and snippets.

View acbalingit's full-sized avatar
🐈
🐈🐈🐈

Chester Balingit acbalingit

🐈
🐈🐈🐈
View GitHub Profile
@acbalingit
acbalingit / keybase.md
Created October 25, 2014 14:14
Keybase Identity Validation for GitHub

Keybase proof

I hereby claim:

  • I am acbalingit on github.
  • I am acbalingit (https://keybase.io/acbalingit) on keybase.
  • I have a public key whose fingerprint is 0DE2 CB83 E40B 8842 7547 0425 8FAC 6CA2 57AF 8D8C

To claim this, I am signing this object:

@acbalingit
acbalingit / Untitled.py
Created January 3, 2013 12:23
Untitled
#!/usr/bin/env python
from pylab import *
from scipy.integrate import quad
def argument(k):
return lambda y: y*exp(-k*sin(y))
x = linspace(0, 30)
y = map(lambda x: quad(argument(x), 0, pi)[0], x)
@acbalingit
acbalingit / docstr.py
Created August 9, 2012 12:12
Docstring Formatting Guideline for Python
def function(param, **kwargs):
"""(one-line description of the function/class specified, like in Twitter!)
(a more definitive description of the function. Also add necessary details
on how the function was built, and how it works. When developing code, you
may add dev notes and TODOs to be easily readable when scrolling through
functions/class)
Parameters
@acbalingit
acbalingit / introut.pyx
Created August 8, 2012 14:12
Fix me, Mr. Bear!
#!/usr/bin/env python
import numpy as np
from scipy.integrate import dblquad
### integration routine
def distance(coord1,coord2):
cdef double length
length = (coord1[0] - coord2[0])**2
import numpy as np
#import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
from n1 import *
"""
@acbalingit
acbalingit / rk4.py
Created March 7, 2012 04:47
RK4 (order1)
func = lambda x, y: y**2 + 1
def OR1solver(func, bound, h):
x_vals, y_vals = [], []
x, y = 0, 0
for i in range(int(bound/h)):
k = np.zeros(4)
k[0] = h*func(x, y)
k[1] = h*func(x + 0.5*h, y + 0.5*k[0])
k[2] = h*func(x + 0.5*h, y + 0.5*k[1])
if __name__ == "__main__":
work_queue = Queue()
for i in [runif, lattice, clustering, partclust, radial, walker]:
work_queue.put(i)
processes = [Process(target=operation,args=(all,)) for all in [runif, lattice, clustering, partclust, radial, walker] ]
for p in processes:
p.start()
for p in processes:
p.join()
import random
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from plots import *
import pickle
#bump
def coord_solver(trigs, rad):
"""
@acbalingit
acbalingit / numint.py
Created February 19, 2012 11:18
Trapezoidal and Romberg Integration
import numpy as np
import matplotlib.pyplot as plt
func = lambda x: np.sin(x)
d1func = lambda x: np.cos(x)
d3func = lambda x: -1*np.cos(x)
def trapezoidal(func, n, dfunc='null',dddfunc='null', x0=0, xn=np.pi):
x = np.linspace(x0, xn, n)
import scipy.optimize as optimize
import numpy as np
import collections
import matplotlib.pyplot as plt
from numpy import random
def sampler(points,mu,sigma):
return np.linspace(0, 2*np.pi, points), \
np.sin(np.linspace(0, 2*np.pi, points)) \
+ random.normal(mu,sigma,size=(points))