Context:
I'm trying to make a simulation of a box that you can apply force to the top and it will oscillate back and forth until the energy in the system reaches equilibrium again.
Visual representation of how I imagine the system:
What I want to visualise:
My simulation is simply going to draw a graph of the angle over time.
maybe it would look a bit more like this?
Proof of work:
I don't want to add much fuss here so will strip out all detail but essentially I had tried starting with a pendulum due to the oscillatory nature of the system. I then added viscous damping. I basically had a graph of a pendulum and was happy with it. But then I realised, my system is totally different with centre of mass, torque, momentum, changing pivot points.
Thoughts on the problem:
- The potential energy from the finger is given in one initial short impulse.
- The finger has potential energy.
PE = 1.0
(Where potential energy is 100% of the energy in the system) (Is that a good idea?) - The box has a:
height = 50cm
,width = 10cm
mass = 2kg
- The ground has a friction which locks the system in place (so, no need to worry about it)
- Air resistance:
air_resistance = ? # Whatever makes it look cool in the graph
Question:
- What kinds of things do I need to think about in terms of the equations
- How do i port the equations over so that it's all as a function of time.
I think that getting help with this problem will allow me to grasp future versions of similar problems as I've been struggling with this for a whole month now and I feel like i'm close to giving up which is really frustrating me. I even feel I'm at a point where i'm happier reading equations but converting them to things as functions of time whereby one loop of the code will write out the new state of the system is getting complex for me.
If you feel you need to answer with code, that's totally fine (I'm writing this in python but am good with most languages)!