且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过Runge-Kutta 4传递硬编码微分方程

更新时间:2022-06-26 23:59:20

您在RK4实现中犯了一个经典错误:使用两个变体来定位要乘以dt的乘法,您将同时使用这两个.

You are doing a classical error in the RK4 implementation: Having two variants to position the multiplication with dt to choose from, you are using both.

k2 = dt*f(t+0.5*dt, y+0.5*k1)

k2 = f(t+0.5*dt, y+0.5*dt*k1)

并类似地在该算法的其他行中.

and analogously in the other lines of the algorithm.