Updated specific locations to be searchable, take a look at Las Vegas as an example.

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

5
Stumped on how to make my 2D spring not constantly oscilate further
Post Flair (click to view more posts with a particular flair)
Post Body

I am trying to simulate a spring in a time-stepped manner. Mostly to sus out the correct order of operations, where to apply delta time, how to apply drag.

As such I have set up, with the new Desmos functions features, a time generator that randomly applies latency at each step and a velocity and y position generator. I have plugged in hookes law into the velocity update method.

Initially I set the y position to 1 and give it 0 velocity. There is not supposed to be gravity or anything in this simulation. Only the spring and eventually drag. It is suppose to oscillate around and eventually settle on 0.

I update velocity with V = -40 * y ^2 * sign(y) * dt each step.

This is the graph I get. The problem is every time I set up my constants the result is a simulation that grows in energy. Rather than settling on 0 it oscillates further and further away from 0. I am not sure why. Am I missing something about hookes law or how I am applying it?

I maybe wouldn't be surprised if it oscillated to the same point every time... but growing each time?? Thats a surprise.

Here is the graph

https://preview.redd.it/u4vptv9ozbsa1.png?width=1416&format=png&auto=webp&s=198be62f4c1b22561f6d021a2d168ac0d4127810

Author
Account Strength
90%
Account Age
6 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,445
Link Karma
938
Comment Karma
452
Profile updated: 2 days ago
Posts updated: 1 day ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago