def sin_gen(N, m): rarr = sin_arr(N,m) rarr_x = vcalc.cderivative(rarr, 'X_DIR', order=1) * rarr.size rarr_y = vcalc.cderivative(rarr, 'Y_DIR', order=1) * rarr.size ok_(np.allclose(rarr_y, np.zeros(rarr_y.shape))) ok_(np.allclose(rarr_x, m * cos_arr(N, m)))
def cos_gen(N, m): rarr = np.transpose(cos_arr(N,m)) rarr_x = vcalc.cderivative(rarr, 'X_DIR', order=1) * rarr.size rarr_y = vcalc.cderivative(rarr, 'Y_DIR', order=1) * rarr.size ok_(np.allclose(rarr_x, np.zeros(rarr_x.shape))) ok_(np.allclose(rarr_y, np.transpose(-m * sin_arr(N, m))))
def cderiv_gen(N,m,n): rarr = sin_cos_arr(N,m,n) rarr_xx = vcalc.cderivative(rarr, 'X_DIR', order=2) rarr_yy = vcalc.cderivative(rarr, 'Y_DIR', order=2) rarr_laplacian = vcalc.laplacian(rarr) ok_(np.allclose(rarr_laplacian, rarr_xx + rarr_yy))