Skip to content

Instantly share code, notes, and snippets.

package main
import (
"log"
"net/http"
"os"
"path"
)
func main() {
# coding:utf8
import multiprocessing
import time
"""
multiprocessing.Poolのchunkってどんな感じよー?
"""
def square(n):
package main
import (
"code.google.com/p/plotinum/plot"
"code.google.com/p/plotinum/plotter"
"code.google.com/p/plotinum/plotutil"
"code.google.com/p/plotinum/vg"
"fmt"
"math"
)
function! ConfirmQuit(writeFile)
let l:confirmed = confirm("Do you really want to quit?", "&Yes\n&No", 2)
if l:confirmed == 1
quit
endif
endfu
cnoremap <silent> q<cr> call ConfirmQuit(0)<cr>
from pylab import *
x = arange(-10,10,0.1)
y = 0
for i in range(10):
y+= i*cos(i*x)
han = hanning(len(x))
y_ = han * x
from pylab import *
x = arange(0,1,0.001)
x_ = 0.5
sum = 0
for n in range(1, 10 ** 0 + 1):
sum += 2*sin(n*pi*x)*sin(n*pi*x_)
f1 = sum[:]
let g:quickrun_no_default_key_mappingsi=1
nnoremap <silent> <Leader>r :QuickRun -mode n<CR>
vnoremap <silent> <Leader>r :QuickRun -mode v<CR>
import pylab
# random
l = pylab.random(10**4)
pylab.subplot(211, title="random")
pylab.hist(l, bins=100)
# random ^ 2
l_ = pylab.random(10**4)
import pylab
from scipy import special
import math
def R(n,l,a_0):
"""Radius """
def _(r):
c = -(2.0/n/a_0)**(3./2.)*(math.factorial(n-l-1.)/2./n/math.factorial(n+l)**3.)**.5
return c*pylab.exp(-r/n/a_0)*r**l*special.genlaguerre(n+l,2.*l+1.)(2.*r/n/a_0)
import pylab
import time
import math
def f(i):
pass
def _range(n):
t = time.time()
for i in range(n):