Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
class TestHist(unittest.TestCase):
def setUp(self):
self.datas = [35, 25, 56, 78, 43, 66, 71, 73, 80, 90, 0, 73, 35, 65,
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
ABCDEFGHIJKLMNOPQRSTUVWXYZ
QWERTYUIOPASDFGHJKLZXCVBNM?
に置換するプログラムを作る
A-Z 以外の文字は ? にする
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
排他的論理和を使った簡単な暗号
101 = 5 を使って変換
'''
import unittest
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from random import randrange
class TestShuffle(unittest.TestCase):
def setUp(self):
#!/usr/bin/python
# -*- coding: utf-8 -*-
from math import sqrt, log, cos, sin, pi
def kai2(values, expected):
x = 0
for value in values:
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Euclidean Algorithm
'''
import unittest
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
エラトステネスのふるいを用いて素数を見つける
'''
import unittest
import math
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
・ 台形公式(Trapezoidal rule)
・ シンプソンの公式(Simpson's rule)
'''
import math
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
e^x, e^-x, cos x をテイラー展開を用いて計算する。
'''
import math
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
非線形方程式の根を求める
再帰的に近似を求め関数の根を求める
根を求める関数
f(x) = x^3 - x + 1