@@btizzlenba7705 find a quality study group and take advantage of office hours. You'll be way more productive with your time and make some friends along the way
Code for the animations are available on my github page, which is linked in the description. The motion picture was done using the manim library, which I may put out a video later.
The solve_ivp() function allows you to input the simulation time (mine is set [0,10] meaning from 0 to 10 seconds) and also the evaluation time (mine is set from 0 to 10 seconds, evaluated 30 times per second). You can increase the 10s to a larger value like 25. You could also change the value of "b" (damping coefficient) to perhaps 5 to make the system lose energy faster
@olsea1229 which file are you editing? Is it SpringMass/animate.py ? If so, only lines 25 and 26 should need editing to change the .gif file time duration
@@logandihel I changed it like this: sol = solve_ivp(spring_mass_ODE, [0, 30], (x0, x_dot0), t_eval=np.linspace(0,10,10*30)) but the time of the gif animation has not changed
The energy of the system is constant only if friction is ignored. Set b to zero and you should see the energy is constant, perhaps with small changes due to numerical integration errors
@@logandihel Ahh it oscilates... Thanks anyway! I was searching a bit and I think it’s common in the way it solves the ODE right? I was doing the kepler problem potencial to see orbits and again the energy driftt. I guess now i’m reading a book about numerical method for python... I thought this day will never come!
I was wondering if you can change the setup to a horizontal one therefore getting rid of potentiel energy Vm and only leaving the elastic potentiel energy of the spring and starting the simulation after an initial displacement of the mass m
Yes, that would totally work! That would be a great exercise for you. In fact, you could generalized the spring mass system to oscillate back and forth about any angle!
@@logandihel Yeah, I did that. I'm not sure what actual function you're using. I have another route that is working for me now, but it's a bit messy and requires a bit of setup. Your method seems cleaner and simpler unless you've abstracted way much of the details.
I'd recommend copying the code directly from my github page (link in description), and if that doesn't work you can submit an issue on my RUclips GitHub repository. It's also possible you're missing a required package, or the packages have changed versions since I posted the video
Great question! It doesn't really matter how we define x, as long as we are consistent. If you want, simply replace x with (-y) in each equation, so that y positive is up. Fun fact: In aerospace literature, it is actually more common to define z to be down. This is just a convention
In the foundation of robotics course, the z-axis was always the axis of motion. Thanks for your video. I have been studying lagrangian for the past week and the available videos are long and complex. Although yours is short, it contains a lot of information and I keep watching so I enhance my understanding and then move into complex topics.
@mohamedeljahmi2454 good luck! I have some other videos for deriving equations of motion for the pendulum using Lagrangian mechanics, which is a great example of a nonlinear system
The code you provide on your GitHub, is not working on my VS code.... So kindly tell me that which libraries or modules I have to install in VS code like minam, ffmpeg etc....
Not true, when he called scipy.integreate.solve_ivp() it numerically solves the "initial value problem" by running a time-step by time-step simulation. It does not use the analytical solution of the ODE. The description of the function says "This function numerically integrates a system of ordinary differential equations given an initial value". There is nothing more fitting of the name simulation than that.
@@vectoralphaSeceh they both have their benefits, but i wouldnt choose python for that reason. It is just a standard for this kind of analysis, javascript being a little more tedious to use directly
Python with jupyter notebooks is definitely a language used for science calculations. Other common softwares are maple, matlab and mathematica but python has the benefit of being free and having a huge amount of libraries. I would never use JavaScript for science computations nor have I have ever seen this case.
As someone looking into studying Computational Science and Engineering, this is some incredible stuff, thank you
Way to underrated... INSANELY underrated... Keep going 👍👍
Thanks so much! Been busy with finals and applying to grad school. Should get some new videos out in a couple weeks
@@logandihel cool stuff. I'm also an engineering student (optical). Any tips on survival?
@@btizzlenba7705 find a quality study group and take advantage of office hours. You'll be way more productive with your time and make some friends along the way
That super cool! Your work is so great, thanks and please keep updating it
spectacular video
Thanks for the great work!
Beautiful example 🤙🏻
Hi logan...pls tell how did you made that motion picture of oscillating spring mass system
Code for the animations are available on my github page, which is linked in the description. The motion picture was done using the manim library, which I may put out a video later.
Very cool animations!
Another question is why on the diagram of speed versus time the speed does not tend to zero, it remains somewhere around 0.5?
The velocity tends to zero when friction is added. Otherwise, no energy is lost and the velocity is sinusoidal
inconsistent mic volume but interesting videp. GJ
You earned my sub!
Cool video.
How to increase the oscillation time so that the pendulum swings to a complete stop?
The solve_ivp() function allows you to input the simulation time (mine is set [0,10] meaning from 0 to 10 seconds) and also the evaluation time (mine is set from 0 to 10 seconds, evaluated 30 times per second). You can increase the 10s to a larger value like 25.
You could also change the value of "b" (damping coefficient) to perhaps 5 to make the system lose energy faster
@@logandihel I changed the value but the duration of the GIF image remained the same. What can be done?
@olsea1229 which file are you editing? Is it SpringMass/animate.py ? If so, only lines 25 and 26 should need editing to change the .gif file time duration
@@logandihel I changed it like this: sol = solve_ivp(spring_mass_ODE, [0, 30], (x0, x_dot0),
t_eval=np.linspace(0,10,10*30))
but the time of the gif animation has not changed
@@olsea1229 change t_eval to np.linspace(0,30,30*30)
Ey! I have a question, It’s the energy of the system constant? I mean, silly question, but when I plot E = T + V, it’s not constant...
The energy of the system is constant only if friction is ignored. Set b to zero and you should see the energy is constant, perhaps with small changes due to numerical integration errors
@@logandihel Ahh it oscilates... Thanks anyway! I was searching a bit and I think it’s common in the way it solves the ODE right? I was doing the kepler problem potencial to see orbits and again the energy driftt. I guess now i’m reading a book about numerical method for python... I thought this day will never come!
I was wondering if you can change the setup to a horizontal one therefore getting rid of potentiel energy Vm and only leaving the elastic potentiel energy of the spring
and starting the simulation after an initial displacement of the mass m
Yes, that would totally work! That would be a great exercise for you.
In fact, you could generalized the spring mass system to oscillate back and forth about any angle!
@@logandihel Thanks for responding, I'll surely try it
Awesome video! How are you outputting the latex?
To view to the latex in the Jupyter notebook you need to run the command
init_vprinting
Which I did in my import statements at the top of the program.
@@logandihel Yeah, I did that. I'm not sure what actual function you're using. I have another route that is working for me now, but it's a bit messy and requires a bit of setup. Your method seems cleaner and simpler unless you've abstracted way much of the details.
I'd recommend copying the code directly from my github page (link in description), and if that doesn't work you can submit an issue on my RUclips GitHub repository. It's also possible you're missing a required package, or the packages have changed versions since I posted the video
Why is positive x towards the ground and negative x towards the ceiling?
Great question! It doesn't really matter how we define x, as long as we are consistent. If you want, simply replace x with (-y) in each equation, so that y positive is up.
Fun fact: In aerospace literature, it is actually more common to define z to be down. This is just a convention
In the foundation of robotics course, the z-axis was always the axis of motion. Thanks for your video. I have been studying lagrangian for the past week and the available videos are long and complex. Although yours is short, it contains a lot of information and I keep watching so I enhance my understanding and then move into complex topics.
@mohamedeljahmi2454 good luck! I have some other videos for deriving equations of motion for the pendulum using Lagrangian mechanics, which is a great example of a nonlinear system
The code you provide on your GitHub, is not working on my VS code.... So kindly tell me that which libraries or modules I have to install in VS code like minam, ffmpeg etc....
You need ffmpeg to produce the .gif file. Follow instructions on my github here: github.com/logdog/RUclips/blob/main/README.md
nice video!
Did you using manim to animate mass pendulum at intro?
Yes, I used the Manim Community version in Python
how can we apply gas pressure in spring mass?
You can model air resistance by modifying the ODE. Typically the drag is proportional to the square of velocity.
My man!
Logan, are you using VS Code as IDE?
Yes, with the Jupyter Notebook extension
❤❤✔✔
dayum
Please make another videos ❤
Done! Learn how to animate a spring mass system here: ruclips.net/video/mX1VDOY6wVc/видео.html
Is this what we study physics for
I need the next video :(
Done! Learn how to animate a spring mass system here: ruclips.net/video/mX1VDOY6wVc/видео.html
You cannot call this a simulation, this is only a visual representation of the solution of a problem analitically solved...
Not true, when he called scipy.integreate.solve_ivp() it numerically solves the "initial value problem" by running a time-step by time-step simulation. It does not use the analytical solution of the ODE.
The description of the function says "This function numerically integrates a system of ordinary differential equations given an initial value". There is nothing more fitting of the name simulation than that.
I really don't like Python and would prefer e.g. JavaScript/TypeScript, but the video quality is excellent nonetheless!
why? Python is way better than JavaScript to write. I could not stand to write in JavaScript.
@@vectoralphaSeceh they both have their benefits, but i wouldnt choose python for that reason. It is just a standard for this kind of analysis, javascript being a little more tedious to use directly
Python with jupyter notebooks is definitely a language used for science calculations. Other common softwares are maple, matlab and mathematica but python has the benefit of being free and having a huge amount of libraries. I would never use JavaScript for science computations nor have I have ever seen this case.
I’ve never met anybody who uses js/ts for computation. If you want to get into physics simulation stick to python/Fortran/matlab etc
Really? “Why don’t we double down on dynamic types. Just really get into weird implicit conversions, that’ll really make this maths easier”
You need a better microphone.
In complex system of more freedom coordinate Python is useless, C/ and C++ is better
Agreed, but Python is more accessible for a RUclips audience. MATLAB is what I typically use as an engineer for quick simulations