Skip to content

Instantly share code, notes, and snippets.

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):
import scipy
import pylab
def f(x):
return x**3
x = pylab.arange(0,10,.01)
y = scipy.derivative(f,x,n=2)
from __future__ import division
import pylab
h_max,k_max,l_max = 4,4,4
L = pylab.zeros((h_max,k_max,l_max))
M = []
for h in range(h_max):
#encoding:utf-8
from __future__ import division
import pylab
l = pylab.loadtxt("data")
l = l.T
l_ = pylab.np.polyfit(l[1],l[0],1)