def fcn_all_twostate_theta(x, p): ans = {} Zc1 = p["Zc1"] Zc2 = p["Zc2"] Zcg = p["Zcg"] Mc1 = p["Mc1"] Mc2 = p["Mc2"] Zg1 = p["Zg1"] Zg2 = p["Zg2"] Mg1 = p["Mg1"] Mg2 = p["Mg2"] theta_1 = p["theta_1"] theta_2 = p["theta_2"] corr_cc_1 = gv.exp(-Mc1 * x["tc"]) + gv.exp(-Mc1 * (NT - x["tc"])) corr_cc_2 = gv.exp(-Mc2 * x["tc"]) + gv.exp(-Mc2 * (NT - x["tc"])) corr_gg_1 = gv.exp(-Mg1 * x["tc"]) + gv.exp(-Mg1 * (NT - x["tc"])) corr_gg_2 = gv.exp(-Mg2 * x["tc"]) + gv.exp(-Mg2 * (NT - x["tc"])) ans["CC"] = Zc1 * (gv.cos(theta_1)**2 * corr_cc_1 + gv.sin(theta_1)**2 * corr_gg_1) + Zc2 * (gv.cos(theta_2)**2 * corr_cc_2 + gv.sin(theta_2)**2 * corr_gg_2) corr_cc_1 = gv.exp(-Mc1 * x["tg"]) + gv.exp(-Mc1 * (NT - x["tg"])) corr_cc_2 = gv.exp(-Mc2 * x["tg"]) + gv.exp(-Mc2 * (NT - x["tg"])) corr_gg_1 = gv.exp(-Mg1 * x["tg"]) + gv.exp(-Mg1 * (NT - x["tg"])) corr_gg_2 = gv.exp(-Mg2 * x["tg"]) + gv.exp(-Mg2 * (NT - x["tg"])) ans["GG"] = Zg1 * (gv.cos(theta_1)**2 * corr_gg_1 + gv.sin(theta_1)**2 * corr_cc_1) + Zg2 * (gv.cos(theta_2)**2 * corr_gg_2 + gv.sin(theta_2)**2 * corr_cc_2) ans["GC"] = -( np.sqrt(gv.abs(Zg1 * Zc1)) * gv.cos(theta_1) * gv.sin(theta_1) * (gv.exp(-Mg1 * x["tgc"]) - gv.exp(-Mg1 * (NT - x["tgc"])) - gv.exp(-Mc1 * x["tgc"]) + gv.exp(-Mc1 * (NT - x["tgc"]))) + np.sqrt(gv.abs(Zg2 * Zc2)) * gv.cos(theta_2) * gv.sin(theta_2) * (gv.exp(-Mg2 * x["tgc"]) - gv.exp(-Mg2 * (NT - x["tgc"])) - gv.exp(-Mc2 * x["tgc"]) + gv.exp(-Mc2 * (NT - x["tgc"])))) return ans
def deriv(t, y): """ Calculate [d/d theta(t), d/dt d/dt theta(t)]. """ theta, dtheta_dt = y return np.array([dtheta_dt, - g_l * gv.sin(theta)])
def deriv(self, t, y, data=None): " Calculate [dtheta/dt, d2theta/dt2] from [theta, dtheta/dt]." theta, dtheta_dt = y return np.array([dtheta_dt, - self.g_l * gv.sin(theta)])
def deriv(t, y): """ Calculate [d/d theta(t), d/dt d/dt theta(t)]. """ theta, dtheta_dt = y return np.array([dtheta_dt, -g_l * gv.sin(theta)])