This file contains hidden or 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 | |
file_list = ["2010820135318.xls", | |
"tax__down_kyuyoido_rei.xls", | |
"toku-kirikae.xls", | |
"44hp.xls", | |
"tool_1_3.xls"] | |
apps = ["/usr/bin/gnumeric"] |
This file contains hidden or 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
n = 0 | |
n = 1 | |
1 initial orders were sortable within 0 ops. | |
n = 2 | |
1 initial orders were sortable within 0 ops. | |
2 initial orders were sortable within 1 ops. | |
n = 3 | |
1 initial orders were sortable within 0 ops. | |
4 initial orders were sortable within 1 ops. | |
6 initial orders were sortable within 2 ops. |
This file contains hidden or 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 copy | |
import math | |
import random | |
def random_x(): | |
return 2*random.randint(0, 1) - 1 | |
def modify(x): | |
i = random.randint(0, 2) | |
xr = copy.copy(x) |
This file contains hidden or 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/python3 | |
'''Theano simple implementation of exmaple 1 in the MCMC book, | |
the same progrm with | |
example1.py (https://gist.github.com/GM3D/51965c9e6de5456971b5). | |
without shared variable.''' | |
from __future__ import print_function | |
import numpy as np | |
import theano | |
from theano.ifelse import ifelse |
This file contains hidden or 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/python3 | |
import numpy as np | |
from numpy import random | |
N = 10 | |
size = [N, N] | |
theta = 0.42 | |
n_steps = 1000000 | |
x = 2 * random.random_integers(0, 1, size=size) - 1 |
This file contains hidden or 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
#!/bin/bash | |
fbody="$(basename "$1" .pdf)" | |
outfile="$(echo $fbody | sed -s s/-$//)"-p.png | |
convert -type Grayscale -density 600 -resample 100 -antialias "${fbody}.pdf" "$outfile" | |
This file contains hidden or 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
from sympy import sqrt | |
N = 15 | |
a = [[]]*N | |
for n in range(N): | |
a[n] = [0]*(n+1) | |
if n == 0: | |
a[0][0] = 1 | |
else: | |
for l in range(n + 1): |
This file contains hidden or 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/python3 | |
from math import sqrt, factorial | |
from operator import mul | |
def binomial(n, k): | |
return factorial(n)/(factorial(n-k) * factorial(k)) | |
def dot_prod(a, b): | |
return sum(map(mul, a, b)) |
This file contains hidden or 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 math as m | |
def pure_power(N): | |
"""checks if N is a pure power, i. e. N = a^b for some integers | |
a >=1, b >= 2. | |
returns (a, b) if a and b are found. | |
returns (N, 1) if N is not a pure power. | |
See ref.1.: https://en.wikipedia.org/wiki/ | |
Computational_complexity_of_mathematical_operations#Elementary_functions | |
for the computational complexities for each element. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer