In this video I'd like to tell you about how I use Gnu Octave to find approximate solutions to systems of differential equations by using numerical methods. First though, check out this contraption I made in the shed. I hope you can anticipate that me moving this one pendulum won't affect the others in any noticeable way. But what happens if I sit the whole wooden thing on some rollers? This is now a system of pendulums. You might have seen videos where a series of metronomes are set on a plank and then the plank is set on some cans and they end up being synchronized. This wooden contraption I made is also a series of harmonic oscillators like the metronomes. Let's see what happens when I let one go. They become synchronized but they are not in-phase synchronized like the metronomes. They are anti-phase synchronized. It seems that this system has a stable state where the platform doesn't move. Let's now introduce a differential equation to understand what's going on. Let's think about just one pendulum to begin with and then we can expand on that later. This is a second order homogenous differential equation that governs the movement of a simple harmonic oscillator. Deriving that equation isn't the focus of this video but if you would like to see how to do it then consider watching a video on the channel, physics with Elliott that talks about how to do that, I found the video really helpful and the link is in the description. Before we can use this in GnuOctave we should rearrange this second order differential equation to be a system of two first order equations. By using a change of variables we should be able to do this for any second order differential equation. So let's substitute these new variables into the equation and so we have this system of equations. So far the system of equations represents a simple harmonic oscillator. Simple here means the oscillator has no friction acting upon it. Simple harmonic oscillators can be modified to include friction and other sources of dampening. Here K is the friction parameter. Then given some initial conditions for X sub 1 and X sub 2 we can get the Octave function ODE 45 to approximate the solution. As far as I can tell the function in MATLAB and in Octave behaves the same. ODE 45 is a RUNGE CUTAR method and I think the most basic example of this family of methods is Euler's method. Before you can use ODE 45 in Octave you should install the OCL package via Forge. The first step is to define a function that is the system of differential equations so that Octave can use it. Let's take a look at the function named Dynamics Pendulum. It's convenient to define these parameters locally like K for friction, L for the pendulum arm and G for the gravitational constant. Note that here the value of K was arbitrarily chosen but I give an explanation for this at the end of the video. We must define the independent variable. We take time to be the independent variable. X zero is the initial condition vector. And then pass the function of equations, the independent variable and the initial conditions to the ODE 45 method. The ODE 45 method iterates over the points in the independent variable and passes those and the approximated point for each equation to your function of equations. Those are substituted into the equations and then those substitutions are returned to ODE 45. It will then know how to approximate the next values in a similar way to OILAs method. There are other solvers but the MATLAB documentation says that ODE 45 is usually the one that you want to use. A link to that documentation on how to choose the solver is in the notes. Then we graph the result and look what we get. These are approximated values for X sub 1 or theta and for X sub 2 or the returning force at every point of T. So far so good. But that was just one pendulum isolated from the others. Now let's sit a system of two pendula on a shared platform on some rollers to see what happens. What's happening here is the dominant pendulum forces the platform very slightly but the pendulum at rest has inertia. By the time the formally steady pendulum catches up to its rest position on the platform, the platform is already heading in the opposite direction. This continues until the pendulum are in anti-phase synchronization which means the platform will no longer move. Recall that the former equation determined the angle of the single pendulum. We can use that again but we can make a small change to say that each pendulum dampens every other pendulum. Let's define a nudge parameter for each pendulum to achieve that dampening effect on the other pendulum. For a pendulum to nudge another pendulum causes it to lose energy so a pendulum's total loss of energy is that nudge plus friction. This chart shows a system of two equations which represent the two pendula in this shows the pendulum do end up with anti-phase synchronization. Now for the initial problem, the platform with three pendula which we can model with a system of three equations. This is essentially the same as the system of two equations but there's a slight difference. The force that each pendulum gives to the platform is absorbed by the other two pendula. The force that a pendulum gains from the system is the average of the force exerted by every other pendulum. And the chart for this one shows that each of the other pendula that were initially at rest or they're close to at rest will each move to counteract half of the force that the dominant pendulum exerts on the system. I should note that I chose the values for the parameters k and n arbitrarily. Since we have a physical system that we can play around with which is this wooden thing on rollers that I made, then we could measure the actual angles of the pendulum at every point of time and then use those data points to solve for the unknown parameters. I imagine it would involve filming the pendulum on the platform and then measuring the angle theta at regular intervals. If you check the description you will find links covering how to derive the differential equation of a pendulum, how to set up Jupyter Notebook to run using GnuWokTave, documentation about how to choose a numerical method, the script and code to find these solutions in this video, and how to install the OCL package so that you can use ODE solvers in GnuWokTave. Please leave a comment to share what you found interesting or surprising or if you have any feedback. Thanks for watching.