private static void Test_Runge_Kutta_5() { ODE_1_RK5 RG5 = new ODE_1_RK5(x0, y0, LW81.f); y1 = RG5.Solve_with_Precision(x0, y0, x1, eps); err = Math.Abs(S1 - y1); SW.WriteLine("\r\n MAC_ODE_Order_1_RungeKutta_5:"); SW.WriteLine($" {x1,8:F4} {y1,12:F9} {S1,12:F9} {err,11:E1} {RG5.iter}"); }
//static void Main(string[] args) //{ // x0 = 0.5 * Math.PI; x1 = 4.0; y0 = 1.0; S1 = LW81.Y(x1, x0, y0); // Test_Eulers_Method(); // Test_Taylor_Method(); // Test_Runge_Kutta_2(1); // Test_Runge_Kutta_2(2); // Test_Runge_Kutta_2(3); // Test_Runge_Kutta_3(1); // Test_Runge_Kutta_3(2); // Test_Runge_Kutta_3(3); // Test_Runge_Kutta_4(1); // Test_Runge_Kutta_4(2); // Test_Runge_Kutta_4(3); // Test_Runge_Kutta_5(); // SW.Close(); //} static void Main(string[] args) { x0 = 0.5 * Math.PI; x1 = 4.0; y0 = 1.0; S1 = LW81.Y(x1, x0, y0); //Eulers_Method ODE_1 EM = new ODE_1_EM(x0, y0, LW81.f); Test_ODE_Method(EM, "MAC_ODE_Order_1_Eulers_Method"); //Taylor_Method ODE_1 TM = new ODE_1_TM(x0, y0, LW81.f, LW81.fx, LW81.fxx, LW81.fy, LW81.fyy, LW81.fxy); Test_ODE_Method(TM, "MAC_ODE_Order_1_Taylor_Method"); //RungeKutta_2 ODE_1 RG2 = new ODE_1_RK2(x0, y0, LW81.f, 1); Test_ODE_Method(RG2, "MAC_ODE_Order_1_RungeKutta_2"); RG2 = new ODE_1_RK2(x0, y0, LW81.f, 2); Test_ODE_Method(RG2, "MAC_ODE_Order_1_RungeKutta_2"); RG2 = new ODE_1_RK2(x0, y0, LW81.f, 3); Test_ODE_Method(RG2, "MAC_ODE_Order_1_RungeKutta_2"); //RungeKutta_3 ODE_1 RG3 = new ODE_1_RK3(x0, y0, LW81.f, 1); Test_ODE_Method(RG3, "MAC_ODE_Order_1_RungeKutta_3"); RG3 = new ODE_1_RK3(x0, y0, LW81.f, 2); Test_ODE_Method(RG3, "MAC_ODE_Order_1_RungeKutta_3"); RG3 = new ODE_1_RK3(x0, y0, LW81.f, 3); Test_ODE_Method(RG3, "MAC_ODE_Order_1_RungeKutta_3"); //RungeKutta_4 ODE_1 RG4 = new ODE_1_RK4(x0, y0, LW81.f, 1); Test_ODE_Method(RG4, "MAC_ODE_Order_1_RungeKutta_4"); RG4 = new ODE_1_RK4(x0, y0, LW81.f, 2); Test_ODE_Method(RG4, "MAC_ODE_Order_1_RungeKutta_4"); RG4 = new ODE_1_RK4(x0, y0, LW81.f, 3); Test_ODE_Method(RG4, "MAC_ODE_Order_1_RungeKutta_4"); //RungeKutta_5 ODE_1 RG5 = new ODE_1_RK5(x0, y0, LW81.f); Test_ODE_Method(RG5, "MAC_ODE_Order_1_RungeKutta_5"); SW.Close(); }