时间校正的Verlet数值积分公式 [英] The time-corrected Verlet numerical integration formula

查看:226
本文介绍了时间校正的Verlet数值积分公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Johnathan Dummer在网络上有一个常用的 verlet-integration 公式,称为时间校正的Verlet.但是,我读过几篇论坛文章,在某些情况下人们会得到奇怪或意外的结果.

There is a commonly used verlet-integration formula on the web by Johnathan Dummer, called Time-Corrected Verlet. However I've read several forum posts, that people get weird or unexpected results with it in certain conditions.

Johnathan Dummer的公式:

Formula by Johnathan Dummer:

x1 = x + (x – x0) * dt / dt0 + a * dt^2

还有一个 stackoverflow答案,其中指出达默的时间校正公式已被破坏,发帖人展示了自己的答案.推导为正确的推论.

There is also a stackoverflow answer, which states that Dummer's time-corrected formula is broken and the poster presents his own derivation as the correct one.

stackoverflow答案建议正确的公式

Suggested correct formula by a stackoverflow answer

x1 = x + (x – x0) * dt / dt0 + a * dt * (dt + dt0) / 2

好吧,Dummer的公式真的被打破了吗?如果是,则海报的派生更好吗?

PS:Dummer在他的网站上使用Verlet积分公式x1 = x - x0 + a * dt^2而不是正确的x1 = 2x - x0 + a * dt^2也是很奇怪的.

PS: It is also weird that Dummer uses the verlet integration formula x1 = x - x0 + a * dt^2 on his website instead of the correct x1 = 2x - x0 + a * dt^2.

推荐答案

维基百科页面 Verlet积分-非恒定时差给出了两个公式,未引用.我还没有亲自检查过派生关系,但第二个改进公式的理由似乎很合理.

The wikipedia page Verlet integration - Non-constant time differences presents the two formula, without referenced. I've not checked the derivation myself but the reasoning for the second improved formula looks sound.

我已经下载了Dummer的电子表格,并修改了其中一个公式以使用更正.结果要好得多.

I've downloaded Dummer's spreadsheet and modified one of the formula to use the correction. The results are much better.

确切的结果显示为黄色,我们看到仅使用具有波动帧率的普通Verlet算法是不好的. Dummer的红色时间校正变体相当不错,但有些偏离.具有改进的校正功能的深绿色版本要好得多.

The exact results are in yellow, we see that just using the normal Verlet algorithm with fluctuating frame-rate is bad. Dummer's time-correct varient in red is pretty good, but a little off. The dark green version with the improved correction is much better.

对于具有二次解法的重力弹丸,您可能会发现改进的版本是准确的.当度数更高时,它会偏离真实路径,可能值得测试一下我们是否仍能获得更好的近似值.

For projectiles under gravity which has a quadratic solution you may find that the improved version is exact. When the degree gets a bit higher it will vary from the true path and it might be worth testing to see if we still get a better approximation.

对sin曲线进行相同的计算表明,改进的方法要好得多.在这里,时间正确的Verlet漂移了很多.改进的版本更好,仅比准确答案要差一点.

Doing the same calculation for a sin curve shows the improved method is considerably better. Here Time-correct Verlet is drifting quite a bit. The improved version is better, only a little bit off the exact answer.

对于PS.请注意,如果您在TCV公式中设置dt = dt0

For the PS. Note that if you set dt=dt0 in the TCV formula

x1 = x + (x – x0) * dt / dt0 + a * dt^2

你得到

x1 = x + x – x0 + a * dt^2
   = 2 x – x0 + a * dt^2

原始Verlet公式.

the original Verlet formula.

这篇关于时间校正的Verlet数值积分公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆