def f(x): mu = x[:, 0] kappa = x[:, 1] square_diff = x[:, 2] delta_inf = x[:, 3] delta_0 = tf.sqrt(2 * square_diff + tf.square(delta_inf)) Phi = tfi.Phi(mu, delta_0, num_pts=gauss_quad_pts) Prime = tfi.Prime(mu, delta_0, num_pts=gauss_quad_pts) PrimSq = tfi.PrimSq(mu, delta_0, num_pts=gauss_quad_pts) IntPrimPrim = tfi.IntPrimPrim(mu, delta_0, delta_inf, num_pts=gauss_quad_pts) IntPhiPhi = tfi.IntPhiPhi(mu, delta_0, delta_inf, num_pts=gauss_quad_pts) F = Mm * kappa + MI # mu G = Mn * Phi + SnI * Prime H = tf.square(g) * (PrimSq - IntPrimPrim) + ( tf.square(Sm) * tf.square(kappa) + 2 * SmI * kappa + SI_squared) * (delta_0 - delta_inf) I = (tf.square(g) * IntPhiPhi + tf.square(Sm) * tf.square(kappa) + 2 * SmI * kappa + SI_squared) return tf.stack([F, G, H, I], axis=1)
def f(x): mu = x[:, 0] delta_0 = x[:, 1] Phi = tfi.Phi(mu, delta_0, num_pts=gauss_quad_pts) PhiSq = tfi.PhiSq(mu, delta_0, num_pts=gauss_quad_pts) F = Mm * Mn * Phi H = (g**2) * PhiSq + (Sm**2) * (Mn**2) * Phi**2 return tf.stack([F, H], axis=1)
def consistent_solve(y, g, eps, T): y_1 = y[:, :, :, 0] y_2 = y[:, :, :, 1] y_3 = y[:, :, :, 2] for i in range(T): Sii = tf.sqrt((Sini / Sin_tf)**2 + Sip**2) mu = Mm_tf * y_3 + Mi new1 = g * g * tf_integrals.PhiSq(mu, y_2) + Sim_tf**2 * y_3**2 new1 = new1 + Sii**2 new2 = Mn_tf * tf_integrals.Phi( mu, y_2) + Sini * tf_integrals.Prime(mu, y_2) y_new_1 = Mm_tf * new2 + Mi y_new_2 = (1 - eps) * y_2 + eps * new1 y_new_3 = (1 - eps) * y_3 + eps * new2 y_1 = y_new_1 y_2 = y_new_2 y_3 = y_new_3 y_out = tf.stack([y_1, y_2, y_3], axis=0) return y_out
def f(x): mu = x[:, 0] delta_0 = x[:, 1] delta_inf = x[:, 2] Phi = tfi.Phi(mu, delta_0, num_pts=gauss_quad_pts) PrimSq = tfi.PrimSq(mu, delta_0, num_pts=gauss_quad_pts) IntPrimPrim = tfi.IntPrimPrim(mu, delta_0, delta_inf, num_pts=gauss_quad_pts) IntPhiPhi = tfi.IntPhiPhi(mu, delta_0, delta_inf, num_pts=gauss_quad_pts) F = Mm * Mn * Phi G_squared = delta_inf**2 + 2 * ((g**2) * (PrimSq - IntPrimPrim) + (Mn**2) * (Sm**2) * (Phi**2) * (delta_0 - delta_inf)) G = tf.sqrt(tf.nn.relu(G_squared)) H = (g**2) * IntPhiPhi + (Mn**2) * (Sm**2) * (Phi**2) return tf.stack([F, G, H], axis=1)