2012-06-01から1ヶ月間の記事一覧

The example of CVXOPT

Hi there!Today, I would like to introduce cvxopt to you. CVXOPT is a library for resolving convex optimization like linear programs, and it is written by Python.please be careful for other packages when you want to install this in Mac. bec…

Hodgkin-Huxley model

This is the famous model for simulating the action potential of a neuron.In terms of neuroscience, the mechanism of an action potential is explained as like this. (1)When a membrane receives a stimulus, stimulus-dependent Na+ channels open…

Leaky Integrate and Fire model

(When I go back to Tokyo, I would like to comment on this code.)This code is mostly copied from the end of this site.... Neurdon #-*- coding:utf-8 -*- from __future__ import division import numpy as np import matplotlib.pyplot as plt class…

Neural Modeling with Python(IF, HH, Izhikevich,Diffusional equation, cable theory etc....)

In this log, I am summarizing Neural Models' articles. Later, I would like to make gists of them with python codes.Spiking Neuron Models Single Neurons, Populations, Plasticity comments for modelsSTEPS: Modeling and Simulating Complex Reac…

Project Euler 89 (python, 0.04s)

#-*- coding:utf-8 -*- from datetime import datetime def smallest_num(n): counter = 0 num = n dict_num = {"0":0, "1":1, "2":2, "3":3, "4":2, "5":1, "6":2, "7":3, "8":4, "9":2} if n >= 1000: counter += num / 1000 num = num % 1000 for i, d in…

Project Euler 70(python, 1.776935s)

#-*- coding:utf-8 -*- import random from datetime import datetime #素数判定 def is_prime3(q,k=50): q = abs(q) if q == 2: return True if q < 2 or q&1 == 0: return False d = (q-1)>>1 while d&1 == 0: d >>= 1 for i in xrange(k): a = random.ran…

Project Euler 69(python 0.001357s)

解き方的な #-*- coding:utf-8 -*- import random from datetime import datetime #素数判定 def is_prime3(q,k=50): q = abs(q) if q == 2: return True if q < 2 or q&1 == 0: return False d = (q-1)>>1 while d&1 == 0: d >>= 1 for i in xrange(k): a =…

Project Euler 63 (python 0.000409s)

#-*- coding: utf-8 -*- from datetime import datetime def Euler63(): total = 0 for i in xrange(1,10): counter = 1 length = len(str(i ** counter)) while counter == length: total += 1 counter += 1 length = len(str(i ** counter)) return total …

Project Euler 92(python, 3minutes)....

完全に敗北です。 くそコードだけども、仕方ない。 999999 -> 567だと気づけばもっと早いコードがかける。 が、考慮しても30秒しな縮まらず敗北感。 #-*- coding:utf-8 -*- from datetime import datetime def square_count(x, List1, List2): count_squar…