So the aim for this lecture is say we forget about these frequencies.
We just have this plot here just as data, and we want to figure out what are the three frequencies
that are superimposed here.
And for this, we will use these so-called for your transform.
I will not explain to you, why did Fourier transform will give us the characteristic frequencies?
We just assume that this is correct is is something one can derive in mathematics.
And here we want to just implement this and test how it works and see that it really works.
So the equation here means that we have some intensity, which I call Whitehill, but it doesn't really
matter.
You could give it any name you want, and it's a function that now doesn't depend on the time, as previously
we had why of Ti, but now it depends on the frequency omega.
And it is calculated by calculating such an integral over the time.
And actually, we integrate here from minus infinity to plus infinity, which of course we cannot really
do here.
So we must be clever about these values and find some tricks.
And then we integrate over our system or a signal, which will be this one here.
Of T.
And then here's two factor that I mentioned it's an exponential function with an imaginary argument.
So this will be the imaginary unit I, which is the square root of minus one.
And then we have here the omega, which is the argument of our function and the time.
So it works like this.
You basically take a value for Omega, for example, zero point five and then you put it in here.
And then from this, you calculate this integral, then you go to the next value of 0.6.
Calculate again.
And so you will get a function y tilde of omega, which we will let them have a look at later.
And I can tell you already that this function omega tilde is no sorry y told off omega will give you
a very pronounced peaks at the frequencies that we can see here.
So let's go ahead and implement this.
We need first of all, Omega is equal to, as an example, 0.3 and then into Grant, which will be this
one here is basically given S and P dot array.
And then.
T list
like this.
And then one over and p dot square root two times and p dot pie than we have.
So I basically put this into the integral doesn't matter if it's outside or inside.
I put it inside now and then we multiply by the wine list and then we have to value and pedaled.
Exp.
The eye is written in Python as 1g times omega times t list.
And then to calculate the value of tilde of Omega, we just write print integral Trump P is sidle of
integrins.
So basically, this means take this array that we have here where our x axis, so which is the time
is still the same and our Y value is changed from y to this whole integral tier.
So one of a square root of two pi times point of T times e to the power of Iomega T and then use the
integral trapezoidal method to this and this will give us just a number.
So you see, it gives us actually a complex number.
So a real part and an imaginary part.
So we probably need something like this absolute value of this.
And then typically you just square it.
This is just like typical practice.
OK.
And so the value would be done.
Four hundred twenty.
That's just a coincidence.
OK, so we have now calculated here actually why till the absolute value squared, which will be what
we will plot in the following.
So this is just a value for one particular omega 0.3.
And now we want to do it, of course, for the whole range of Omega that we are interested in.
So we should probably start at zero because negative frequencies are not so important for us.
Here we take only positive frequencies and then we go to a value where we assume after this we don't
have any peaks left.
If we look at this spectrum here, we would say, OK, what is here the fastest oscillation, which
is the smallest period?
So this will then have the smallest frequency.
So probably something on this length scale here.
What timescale better to see?
And we know already since we know the solution that there is no frequency larger than this one.
So probably it's OK to just look in the range of zero to five and just to be on the safe side, we will
look in the range of zero to 10.
So I will right now 50, which will be the data that we will plot later on, is own rate and the rate.
And first of all, first lists for the first entry of the list will be Omega, which I call on Omega,
and it doesn't really matter here.
And then the next value will be basically what we have written down here, integral trapezoidal acting
on basically this one.
So let me copy this.
So we have integral trapezoidal acting on ENPI array tea list, the square root.
Whilst the exponential and here we just have to change this to on and now we must specify what it is
omega means.
So for this, we have to add here another bracket and like this and then we can write for omega in and
p total in space, starting from zero going to 10.
And then we must specify how many steps we want to have in our omega list.
So I don't know.
1001.
All right.
So this took maybe one second to calculate and now we can go ahead and plot.
So we have on the x axis the frequency
omega and on the y axis
we have the intensity which will actually be absolute value of to the square.
And then we plots peel t dot plots for your transform.
This is our list that we have just calculated after all the values.
Just the first component.
So basically this list here
and then absolute value of f t all the values come on one and the whole thing squared as before, just
like this one.
And now we run into a bit of a problem here.
This is because it says complex warning, so it's not an arrow is just a warning, um, testing a complex
value to a real function.
This called the imaginary part, and I checked before.
What's the problem here?
The problem is actually this list here.
So the list of Omega's, because the list of Omega, since we have here a complex number, it assumes
that these may also be complex numbers.
So this seems to be, for example, zero point zero two plus zero I so always it adds a zero I, which
of course, doesn't mean anything, but it changes the data type to a complex number.
And then if you want to plot something like this gives us a warning that the imaginary part is disregarded.
So in our case, it's really what we want because there is no imaginary part, it's zero.
But just to get rid of this warning, we could write Dot Real, but it's not at all necessary.
So now we have our results.
This is the intensity spectrum over the frequency omega.
And you see we have some pronounced peaks here.
One of them is out to the other one at 3.5 and the other one is here at a very low frequency.
Hard to say.
We would have to analyze the data, but since we know what it is, it is probably 0.3.
So we have now high frequencies to 3.5 and the other one 0.3 we can figure out just in a second.
We basically just rides f t and then all of the values basically from let's say we know that it's at
zero point three.
So let's look at this one.
So this is the range of the points corresponding to Omega from 0.25 to 0.34.
And now, of course, we have to look at the Y values and the absolute values squared.
So maybe you could, of course, make this in a more elegant way, but just to do it quick and dirty,
you could do it like this.
Absolutely, you squirt.
And now you must see here, OK, it increases, and then here we have the maximum and then it decreases
again, and the maximum corresponds to six one two three four five six zero point three.
So this is really the frequency that we see here, and this is corresponding to the frequency here.
So you see really the proof that by using a free transform, we can calculate the specific or characteristic
frequencies of a spectrum.
And it means that our function y of T is superimposed by individual periodic functions that can be cosine
functions that can be sine functions that can be cosine functions with a phase shift.
All of this doesn't matter.
We just are able to figure out the individual frequencies and later in the course, in a later section
about eigenvalue problems, we will really use a Fourier transform to figure out the characteristic
frequencies of a problem where we don't know what the characteristic frequencies.
So this will be really exciting then, and it can really be a useful tool.