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 python | |
# -*- coding: utf-8 -*- | |
if __name__ == '__main__': | |
print "Hello, world!" |
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
<!-- add line number to gist --> | |
<script type="text/javascript"> | |
$('.gist').each(function() { | |
$('.line',this).each(function(i, e) { | |
$(this).prepend( | |
$('<div/>').attr('unselectable','on').css({ | |
'float' : 'left', | |
'width': '30px', | |
'font-weight' : 'bold', | |
'color': 'grey', |
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 python | |
# -*- coding: utf-8 -*- | |
from FuncDesigner import * | |
from openopt import LP | |
# 変数の定義 | |
x1,x2 = oovars(2) | |
# 目的関数 | |
f = 3*x1 + 2*x2 | |
# 初期解 |
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
<!-- add line number to gist --> | |
<script type="text/javascript"> | |
var gists = document.getElementsByClassName('gist'); | |
for (var i = 0; i < gists.length; i++) { | |
var lines = gists[i].getElementsByClassName('line'); | |
for (var j = 0; j < lines.length; j++) { | |
var div = document.createElement('div'); | |
div.innerHTML = j + 1; | |
div.style.cssFloat = 'left'; | |
div.style.width = '30px'; |
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
<!-- | |
LaTeX for Blogger, requires jQuery | |
1. Add a HTML/Javascript gadget in the Layout mode and write this code. | |
2. In the HTML edit mode, write equations as follows: | |
<div class="equation"> | |
ax^2 + bx + c = 0 | |
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} | |
</div> |
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 python | |
# -*- coding: utf-8 -*- | |
""" | |
多次元尺度構成法 | |
Multidimensional Scaling; MDS | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt |
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
6.040760282116731938e-02 2.003600989193874138e-01 0 | |
-2.180560612167562751e-01 -8.292820699779238636e-01 0 | |
-5.144639589460509033e-01 8.281746425448210935e-01 0 | |
-4.740161490764375866e-03 -3.159114014274040476e-03 0 | |
-1.417081236535422117e-01 -1.966777129492919621e-02 0 | |
6.803427539200110341e-02 7.803962205781220240e-02 0 | |
-1.875352326510989487e-01 2.345321639090314769e-01 0 | |
2.805120457198624351e-01 1.557595199768933847e-01 0 | |
-2.649491374332632043e-01 -3.705041702348287058e-02 0 | |
-1.841101081351155799e-01 -6.072910303536597360e-02 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
regex = u'^[ぁ-ゞ・ー]+$' # ひらがな+・+ーだけ | |
p = re.compile(regex) | |
for line in open('ruby.txt'): | |
file, kanji, yomi = line.strip().split('\t') |
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 python | |
# -*- coding: utf-8 -*- | |
import sys,getopt | |
from numpy import array,matrix,diag | |
from scipy import sum,log,exp,mean,dot,ones,zeros | |
from scipy.special import polygamma | |
from scipy.linalg import norm | |
from random import random |
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 python | |
# -*- coding: utf-8 -*- | |
import math | |
import random | |
class plsa(): | |
def __init__(self,n,nz=2): |
OlderNewer