Simulating a Double Pendulum with. Large Language Model
Faculty Commons material developed by Todd Zimmerman - Published June 12, 2026
This is an activity I created for students in an introductory course on physics research. The course assumes no physics, math, or coding background. The point of the activity was to show how you can use a large language model to create a simulation of a complex problem, and how you could use an LLM to better understand a difficult topics.
---
# Question 1
Not all LLM models are created equal. As of Spring 2026, Claude Sonnet 4.5 has given better results than Google Gemini (which is the one we've been using inside Google Colab) or ChatGPT, so give Claude a try. Ask an LLM to do the following:
Write Python code that I can copy and paste into a Jupyter notebook that calculates the angular positions of the double pendulum problem. The code should take initial angles for the two pendulums, total time to simulate, as well as masses and lengths that default to a value of 1. It should output a couple of position figures to double-check the simulation is working and a phase plot of angular velocity vs angular position. Use an accurate numerical integration method. The angle of the top pendulum is theta_1 and the angle of the bottom pendulum is theta_2. Show me an example of how the code works for theta_1 = 1 degree and theta_2 = -1 degree.
# Question 2:
How are the phase plots changing as you increase the starting angles of the pendulums? Write your answer below and include one the graph of the phase plot of pendulum 1 for $1^{\circ}$ and $20^{\circ}$ in this cell with your answer (you should be able to copy the graph and paste it in this box directly).
# Question 3:
Now try the following angles: $30^{\circ}$, $50^{\circ}$, $60^{\circ}$, $70^{\circ}$, and $80^{\circ}$. Include the phase plots for pendulum 1 for $30^{\circ}$ and $80^{\circ}$ and describe how the plots are changing as you increase the angle in this cell.
# Question 4:
Ask the LLM to explain why the phase plots are changing the way you described. Be sure to let the LLM know what your background knowledge of physics is and include your description of the changes as outlined above. Cite your use of the LLM. Summarize **your understanding** of what the LLM told you. I want your thoughts, not the LLM's recorded here.
Go to this simulation website and select the `Graph` tab at the top of the page. https://www.myphysicslab.com/pendulum/double-pendulum-en.html
You should see a graph on the left side of the screen and a simulation of the double-pendulum on the right side. Change the graph to display angle-1-velocity on the y-axis and leave the x-axis as angle-1.
# Question 5:
You can click and drag the two bobs on the right side of the screen. Try to get the two bobs in roughly a $\pm 10^{\circ}$ so they are oscillating in opposite directions.
Put a screenshot of the graph below and compare the simulation graph to you graph. Are they similar or are they very different?
You can hit Clear Graph after you make changes to the bobs to get a clean graph. Also, you don't have to click directly on the bobs, just get close and you can control the positions of the bobs
# Question 6:
Now increase the starting angles to closer to ±80° . Get a clean graph and put a screenshot here.
How does this graph compare to your results? Are they similar or are they very different? If they are different, make an educated guess as to why they are different.
# Question 7
Ask the LLM to create a situation where the phase plot is purely periodic. Note: This is a trick question so see what the LLM tells you. Summarize what the LLM says.
# Question 8:
So most chaotic systems don't tend to behave nicely, with neat periodic orbits. Ask the LLM to find an orbit that is mostly periodic over several cycles. Add your phase plot here and write a paragraph explaining what you see in the graphs.
# Question 9:
Ask the LLM to help you explore something interesting about the double pendulum. Add the code below, play around with it, and then summarize what you learned in a paragraph or two.
This material is freely available to registered verified educators.
Login or register as a verified educator for free to access instructor-only material.


