We have discussed what we want to consider.
We want to solve this equation using of this particular potential.
And also we have compared our our system with our previous system, which was a one dimensional harmonic
oscillator where we had two of these differential equations.
Since this was a second order equation, we could replace it by two first order differential equations.
So now, since we have two harmonic oscillators, we will have four a four dimensional system, at least
mathematically speaking.
So let me show you how this works.
Well, first of all, we must define the function.
So we right define f o d e.
We could also use a different name, but I want to show you that this is really nothing new, and therefore
I use the same name as before.
So, all right, everybody.
And for the variables we have, T and our this is really the same thing that we had previously.
When you see here he was our function here.
We had tea and theta with detail was our spatial variable.
And now we have tea and our all right and now we must return a total of four functions.
So we right here function one two, three four.
And now, of course, we must think, what do we want to return?
And since this can be a bit tricky, I want to make it a bit more simple for us.
So I write X comma y is equal to R zero to two just means take the first and a second entry of the position
vector R.
So this corresponds to index zero and one and store these values as X and Y, but only in this function,
only to make it a bit easier for us.
This is not really necessary, but it makes it a bit easier to understand what's happening.
And now we do the same thing for the velocities, which is, of course, then the first derivative,
which was quite common to this one here.
So there we right.
This is our.
And then from two to four.
So this corresponds to the second and third index, which means the third and fourth component.
Since Python starts counting at zero and now we must think, what do we want to return?
And just to make this clear, this is the same as we did before the first entry.
If we want to return would be the theta one, which would basically be the first derivative.
So in our case, this would be the velocity.
So it would be the X.
And also it would be, of course, Levi, because now we have two physical dimensions, so we have now
two velocities.
And here we must write the differential equations on the right hand side of the differential equation.
So let me scroll up to the beginning where we have it here.
So we basically have to solve this equation, forges our double dots, so we have to divide the whole
thing by M.
And so then the right side of the equation becomes minus psi over m times first derivative of R minus
gradient of you, which was two you times the position vector and then does external function.
But we we leave it out.
For now, we send it to zero.
So basically then the right hand side for the X component will be minus psi over m times the X.
And then here we get minus two times U times X and also divided by M.
So let's write this down.
So this will be the entry for the X component, so we ride, as I just said, minus sign over m times
the B X and then the second term minus two times u zero divided by M, times X and Y component is of
course, very similar, but with we y and the Y components.
And now you see, we have several constants here that we must define and as typically we will just set
them to one.
You can, of course, later on play with them and see what changes in the solution.
Also, the U0 will be one and size, and that is something that I could damping constant.
I will not choose equal to one but make it a bit smaller, like zero point one.
All right.
So now we have to find the function, but now we can just solve for the function.
So let me scroll up here and see how we did it previously, initially.
So we don't have to write all of this stuff again.
Let me just copy this and I would continue to write here.
So you see, I will discuss know several examples, and we will start with a example that gives rise
to a linear trajectory.
So I want to start the solution just by naming its solution.
And now we have to see what do we have to change?
Well, this one, we gave it a same name so we can leave it.
This one is to time so we can make it a bit more general to just write T starred and T.
And then of course, we have to define these variables, so I will write T start is equal to zero and
T and is equal to 100.
And then we can do the same thing here t start and T end.
And this would be here and the number of points.
And I would say, let's just increase the number of points a bit.
And then the only thing that we have to change is these two entries.
So this one, no, sorry, only only this one.
And this would be the starting conditions.
So we must now specify four different starting conditions for the X, Y, X and Y.
So I will write down like this x zero y zero v x zero and revise zero.
So you see, I just said it in the wrong order.
This is the correct order that we want to do.
All right.
And now we must, of course, specify some values.
So just for simplicity, I would say let's use maybe not zero in all cases, because if if we set it
to zero, then we are just in the minimum of two potential and then nothing will happen.
But for the velocities, we can say OK.
At the time of zero, we will start in a stationary state where the velocity is zero.
So just like this?
All right.
So we run this and we add a new cell and can plot our results so I can just copy this once again from
above.
So just this one.
And now we have here our time T and here we have poor coordinates X and Y, and what we want to plot
now is the zero component of why this is correct.
So this would be corresponding to X.
So here you have to be a bit careful because the way this, this, this command here is programmed is
that it gives you as an output the time the times, which is indicated by Dot T, and it gives you also
the coordinates, which is indicated by Dot Y.
And it doesn't matter what you call these variables here.
It will always be told y so dot y and then zero in these brackets corresponds to this one.
All right.
So this is good, I think.
And now we can add also the Y coordinate, which would be here one and we give it a different color.
And you can see we have now some nicely oscillating behavior for the accent and for the week on oh,
sorry, sorry, I did the mistake.
I was just wondering why does it look so similar to our previous example?
And the reason is, of course, that we are plotting here the previous result, which was quite solution,
underscore Aki 45, and our new solution is just solution.
So, yeah, let's delete this very quickly.
And you know, I get a mistake error.
So here the same thing, of course.
And now finally, we have it.
All right.
So we have now our dependence of the X coordinate, which would be a threat.
And you see this stays at zero the whole time.
And then for the Y coordinate, you have the blue curve, which is oscillating and it's a damped oscillation.
And this makes sense because for the X coordinate, we are already at the equilibrium position.
So there isn't any oscillation happening here.
So we need to make this a bit more clear.
Let's plot the trajectory.
So here I have to basically plot.
Maybe let's just copy this one.
I have to plot the X versus the Y coordinates.
So like this and you see it just goes from bottom to top.
So it would be, of course, good to add to your circle.
And yeah, I have this already.
So let me copy this so that we don't lose too much time in this lecture because by now, you have practiced
as a whole lot.
So you see, if I write the right here, this is the same as we had before than we have.
Here are label X and Y.
We have here the aspect ratio that is set to one.
And here we have some parameter T that goes from zero to two pi.
And when we calculate the cosine and assign for X and Y, we get a circle and radius.
I have chosen to be equal to three.
And here it plots the circle, which I can make blue.
And then I run it and you see here, this is our circle, which should indicate indicate to the bobble
in some, in some sense.
So it's an extra potential line of bull.
And here we have our trajectory and now of a change to starting conditions, for example, to this one
and run it again.
And you see X and Y are now on top of each other.
And it oscillates now along this diagonal.
And of course, I could also do something like this zero point five.
And you see here, the two coordinates are always independent of each other, and we have this nice
oscillation.
So when you think of it in a physical example, so when you take a wall, put it in a bowl at a different
position than the energetic minimums or the middle, then the the ball will just roll back and forth
back and forth on the same trajectory until it remains stationary in the middle.
All right.
So I think that was pretty good because now we have learned how to solve such a two-dimensional example.
And to be honest, it was nothing new at all because we used the same method that we used before.
You see these two commands I wouldn't really have to do.
I could have just written here, for example, of V X two.
And here we x.
I'm sorry, not be x our two and our three.
And then this would have been exactly the same as we did here where we wrote Theta one.
OK.
So you see, in terms of the commands and in terms of the mathematics is really nothing new.
It's just that now we have really described a two dimensional physical system and you see that when
we choose the accent, we y to be zero, then we always get this linear trajectory.
And on the following, we will play a bit more with the starting conditions.
And also we will add some external forces and see what happens now to the trajectory.