@@ -518,55 +518,40 @@ def _step_impl(self):
518518 # # Fabien (5.59) and (5.60)
519519 # LU_real = self.lu(MU_REAL / h * Jyp + Jy)
520520 LU_real_ODE_mass = LU_real
521+ # LU_real_ODE_mass = self.lu(MU_REAL / h * Jyp + Jy)
521522 # err_ODE_mass = h * MU_REAL * Jyp @ ((yp - f) + Z.T.dot(E * MU_REAL))
522523 # error_ODE_mass = self.solve_lu(LU_real_ODE_mass, err_ODE_mass) / (MU_REAL * h)
524+ # error_ODE_mass = self.solve_lu(
525+ # LU_real_ODE_mass,
526+ # Jyp @ ((yp - f) + Z.T.dot(E) / h),
527+ # )
523528 error_ODE_mass = self .solve_lu (
524- LU_real_ODE_mass ,
525- Jyp @ ((yp - f ) + Z .T .dot (E ) / h ),
529+ LU_real ,
530+ # # (yp - f) + Jyp @ Z.T @ E / h,
531+ # yp + Jyp @ Z.T @ E / h,
532+ Jyp @ (yp + Z .T @ E / h ), # TODO: Why is this a good estimate?
526533 )
534+ # error_ODE_mass = (yp + Z.T @ E / h) / (MU_REAL / h)
527535 error = error_ODE_mass
528536
529537 # ###############
530538 # # Fabien (5.65)
531539 # ###############
532- # b0_hat = 0.02
533- # # b0_hat = 1 / MU_REAL # TODO: I prefer this...
540+ # # b0_hat = 0.02
541+ # b0_hat = 1 / MU_REAL # TODO: I prefer this...
534542 # gamma_hat = 1 / MU_REAL
535- # yp_hat_new = (y_new - (y + h * b_hat @ Yp + h * b0_hat * yp)) / (h * gamma_hat)
536- # yp_hat_new = MU_REAL * (b - b_hat) @ Yp - b0_hat * yp
537- # # yp_hat_new = MU_REAL * ((b - b_hat) @ Yp - b0_hat * yp)
538- # # # for b0_hat = 1 / MU_REAL this reduces to
539- # # yp_hat_new = MU_REAL * (b - b_hat) @ Yp - yp
540- # # yp_hat_new *= h
541- # # print(f"yp_new: {yp_new}")
542- # # print(f"yp_hat_new: {yp_hat_new}")
543- # # y_hat_new = y + h * b_hat @ Yp + h * b0_hat * yp + h * gamma_hat * yp_hat_new
544- # # y_hat_new = y + h * b_hat @ Yp + h * b0_hat * yp + h * gamma_hat * yp_hat_new
545- # # error = y_hat_new - y_new
546-
547- # error = np.zeros_like(y_new)
548-
549- # # F = self.fun(t_new, y_new, yp_hat_new)
550- # F = self.fun(t_new, y_new, MU_REAL * (b - b_hat) @ Yp - b0_hat * yp)
551- # # error = np.linalg.solve(Jy + Jyp / (h * gamma_hat), -F)
552- # error = self.solve_lu(LU_real, -F)
553-
554- # yp_hat_new = MU_REAL * (b - b_hat) @ Yp - b0_hat * yp
543+ # # yp_hat_new = (y_new - (y + h * b_hat @ Yp + h * b0_hat * yp)) / (h * gamma_hat)
544+ # # yp_hat_new = (1 / gamma_hat) * ((b - b_hat) @ Yp - b0_hat * yp)
545+ # yp_hat_new = (1 / gamma_hat) * ((b - b_hat) @ Yp - b0_hat * yp)
546+ # # yp_hat_new = (Z.T.dot(E) / h - yp)
555547 # F = self.fun(t_new, y_new, yp_hat_new)
556- # error = self.solve_lu(LU_real, -F) #* (h * gamma_hat)
557- # # y1 = Y((ride_data.s-1)*ride_data.n+1:ride_data.s*ride_data.n,1);
558- # # t1 = t0+h;
559- # # yp1 = ride_data.mu(1)*(kron(ride_data.v',eye(ride_data.n))*Yp - ride_data.b0*yp0);
560- # # g = feval(IDEFUN,y1,yp1,t1);
561- # # ride_data.nfun = ride_data.nfun + 1;
562- # # r = -(ride_data.U\(ride_data.L\(ride_data.P*g)));
563-
564- # LU_real = self.lu(MU_REAL / h * Jyp + Jy)
565-
566- # error = -self.solve_lu(LU_real, self.fun(t_new, y_new, yp_hat_new))
567- # print(f"error: {error}")
568- # # error = -self.solve_lu(LU_real, self.fun(t_new, y_hat_new, yp_hat_new))
569-
548+ # # LU_real = self.lu(MU_REAL / h * Jyp + Jy)
549+ # error = self.solve_lu(LU_real, -F)
550+ # print(f"yp_new: {yp_new}")
551+ # print(f"yp_hat_new: {yp_hat_new}")
552+ # print(f"error_ODE_mass: {error_ODE_mass}")
553+ # print(f"error: {error}")
554+ # print(f"")
570555
571556 error_norm = norm (error / scale )
572557
0 commit comments