Lagrangian Mechanics | Spring Mount Pendulum (with Python and sympy)

preview_player
Показать описание
A pendulum is mounted to a point that has a vertical moving spring. What is the equation of motion?

Here is the code for the animation
Рекомендации по теме
Комментарии
Автор

this is gold. thank you immensely for sharing

ChaineYTXF
Автор

You can easily call this "physics for coders" because it is a very good example of going from differential formulas to numeric calculations.
Thanks, by the way.

teenspirit
Автор

It would be nice to have some phase space plots for some interesting values of k and R. And maybe a waterfall plot of the spectrum of the waveforms. And maybe add some dissipation.

bendunselman
Автор

I doesn't hurt to go over it again says the best professor

smalltimeprepper
Автор

You should be a hand model! Thanks for making this im glad i found you.

smalltimeprepper
Автор

" The total energy is constant so I am pretty happy " :)

Electromowls
Автор

Need help.

import sympy as sp

t = sp.symbols('t')
theta = sp.symbols('theta', cls = sp.Function)
theta = theta(t)
theta_dot = sp.diff(theta, t)
theta_dot

After running, it does not show anything at all. So, I add print(theta_dot)
It shows something like' Derivative(theta(t), t) ' instead of d(theta)/dt.

jtong
Автор

Hey, excellent! I like colabs, and I haven't experiments with the symbols yet. Something to look forward to. :)

fizixx
Автор

doesn't vpython have a helix? would be so much nicer for a spring ;)

by the way, sp.diff(L, thetadot, t) also does what sp.diff(sp.diff(L, thetadot), t) does and in my opinion it takes nothing away from the readability, on the contrary, I think it's clearer to see what it does.

marcrindermann