verlet-integration

Solar System Simulation Project (velocity verlet help)

▼魔方 西西 提交于 2020-01-01 17:14:14
问题 For my modelling and simulation class project, I want to simulate a solar system. I'm starting with just a star (sun) and a planet (earth), but I'm running into a few problems already. I've spent some time now just reviewing and learning about different formulas and way to simulate how the planet's orbits will be affected by the star and surrounding objects. I want to use velocity verlet and eventually look into the n-body problem. I'm having numerous issues with my velocity verlet function.

The time-corrected Verlet numerical integration formula

我只是一个虾纸丫 提交于 2019-12-23 09:47:49
问题 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. Formula by Johnathan Dummer: x1 = x + (x – x0) * dt / dt0 + a * dt^2 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. Suggested correct formula by a

MATLAB: Verlet Algorithm -

时光毁灭记忆、已成空白 提交于 2019-12-11 08:05:14
问题 Below is my code for the Verlet function, to be called from my main script. % verlet.m % uses the verlet step algorithm to integrate the simple harmonic % oscillator. % stepsize h, for a second-order ODE function vout = verlet(vinverletx,h,params) % vin is the particle vector (xn,yn) x0 = vinverletx(1); x1 = vinverletx(2); % find the verlet coefficients (F=0) D = (2*params(1))+(params(3)*h); A = (2/D)*((2*params(1))-(params(2)*h^2)); B=(1/D)*((params(3)*h)-(2*params(1))); x2 = (A*x1)+(B*x0);

Verlet algorithm implementation in Python

本秂侑毒 提交于 2019-12-11 04:35:16
问题 I have problem with implementation of verlet algorithm in Python. I tried this code: x[0] = 1 v[0] = 0 t[0] = 0 a[0] = 1 for i in range (0, 1000): x[i+1] = x[i] - v[i] * dt + (a[i] * (dt**2) * 0.5) v[i] = (x[i+1] - x[i-1]) * 0.5 * dt t[i+1] = t[i] + dt But it is not working properly. What is wrong? I am looking for general code for Verlet algorithm. 回答1: Your question isn't very clear, but there are a few sources of error in your code. Eg, for i > 0 x[i+1] = x[i]-v[i]*dt+(a[i]*(dt**2)*0.5)

Verlet integrator + friction

女生的网名这么多〃 提交于 2019-12-10 22:16:13
问题 I have been following "A Verlet based approach for 2D game physics" on Gamedev.net and I have written something similar. The problem I am having is that the boxes slide along the ground too much. How can I add a simple rested state thing where the boxes will have more friction and only slide a tiny bit? 回答1: Just introduce a small, constant acceleration on moving objects that points in the direction opposite to the motion. And make sure it can't actually reverse the motion; if you detect that

Time Corrected Verlet Integration and too big timesteps

人走茶凉 提交于 2019-12-06 06:35:18
问题 i use a Time Corrected Verlet Integration found here: http://www.gamedev.net/page/resources/_/technical/math-and-physics/a-simple-time-corrected-verlet-integration-method-r2200 But when my ball is on a wall (horizontal wall, ball upon it and the acceleration is directed down) for a some time, my game cannot recognize the collision in the right way and the ball goes down. If I put a fixed cap to deltatime like 1/60 it seems to work. I think the problem are too big timesteps. But the time

Solar System Simulation Project (velocity verlet help)

别说谁变了你拦得住时间么 提交于 2019-12-04 17:38:00
For my modelling and simulation class project, I want to simulate a solar system. I'm starting with just a star (sun) and a planet (earth), but I'm running into a few problems already. I've spent some time now just reviewing and learning about different formulas and way to simulate how the planet's orbits will be affected by the star and surrounding objects. I want to use velocity verlet and eventually look into the n-body problem. I'm having numerous issues with my velocity verlet function. Sometimes it acts as if it's making earth orbit normally and then it " warp drives" earth off into some

Time Corrected Verlet Integration and too big timesteps

耗尽温柔 提交于 2019-12-04 10:25:50
i use a Time Corrected Verlet Integration found here: http://www.gamedev.net/page/resources/_/technical/math-and-physics/a-simple-time-corrected-verlet-integration-method-r2200 But when my ball is on a wall (horizontal wall, ball upon it and the acceleration is directed down) for a some time, my game cannot recognize the collision in the right way and the ball goes down. If I put a fixed cap to deltatime like 1/60 it seems to work. I think the problem are too big timesteps. But the time corrected verlet integration is done to avoid too big timesteps, it is right? If yes, why I need the time