So welcome back, and now let's discuss more about the physics.
Previously, we have only found cases where the trajectory would be linear, and this was because these
starting velocity was zero.
And this is about to change now.
So of course, we could just go ahead and change you the starting velocity.
But I want to keep these results because they are quite nice.
So let's just copy the content of these three cells.
And actually, we can just copy all of this in the same cell.
It's no problem at all.
And then also the plots.
So now we have everything in the same cell and then we can go ahead and just change the starting velocity.
That could just change this one to, for example, this and then I will rerun the whole notebook just
in case.
And here you see the trajectory where it moves back and forth on a linear line.
So just on a linear trajectory on the line.
So to change this, we change the starting velocity and we will kick it along the y direction.
I run this now.
You see, we have now both of these coordinates that are different from zero.
And you see the trajectory becomes such a spiral.
It's an elliptical trajectory.
And I think it's pretty clear from a physical point of view, you just take the ball.
And if you would just leave it to roll and to relax, that would roll on this line.
But if you would kick it in along this direction and it would spiral down to the center point of the
ball.
OK, so that was pretty nice, I think.
But so far we could have solved probably both of these examples analytically.
Now I want to show you a case where this is not possible, where we will get a really difficult trajectory,
that we're really helpful to have these routines in Python to help us to solve these differential equations.
So and for this, we will copy once again this whole code, but we will add here an external force.
And to do this, we have to change the differential equation so that we copy this one as well.
And we have to add here a term that corresponds to an external force.
And so just for a second, let me scroll back to the very beginning of the notebook.
So here we have introduced this external force already.
We wrote the force.
The total force on the ball is equal to the damping force, to the gradient of the potential and to
an external force, which we disregarded so far.
So no, we will keep it in to take it into account.
So we will have to add a term to the X and to the Y coordinate that's equal to the external force divided
by them.
Let me scroll back down.
So this means we have to add something here and here and let me just go ahead.
I will add here something with an amplitude of A0.
So we have to specify this A0.
So we could, for example, say, I don't know, let's let's keep it equal to four.
Then we have to add here a term that could, for example, be patriotic in time.
So I will add here and p dot sign and then write two times pi times t divided by some periods.
So to oversee the isolation period.
So this could, for example, be 50 seconds.
So I want to keep it here a bit larger than the period of the oscillation, which is maybe, I don't
know, five seconds.
So here it's much larger period, so that we can nicely distinguish both of these periods and.
Now I will do this at an angle, so I will write this down in terms of polar coordinates, I just write
and pilot call sign of fire.
And so I would be the angle along which the force is applied periodically.
So fi is equal to all its, I don't know, 45 degrees.
So that's the diagonal.
Of course, we have to transform to radiance, so I divide my 180 degree and I multiply by PI.
So this would be for the X coordinate and for the Y coordinates.
We do a very similar thing.
But due to the polar coordinates, it's now and pitot sign for the fire, but the rest is the same.
And now we can run both of these cells and we see this is our trajectory.
So it looks pretty complicated.
But if we look at the time evolution of these coordinates, it becomes pretty clear what's happening
in the beginning.
We have some very brief oscillations.
This is basically the same thing as this one here.
So this is what give rise to this and optical spiral trajectory with a period of approximately five
seconds that we can also see here.
However, on top of this, we have another very strong oscillation, which happens on a much slower
timescale.
This corresponds to the external force that we have just implemented with an amplitude of four, which
is quite strong, and we have the period t o c, which is equal to 50.
This is exactly the period that we see here.
And so you see in the beginning, it starts to spiral here.
But due to our periodically changing force, in the end it will just be moving on this linear trajectory
back and forth.
And you can imagine this if you would take a bow in such a ball, put it here and kick it along this
direction.
But now additionally, you take the ball and you tilt it back and forth in this direction.
Then the ball would first move a bit chaotically, but then after a bit of time, it would just move
along with the direction in which you are tilting back and forth.
And this is exactly what we see here, and I think this is really cool example because it's just such
a simple and intuitive system.
And still, it gives rise to such a complicated solution which would have never been able to get analytically.
However, with our methods integrated solve on the IVP from non-paid module, this is pretty easy to
establish because to be honest, the only thing that we have to do is to define such a function here.
Where even this one was optional is just basically a single line of code, just this one.
And then we would just have to call this command and the rest is really just plotting.
So I think it's pretty easy, pretty useful and just a nice tool.
And now, for the first time, we have solved a two dimensional system in a physical way.
But as we have learned, this is a four dimensional system.
Mathematically speaking and previously, we have already considered the one dimensional harmonic oscillator,
which was a two dimensional system in terms of mathematics.
This is at least if you would transform the second order differential equation to to first order differential
equations, as we have done to be able to use this method.