x = simulate([0], .1, 100) x.set_seed(10) z = x.potential(well_well) f = simulate([0], .1, 1000) f.set_seed(10) y = f.potential(OU) m = 3 basis_H = [Hermite(n) for n in range(m)] Z = VAC(basis_H, y, 1) ev_y_H = Z.find_eigen(3) basis_H = [h.to_fcn() for h in basis_H] H_fcns_y = [fcn_weighting(basis_H, v) for v in ev_y_H[1].T][::-1] t = np.linspace(-1.7, 1.7, 100) k = [h(z) for h in H_fcns_y] plt.plot(z, k[0], "-m", label="First, H") plt.plot(z, k[1], "-c", label="Second, H") plt.plot(z, k[2], "-k", label="Third, H") plt.legend(loc=8, prop={'size': 7}) plt.title("Estimated eigenfcns with indicator and Hermite bases") plt.show() m = 10 basis_I_20 = [ indicator(fineness=m, endpoint=2, center=i) for i in makegrid(endpoint=2, n=m)
ev = [[ev[0][i] for ev in evs] for i in range(m - 1)] [plt.plot(time_lag, ev[i]) for i in range(m - 1)] plt.xlabel("Time Lag") plt.ylabel("Eigenvalues") plt.title("Eigenvalues vs. Time Lag (OU, 1-D)") """ The third eigenvalue is well approximated until around .41 seconds of time lag, then the approximation gets dramatically worth. """ """ CODE FOR PLOTTING BELOW """ ev = evs[0] estimated = [fcn_weighting(basis, v) for v in ev[1].T][::-1] true = [fcn_weighting(basis_true, v) for v in w_f][::-1] if dimension == 1: z = np.linspace(-1.5, 1.5, 20) w = [h(z) for h in estimated] y = [h(z) for h in true] # plt.plot(z, w[0], "-r", label="First") plt.plot(z, w[1], "-b", label="Second") plt.plot(z, w[2], "-g", label="Third") # plt.plot(z[0],w[3], "-g", label = "Third") # # plt.plot(z, y[0], "-r", label="First") plt.plot(z, y[1], "-b", label="Second") plt.plot(z, y[2], "-g", label="Third")
ev_y_H = Y.find_eigen(3) z = x.potential(well_well) Z = VAC(basis_H, z, 1) ev_z_H = Z.find_eigen(3) Y = VAC(basis_I, y, 1) ev_y_I = Y.find_eigen(3) Z = VAC(basis_I, z, 1) ev_z_I = Z.find_eigen(3) basis_H = [h.to_fcn() for h in basis_H] basis_I = [i.to_fcn() for i in basis_I] H_fcns_y = [fcn_weighting(basis_H, v) for v in ev_y_H[1].T][::-1] H_fcns_z = [fcn_weighting(basis_H, v) for v in ev_z_H[1].T][::-1] I_fcns_y = [fcn_weighting(basis_I, v) for v in ev_y_I[1].T][::-1] I_fcns_z = [fcn_weighting(basis_I, v) for v in ev_z_I[1].T][::-1] print(L2subspaceProj_d(basis_H, H_fcns_y, endpoint=2.5, dimension=1, n=100)) # print( # L2subspaceProj_d(H_fcns_y, I_fcns_y, endpoint = 2.5, dimension = 1, n = 100), # L2subspaceProj_d(H_fcns_z, I_fcns_z, endpoint = 2.5, dimension = 1, n = 100) # ) z = np.linspace(-2.5, 2.5, 100) w = [h(z) for h in basis_H] l = [h(z) for h in H_fcns_y] e = [h(z) for h in I_fcns_y]
V = VAC(basis, trajectory, .385, delta_t) ev = V.find_eigen(4) time_lag = np.linspace(delta_t, .5, 40) evs = np.array( [VAC(basis, trajectory, l, delta_t).find_eigen(4)[0] for l in time_lag]) plt.plot(evs[:, 2]) plt.plot(evs[:, 1]) plt.plot(evs[:, 0]) s = evs[:, 2] - evs[:, 1] print([i for i in range(len(s)) if s[i] == max(s)]) '''time_lag[i] = .385''' H_fcns = [fcn_weighting(basis, v) for v in ev[1].T][::-1] # z = np.array([np.linspace(-1.2,1.2,300)]) # w = [h(z) for h in H_fcns] # plt.plot(z[0],w[0], "-r", label = "First") # plt.plot(z[0],w[1], "-b", label = "Second") # # plt.plot(z[0],w[2], "-g", label = "Third") # # plt.plot(z[0],w[3], label = 'Fourth') # # plt.plot(z[0],w[4], label = 'fifth') # plt.legend() # plt.title("Double well, estimated eigenfcns with indicator basis (n = 30,100)") # plt.show() # h5.close()