Pendulum equations of motion and animations #10
Replies: 45 comments 17 replies
|
Hello all, not sure about you but this was my first time really using Julia and Pluto coding and there is definitely a learning curve, but I am starting to get the hang of it. I am learning the functionality and have a better understanding; credit to the walk through / tutorial videos by Professor Cooper. Brainstorming ideas for the rotating pendulum problem that we are given for project 01, here are some of my initial thoughts. θ'' = -(g/L) sin(θ) + Ω² sin(θ) cos(θ) Ω is still a variable and we do not have a set value for it, just that it is constant. It would be interesting to look at how increasing or decreasing omega changes other components of the problem. When looking at this problem we could also take into account damping effects because of the nature of the rotation. Adding a damping coefficient somehow would be needed for an accurate model of the pendulum. Maybe something like this. ω' = -(g/L) sin(θ) - c*ω Could we also apply energy conservation and disregard damping? Big questions for this project:
Some other Visualization questions:
These questions are open forum for folks here but don't necessarily need to be answered. They are also posed for me to come back and refer to when working through the project. |
|
Very interesting video. I think this is a good start to project 1 as in how to code and graph things with Julia and create animations for pendulums. I think the tricky part of this project however will be trying to model this in 3D. Will it be harder to visualize in Julia compared to something like MATLAB? Does this affect what the equations of motion look like? @danny-kruzick idea of using symbolics.jl and ode to solve the equation of motion seems like a great idea, have the code rearrange and solve the Lagrange and equation of motion for us and just having to plot it. Will definitely look into this idea more, as after figuring out all the possible equations of motion needed, we can have Julia solve it for us! |
|
After watching the base pendulum video and hearing Professor Cooper mention that you could add a mass and moment to the system, I wanted to try that out. I added an explicit mass for the bob so I could compute quantities like angular momentum and torque, not just angle and angular velocity. From there, I calculated angular impulse by integrating torque over time, which let me numerically verify the impulse–momentum relationship in a rotating system. That part was interesting because it connected the simulation directly to fundamental mechanics instead of just visual motion. I also introduced a sudden “kick” using a callback to simulate an impulsive force at a specific time. This creates an instantaneous jump in angular velocity, which makes the energy and angular momentum change abruptly. It was neat to see how cleanly the solver handled the discontinuity and how clearly the phase-space trajectory shifted to a new energy orbit. Adding that event turned the pendulum from a purely conservative system into something that could model real external inputs. Professor Cooper, it may be neat to see a driven pendulum system or maybe a system with multiple pendulums. https://github.com/ericd3030/Dynamics-2026-DILLNER.jl/blob/main/07_pendulum-equations.jl |
|
For our project since we have both rotational and linear velocity of this point mass I assume our kinetic energy term must have two separate terms to account for both. I am under the impression this is likely in the form of 1/2m(V_lin)^2 + 1/2I&omega^2 since that should account for both of those terms of the linear and rotational. Would it then make sense to use point mass, of mr^2 and then account for the r through use of theta 1 and 2? That was the approach that made the most sense to me but I could be missing something. |
|
I've only experimented with the simple pendulum in Julia so far, but looking ahead to the rotating pendulum project, I plan on expanding on what you showed in the video to incorporate the fictitious forces introduced by the rotating reference frame. I'm excited to test the functionality of Symbolics on the more complicated derivatives, but I also want to double-check the results by hand! As for what you could showcase next, I think it would be super helpful to see an example of setting up a Lagrangian in a rotating/non-inertial reference frame, since we've only worked with inertial frames (as y(t) was constant in the translating pendulum example from the first video). I also think it would be fun to explore new and exciting ways of creating plots and animations in Julia! Finally, it could also be interesting to see another comparison between Lagrangian mechanics and classical/Newtonian mechanics to show which approach is more useful for different types of problems. |
|
I was able to animate the dampening of the pendelum. After my review of the process there still looks to be a slight angle remaining even as it reaches its final state. This is interesting because as I was doing research I was trying to understand a real life example of dynamics and it seems I keep find amusement park comparisons. the pendulum is very much like the swing ride at an amusement park. I also noticed there is a new component that gets added when we include this dampening. Feel free to try this on your own. |
|
I messed around with Increasing the initial angle of the pendulum which significantly affects both the distance traveled and the nature of its motion. For small angles, the pendulum behaves like a simple harmonic oscillator, and the motion is normal sinusoidal with a predictable frequency. A larger initial angle increases the total energy, causing the bob to travel a greater arc length and reach higher velocities near the bottom of the swing. The period also increases slightly with larger amplitudes, meaning the pendulum swings more slowly than predicted by the linear approximation. I tried changing the length of the pendulum which affects its frequency. Increasing the length decreases the frequency and increases the period, resulting in slower oscillations. At the same time, a longer pendulum produces a larger arc length for the same angular displacement because the linear distance traveled is proportional to the radius so a longer pendulum covers more physical distance but does so more slowly. A shorter pendulum oscillates faster and travels a shorter arc length. A system with damping or multiple pendulums can be showcased next to add complexity to the model. |
|
This has been an interesting project. Using some of this code as a basis my team was able to get me from this first graph and gif all the way to figuring out some really cool complex graphical representations of motion like the last gif (I can't take much credit for that, shout out to my group for the good collab effort). Like others in this chat, I think this has been an interesting learning experience with the Julia code. I think I am beginning to feel a little better with that and then also with using the copilot agent to use this coding language as a tool for solving complex problems. I think I'm still struggling with understanding the best way to use GitHub but I'm looking forward to the next ones. (Unsure if these gifs will load right but let's see!) |
|
When using python, I've only ever used matplotlib for simple graphs and visuals. making the moving pendulum visualization is a very cool functionality! |
|
I think the ability to animate is interesting and significantly outdoes anything else I've worked on for plotting. It has so many applications as well to allow for future improvement in work. |
|
I agree with what my groupmate @ZakMatt0802 when he said about needing both kinetic‑energy terms since our point mass has linear and rotational motion. For what we’ve actually were able to complete for the project, our group generated the 2D plots from both the Lagrange and least‑action equations of motion and built a 3D plot of the trajectory, which set up the system nicely from the help of the work done by the others. Now that we’re looking at what to showcase next, I think the next steps could be a full animation of the rotating pendulum with angle and angular‑velocity tracking, maybe energy‑vs‑time to show numerical conservation, a Lagrange vs least‑action comparison, or even a phase‑space plot. |
|
After Project 1, I found that animating is very simple into a GIF. Usually, I work in MATLAB where it takes some time, but I many use Julia for future coding projects which might assist with Fortran coding or find a medium for FEA. Glad this was the first project, and curious about the full capabilities for 3D modeling and FEA. |
|
Utilizing these concepts for project 1, I first created a simple pendulum motion using the code provided. My group got familiar with the concepts and practicality of this application. Using the julia coder helper we were able to model a three dimensional rotating pendulum where we could track the motion. By using differing angular speeds we were able to check the behavior of each system. In the future it would be interesting to visualize different equations of motion, not just the simple ones, to give a better idea of how pluto/julia works with dynamics. |
|
This discussion was an excellent way of demonstrating how the combination of physics, coding, and plotting makes pendulum dynamics much easier to digest. After toying around with Julia animations I was able to find the relationships and saw the connections between hte equations of motion to the actual behaivior of the system. A key takeaway is the advantage of the Lagrangian approach, especially for more complex systems like the rotating pendulum, where additional effects like rotation and centrifugal forces come into play. It also seems valuable to explore visual tools like phase portraits and energy plots to better understand system behavior. Overall this was a great lesson showing the power of using computational tools and how they can improve the intuation about dynamic systems. |
|
I have used similar concepts, for example during project 1, using the copilot assistant to help solve the pendulum ODE. I like how easy Julia is to work with after you get used to it and that you are able to add a lot of ways to change the animations, like sliders for speeds, multiple pendulums attached to each other, and modeling the 3D motions. For solving the pendulum ODE, I noticed that for small initial angles the motion is sinusoidal, but as you increase the angle the nonlinear term matters more and the solution no longer is a simple harmonic solution. Using the animation and possibilities to modify the animation really makes it easy to understand the deviations and changes to the motion over time. |
|
I liked how the notebook combined the symbolic derivation with the animation because it made it easier to connect the physics to the actual motion. One thing I tried was comparing the phase plot of angular velocity vs. angle to the animation itself, and it was interesting seeing how the system speeds up near equilibrium and slows near the turning points. The governing equation looked especially clean when written in the form θ¨+Lg = sin(θ)=0 |
|
I tried working through the pendulum notebook and messing around with the equations a bit using GitHub Copilot. It was actually pretty nice for setting up the animation and making quick changes, especially for tracking angle and angular velocity at the same time. The basic pendulum behaves like you would expect, but once you tweak initial conditions or time stepping, you can start to see where things drift or get a little unstable. I also played a bit with extending it toward a rotating pendulum, and that is where it gets more interesting. Adding rotation or forcing changes the motion a lot, and it feels closer to a real dynamics problem instead of just a textbook case. For what to showcase next, I think it would be cool to look at phase space plots or energy over time, not just the animation. Even something simple like comparing stable and unstable motion would add a lot. |
|
I tried working through the pendulum notebook and changing some of the initial conditions to see how the motion changed over time. At smaller angles the pendulum behaved close to simple harmonic motion, but at larger angles the motion became much more nonlinear. For Project 1, my group also used similar methods to model a rotating pendulum, and it was helpful being able to track the angle and angular velocity alongside the animation. For future examples, I think it would be cool to see energy vs. time plots with the animations, especially for more complex systems like the rotating pendulum. |
|
Reflecting back on project one now this was a really good starting point to completing the project. It begins with helping us understand connecting the physics to visulization. One thing that I thought about when beginning the project was how the scenario scales when the rotating pendulum moves. The setup of the equations won't change when going to 3D, but motion in one direction will begin to affect the others. So instead of having a single variable driving the motion, equations will depend on multiple variables. |
|
This video was a helpful introduction to both the physics and the Julia workflow we needed for Project 1. Seeing the pendulum animation update alongside angle and angular velocity plots made the equations of motion much more intuitive and helped connect the Lagrangian formulation to the system’s actual behavior. I experimented with changing parameters like the initial angle and pendulum length. For small angles, the motion behaves close to simple harmonic motion, but as the angle increases the nonlinear effects become more noticeable, with higher velocities near the bottom of the swing and a slightly longer period. Changing the length affected the frequency as expected, with longer pendulums oscillating more slowly. Looking ahead to the rotating pendulum, many of the ideas discussed such as including both linear and rotational kinetic energy terms, adding damping, and using Symbolics.jl to derive equations of motion seem especially useful. I also think visualizations like phase portraits, energy vs. time plots, or even 3D animations would be valuable additions to better understand how rotation and non‑conservative effects change the system dynamics. |
|
When I first started using Julia, I was a little worried because I was afraid that a new language would require a steep learning curve. Julia's workflow and syntax is very similar to the tools we have used before however. The Copilot assistant was very helpful in getting started and learning syntax, and learning to animate graphs was not too difficult. The animated graphs provide a really nice visualization tool for displaying kinematic behavior that might be harder to visualize without. I really like Julia's Symbolics when comparing to Python, which we tended to use in previous courses. In Python you had to use other libraries such as SymPy to work with such symbolics. Using these concepts helped us create a swinging-frame pendulum with parameterization. |
|
The pendulum problem was very interesting as it does not seem like a difficult problem. For me the big challenge is coding as I am very used to the math portion, not the coding portion. I think it would be interesting to see the pendulum with another arm and what that would do to the system. I personally would like to see a spring added to a pendulum to see what it would do if the spring was attached to the column to restrict the movement and then finding the damping coefficient of said spring at which point it would be critically damped. Looking back on the project one of the big speed bumps was definitely just the julia and pluto coding. Since I am not familiar with it, it is like writing with my left hand. |
|
The transition to using Julia and Pluto for these dynamic simulations is a big jump, but seeing the workflow between AI-assisted coding and engineering physics makes the process feel much more manageable. For the rotating pendulum in Project 01, I've been thinking about how that constant base rotation (Ω) changes the fundamental behavior of the system compared to a standard 2D pendulum. I’m particularly interested in how the "effective" potential energy changes when we account for the centrifugal terms. As the rotation speed increases, we should see the equilibrium points shift—where the pendulum might actually prefer to hang at an angle rather than straight down. It would be great to see a showcase on how to use Symbolics.jl to handle the heavy lifting of the Lagrangian derivation. Letting the software compute the partial derivatives and automatically generate the Julia functions for our ODE solver would significantly reduce the chance of errors. On the visualization side, I think it would be really impactful to showcase a phase portrait ($ \theta $ vs. $ \dot{\theta} $, idk how to get equations to come out all pretty when uploading here) that updates in real-time alongside the animation. Additionally, an energy bar chart tracking kinetic, potential, and total energy would be a great verification tool to ensure our numerical integration isn't adding or losing energy over time. Seeing how the "rotational" energy component factors into that total would definitely help clarify the physics of the project. |
|
Before this class I had not used Julia, so learning how it all works especially with the Lagrange method is a whole new experience for me. Being able to derive the equation of motion and solving it immediately after with animation helped me to better understand the connection between the equations and the physical motion. I experimented with the notebook by increasing the initial angle and noticed how the motion gets more nonlinear as the displacement increases, which I thought was interesting since the model also works for larger angles/behaves correctly for larger swings. The notebook also made me curious as to how the same ideas could/would apply to more complex systems. |
|
Before this class I was not familiar with Julia. Seeing the demonstration and the applying this methodology to project 1 was interesting because I did not think to create a visual of a pendulum swinging using this method. I am not the best at coding so I liked how easy it was to work with Julia. Since you are able to change animations depending on the number of pendulums and how you want to model 3D motion it was fun to tinker with and change the animation to my liking. With this methodology, it allowed me to conceptualize the relationship between the different equations of motion and time. Additionally, it showed me how different initial conditions influenced the way the pendulums moved. |











Uh oh!
There was an error while loading. Please reload this page.
Pendulum equations notebook
In this notebook+video, I use a combination of AI coding and engineering physics to build an animation of a pendulum swinging while tracking its angle and angular velocity during the animation.
Next, we can apply similar methods to the first project for the rotating pendulum.
What have you tried? What should I showcase next?
All reactions