 So now what we're going to do is essentially extend that kind of analysis representing a function in terms of its oscillatory components to the continuous case where we have the oscillatory components are functions of a continuous variable and the interval in principle can go from minus infinity to infinity. All right, so there's no prescribed range over which the function has got a repeating oscillation. All right, now the Fourier transform is something that's very, very important and it's probably something that you already have done and may not have even known about it so anytime you turn on your MP3 player or your CD player you're doing that. If you've done FTIR spectroscopy in organic chemistry you've done FT stands for Fourier transform, et cetera, et cetera. So it shows up everywhere. It's a very important technique. Whenever you have a signal that depends on time it's convenient to be able to represent that in terms of a related function that is in terms of frequency. Okay, so I'm going to just write down the formulas so we can see what they look like and we are going to use them to evaluate some Fourier transforms for a simple function and that will hopefully help us to appreciate what exactly the transform is doing even if we ignore going into all the mathematical details. Okay, so I'm going to suppose that I have a function F of X, okay, and here X is, can be for example X could be position of a particle or most commonly in Fourier transform analysis X would be, it would be a time, okay, and what I want to do now is transform this function to another space where it's expressed in terms of another function whose variable is related to X in this sense of this transform, this Fourier transform, okay, and I'm going to call that variable K. Now the way the Fourier transform works is that we multiply F of X by a complex exponential which involves both K, this other space variable, and X, okay, and then we're going to integrate this function, this product from minus infinity to infinity, all right. So what we do is we get rid of the dependence on X and we're left with a function of K which is called, we'll call it F of K with capital, okay, and this complex exponential contains oscillatory contribution, sines and cosines thanks to the famous Euler relation which says that E to the I times a variable say theta is equal to cosine theta plus I sine theta, okay, so this is an oscillatory function and as we're going to see the process of doing this transform, the integration and multiplying by this oscillatory function, it's going to actually pick out the oscillatory components of X and express them in terms of the variable K and just to remind you, if X is equal to time, then K would be equal to frequency, so for example, hertz or second to minus one, or if X is equal to position, it turns out that this would give K is equal to momentum, all right, so time frequency transformations are very useful in signal processing, in image processing, in GPS, in spectroscopy, and position momentum transforms are the basis of being able to determine the structures of molecules in solids, so crystallography, by measuring the diffraction of waves such as X-rays or electrons or neutrons, so that structure determination relies on the transformation because you measure the quantity in momentum space and you want to transform it to a function in position space, in other words, the molecular structure, the coordinates in Cartesian space, and oftentimes we measure a signal in time and we want to express it in terms of its components and frequency, so that would be an example of that would be NMR, modern NMR experiments, they measure a time varying magnetization and then a Fourier transform turns it into the NMR spectrum, which you've learned is relatively straightforward to understand if you understand the basic principles of NMR, say, for organic molecules, okay, but the time signal may actually look very, very messy compared to the frequency spectrum, okay, so this process here would take, if X was equal to time, would take a function of time and turn it into a function of frequency, all right, and this is what we call the forward Fourier transform and it's actually invertible, so if you know F of K, you can recover F of X, or if you know F of X, you can recover F of K, okay? And the reverse just looks like this, F of X is equal to minus infinity to infinity, F of K, E to the plus 2 pi I KX times D K, okay? Now it's, like I say, it's probably not obvious from looking at these formulas what is actually going on, what are you actually doing when you're doing these transforms? And I think that at the level of this course, the best way to see how it works is actually to go ahead and play around with it, and even if we don't care about the intimate mathematical details, we can at least get a feeling for what's going on, and I think that should be the goal of what we do here. All right, so what we're actually going to do then is we're going to construct a time signal that we know a lot about, and then we're going to look at its Fourier transform to see what actually we get when we do this process, okay? And the particular form of the signal that I'm going to look at is as follows. We're going to define a function S of t, S for signal, okay? And let me just make sure I have consistent notation, so I'm going to grab my notes here. It's going to be equal to e to the i omega t, where omega is now going to be an angular frequency. Omega equals 2 pi times the frequency in hertz, and then it's going to be plus some quantity which I'll call alpha times i, all right? And this, so this is, well, let's go ahead and consider a particular case that we'll do first, so, all right? So first we're going to do nu is equal to 5 hertz, and we'll do alpha equal 1, okay? So when we put that in to this form and use this formula for omega, then what we get is S of t is equal to e to the 10 pi i t, and then times e to the minus t, okay? All right, so this part here, this is the oscillatory part of the signal, all right? Because it's got a cosine, the real part is proportional to cosine, and the imaginary part's proportional to sine. And then this part, which comes from this term here, this is just an exponential decay, all right? So what we expect to see is that the real part will look like a cosine that's decaying in time, and the imaginary part will look like this sine decaying in time, and then we'll play around with these parameters and see how it affects the transform. But the bottom line here is that for the first example we know that we do, we know that the frequency is 5 hertz, and we'll be able to see that very clearly when we actually do the Fourier transform or actually compute the frequency spectrum of this function. Okay, so let's go ahead and get started. We'll type that in, and then what we're going to do initially, so there's lots of ways that you can do Fourier analysis in Mathematica, and we'll see a couple of them. So what we'll do initially is we'll just do the integral that's written on the board, we'll just do it numerically, okay? And then later we'll see how to use existing tools in Mathematica to do Fourier transforms. All right, so I'm going to define omega as written down, so I'll go over and get myself an omega, and that's going to be equal to 2 times pi, and I'm going to put in nu is equal to 5, so there it is. And then plus alpha times i, alpha here I'm just going to say is 1, so I'll just put in i, and i is capital i in Mathematica, or you could go up here on the pallet and put in this i here, okay? And then I'll define s of t underscore colon equals exp of the capital, and then I'll put in i times omega times t, all right? Now, just for fun, let's have a look at what this thing looks like, okay? So the first thing I'll do is plot the real part, so this should be the cosine part, and the way we get the real part of a complex object in Mathematica is we say capital R, little e, and then bracket, all right? So what I want is the real part of s of t, and then I'll just plot that from t goes from 0 to 5 seconds, all right? So we enter that, and let's put in plot range arrow all, okay? So there you have what I already described in words. It starts at 1, it's a cosine, and then it's got this decaying amplitude, that decaying amplitude is coming from the exponential e to the minus t, okay? And another thing you can notice if you count how many times it oscillates before it gets to 1, you can see it's 5, and so you see that the frequency of that signal is 5 hertz, okay? So we know all about that signal. We can also plot the imaginary part which is going to be proportional to sine, and so what you see is that it's, we have to put in imaginary part, I m is imaginary part, and so now you see it's the same as the real part except it's out of face because it's a sine, okay? It starts at 0 instead of 1, okay? Now the whole idea behind the Fourier transform is that it's going to give us a function that has a peak in frequency where that frequency matches that of our signal, okay? So in this signal we have a single frequency. So when we do the Fourier transform we should get a single peak and that peak should be at 5 hertz. Okay? And that'll be, actually that's in the real part of the Fourier transform. Okay, so here's how we're going to do the Fourier transform. So we're going to say n integrate with a capital I, and then we're going to multiply s of t times exp minus, is it 2 times pi times I, capital I times f, f now is going to be my definition of frequency, and then times t, okay? So that's the same as what's in the formula over there except I'm calling k, f, and x, t for frequency and time. All right? Now when I do n integrate I have to say how far I'm integrating. And I can see from this, the behavior of this function that if I go out to about x equals 10 I'll be in a place where it's completely decayed out and so I'm going to do the integration for t goes from 0 to 10, okay? All right, so if I just did that I would get the Fourier transform. Now what I want to do though is actually plot that as a function of frequency. So I'm going to say plot, and because it's complex I want to look separately at the real and imaginary parts. So let's go ahead and look at the real part first. So say plot re and then put another bracket here, okay? And now I have to say over what range of frequency do I want to plot it? And we'll do it from, I expect my action to be at 5 hertz so if I go from 0 to 10 I should see something. So f goes from 0 to 10, okay? All right, so let's go ahead and let that go. And let's go ahead and put a plot range arrow all, okay? So there you have it. So notice what we've done. We've taken our, well with the real, we've taken our function, our complex function, we've done the integration corresponding to the formula for the Fourier transform and we've generated a complex output and the real part looks like a frequency spectrum. We have a single peak here. Remember this is frequency now in hertz and it's at 5 hertz which is exactly where the oscillation in the signal is. So the Fourier transform has pulled that out for us. Okay, now there's one other aspect of this that I wanted to show you. So let's go up here and let's change alpha, okay? So if I put in say a factor of, let's see what I want to do here. Let's go ahead and just put in 2. Actually what I want to do, let's go ahead and do a new one. So let's grab this because we want to compare. All right, so we'll have that and let's go ahead and put in a factor of 2 on this thing which is called the damping. Now what this is going to do is it's essentially going to turn the decaying exponential instead of e to the minus t it's going to be e to the minus 2t, okay? So it's going to decay more quickly. It's going to be damped more strongly and we can see that by just entering this command. You can compare this function here. It has the same frequency. We didn't change that. But notice this one takes much longer to die out than this one. So increasing the damping has, if you like, localized our oscillating signal. All right, now let's see what happens to the spectrum. So we should still get a peak at 5 hertz because we didn't change the frequency. So if you do that and I'll let you scroll up and take a look, what do you notice that's different between these two spectra? So the peak is at exactly the same place, it's at 5 hertz. What's changed? Compare the widths of these two spectra. Which one is wider? The second one, okay? So that's kind of interesting and this is, if you like, a manifestation of the uncertainty principle. All right, it turns out that these two spaces, time and frequency or as you're taught in G chem energy because energy is related to frequency, they're related by an uncertainty principle. All right, so notice a function that is more delocalized in the time domain becomes more localized, if you like, the narrower, this one's narrower in the frequency domain, right? When I go down here and I damp this out more and make this oscillation more localized, it produces a broader frequency spectrum, okay? Now let's have a look at the imaginary part. This is something worth looking at. This form here, the real part, which looks like an ordinary spectrum that you might see, say, in a peak that you might see in, say, an NMR spectrum. This is what's called the absorptive line shape, all right? And it's the real part of the spectrum. The imaginary part contains similar information but it has a different shape, which is called the dispersive line shape, so let's have a look at the imaginary part, okay? So this is the imaginary part of the same transform and notice that it has this funny shape, the dispersive line shape and where it goes through zero is actually where the frequency was in our signal, 5 hertz. And if you think about it a little bit, it turns out that these two are related, okay? So in principle, they contain exactly the same information and the relation is, and I think you can see this if you look at the behavior of this guy and the slope of it, this turns out to be the derivative of this because sine, which appears in the sine of frequency, which appears in the imaginary part is the derivative of cosine, which is the real part, okay? So this is what's called the dispersive line shape. It contains the same information. It's just usually we're more interested in identifying frequencies by where peaks occur in the spectrum, so you're often more interested in the absorptive line shape, okay? Now let's add another frequency component. So here, in this example, we didn't need to do a Fourier transform to see that there was an oscillation in the time signal at 5 hertz, right? You can just count it off the graph. So we didn't need to go through the trouble to see this here. But let's make it just a little bit more complicated and then I think you'll be able to see where the real power of the Fourier transform comes in. So what I'll do is I'll grab all this stuff and I'll go ahead and put the damping here back to 1. And now what I'm going to do is I'm going to call this omega 1, okay? And I'll make its frequency 3 hertz and then I'll copy it, put it back, and now I'll define a second frequency, omega 2, which oscillates, which is 6 hertz, okay? And now I'm just going to add the two together to produce my signal, all right? So we have two contributions, okay? So now let's make a plot of the real part of that superposition of two oscillating signals. I'm sorry? I believe you want the 7 hertz. Oh, right, yes, exactly, thank you. Very good, okay. Okay, so now look at what you get. This is a little more complicated, okay? And it may not be completely obvious what the frequencies are. You can play around with it even more. You could say like 3 and say 5. And it starts now to become difficult to just look at the graph and see what are the underlying oscillations. And this is just with two frequencies. What if you have many as you may have in an audio signal or even an NMR signal, okay? So now we'll see that we can take this thing which already looks fairly complicated and we can make it look very, very simple by doing the Fourier transform, all right? So let's go up here and get this. We'll do the real part, the absorptive part first. So what should we get? Anybody? What should we get? We should get a frequency spectrum with two peaks, correct? One at 3 hertz and one at 5 hertz. And low and behold, you have one at 3 hertz and one at 5 hertz. Okay, so you can see through these simple examples how it is that this somewhat intimidating looking expressions over here actually do something really nice. They take your time signal, convert it into a frequency spectrum and pull out the power if you like contained in the oscillations at the different frequencies. What happens if you play around with how much goes into each? So let's say we multiply the second one by 0.5, all right? So now it looks kind of weird. And then do the transform, notice, there's less of a contribution from the second oscillation and that shows up in terms of the size of the second peak. So the size of the peak is the measure of how much power if you like there is in a given oscillation. And then of course we can play around with the damping. So let's put in a smaller damping for the second one. So let's say 0.5 instead of 1 and then redo it. What do you think is going to happen now when we do the transform? I made the damping, the exponentially decaying and time part more rapidly decaying for the second component which has the frequency of 5 hertz. It should narrow the second peak, right? Hmm, it's taking a while. Okay, there you go, all right? And it grew because the area is a measure of the strength of that contribution to the signal, okay? And then let's look just at one more thing here. I think you'll get the idea. Let's have a look at the dispersive part, the imaginary part. What do you think we'll get here? Probably going to have to wait a while. All right, so there you have it. So you have your two dispersive line shapes and they tend to overlap, see? So this can be a problem sometimes because if they overlap a lot, the positions of the zeros may actually be shifted by the shape of the neighboring guy, okay? But in this case, they're reasonably, well, they're enough separated that we go through 0, right at 3 and right at 5. And notice that this one is narrower, sharper feature than the lower frequency one. Okay, so now you've had your brief introduction into how Fourier transforms work. And the next thing I would like to do is to introduce you to the symbolic Fourier transform that's available in Mathematica, okay? So many functions, not all functions, but many functions have Fourier transforms that have, you know, analytic forms, meaning you can write down an equation for them, okay? And where those exist, Mathematica will find them. And so I want to show you a couple of the more well-known ones that appear very frequently in chemistry applications, okay? All right, so the first function we're going to look at is it's going to be a Gaussian function, all right? And I've told you many times that Gaussian functions have many wonderful properties. And one of those properties is that the Fourier transform of the Gaussian is particularly convenient, and we'll see that in just a second, okay? So I'm going to define now a Gaussian F of X colon equals, and I'm going to say it's exp to the minus a constant times X squared, okay? So this is just a generic bell curve, all right? So we can enter that, and we can go ahead and plot it. X goes from, actually let's use a replacement rule to put in a value for C. Let's just put in 1. We'll have X go from minus 3 to 3, okay? So there you see you get a nice bell curve. Gaussian function centered at 0, okay? Now, the next thing I'm going to do is I'm going to use Mathematica's symbolic Fourier transform. So it's actually going to try to find the closed form Fourier transform of this function, and it will find it. And so here's how that works. What I say is Fourier transform, and then I say, what is the function that I want to transform? So F of X, and then the variable that I'm transforming from, and then I say what's the variable I'm transforming to? So I'm going to say K, so it's going to be just like what's written on the board there, okay? And I'm going to assign that to a function of K. So I'll say G of K underscore colon equals, all right? So let's go ahead and let that rip. And now let's ask what is G of K? And here's the part that I think is interesting, okay? So we take F of X here as a Gaussian, all right? E to the minus constant times X squared. And notice what we get. We get a function back that's also a Gaussian. E to the minus K squared, because this is a function of K, all right? So that's one kind of useful thing to know right off the bat is the Fourier transform of a Gaussian is a Gaussian. So that's one of these really nice things about Gaussians that turns out to be very convenient. Now, what's also very interesting is the relationship between the parameters of these two Gaussians, and in particular their widths, okay? So let's have a look at that. Oh wait, let me show you one more thing. Remember, we have a way to go back. So when we do a Fourier transform, we get a function in the other space, in this case it's K, and previously it was frequency. We can apply the inverse Fourier transform to go back to the original function. So I just want to show you that that works, okay? And so what we can do is we can ask for Fourier transform of G of K, K goes to X. And notice, aside from these square root factors that cancel and give one, we get back exactly the same function, okay? So that's an illustration for the case of a Gaussian of the forward and the inverse Fourier transforms. So now what I want to do is let's have a look at these functions because I want to reiterate a point that I made earlier. So what we're going to do is we'll go ahead and make plots of the Gaussian in real space here. And I'm going to do it for two different values of C, which is going to determine the width of the Gaussian. All right, so I'll first plot for C equals 1, and then we'll add to that plot the same function but for C equals 10, okay? So here we're just plotting the Gaussian as a function of X, just for two values of C, all right? And what you see is that C equals 1 gives a fatter Gaussian and C equals 10 gives a narrower Gaussian, okay? Because the parameter C is inversely proportional to the width, all right? Now let's have a look at the plots of the Gaussian in the K space, in the Fourier space, okay? So here what we're going to do is we'll plot G of K now with C equal to 1 and G of K with C equal 10, all right? Something happened here. Oh, I have to plot as a function of K, all right? Okay, so now we're going to notice again a manifestation of the uncertainty principle, all right? So notice here that actually let's go ahead and say plot range arrow all here to make it on the same scale. So notice when I transformed the narrow Gaussian, I got a fat Gaussian in the opposite space, in the Fourier space, okay? And I'm still not getting the complete range of this guy. All right, plot range arrow 0 to 1, okay? So notice the blue one gets a little fatter but the purple one gets a lot fatter, okay? So the more localized we are in X space, the more spread out we get in K space. If you like, the uncertainties are connected, okay? So there's your introduction to Fourier transforms, a little taste of the symbolic version and then we'll see another example later and then we numerically integrated the formulas ourselves to see how it actually works, okay? So now we've concluded our treatment of some series expansions and now the Fourier transforms. So what I'd like to do is go over a few examples from chemistry that involve these various things, okay? Now the first thing that we're going to do is relevant to statistical mechanics which is something that you'll learn about in Chem 131c and we already talked a little bit about the central object in equilibrium statistical mechanics which is called the partition function and the partition functions can be written as a sum and so what we're going to do, I'm going to show you a couple of examples and then we'll actually evaluate the sums in Mathematica, okay? So the way the partition function is calculated is we suppose that we have a quantum mechanical system for which we know how to calculate the energy levels, okay? So we have, say, a bunch of energy levels. They may or may not be degenerate. Let's just say there's a few levels there and energy is increasing, all right? So we can say that this one is 1, 2, 3, 4, et cetera and we can also introduce, so this will be, say, a label for the quantum number. So that's N or let me go ahead and call it I because that's what's written in the notes and we can also define the degeneracy of each level, all right? So I'll call that G sub I and degeneracy means how many energy states do I have that have the same energy, okay? So here there's only one in the I equals 1 level but here there's 2, so I put a 1 here and a 2 here and then 1, 1, okay? So that's the degeneracy. Now the formula for the partition function is it's usually denoted Q. What that is is it's a sum over the I's and in principle it can go to infinity if there's an infinite number of levels and then you take the degeneracy and then times E to the minus epsilon sub I where epsilon sub I is the energy value at which those levels occur divided by KT where K is Boltzmann's constant. Another way to write this would be sum over I GI E to the minus beta epsilon sub I where beta is equal to 1 over KT, all right? So what's the significance of this? Well as you will learn when you get your introduction to statistical mechanics, if you know this function then you have the connection to all the thermodynamic properties of whatever system it is that you are describing, okay? And in order to be able to calculate this function you need to know the energy levels, okay? And those come from a quantum mechanical calculation. So for example, those of you who are in Chem 131A now, you've seen what the energy levels are for particle in a box, you've seen them for harmonic oscillator, you've seen them for the rigid rotor for rotational motion and you've seen them for the hydrogen atom I suppose by now, okay? So the point is for all of those systems we know the levels and therefore we can in principle evaluate the sum, calculate the partition function and then ultimately thermodynamic properties of the system. And this is the connection then between the properties of microscopic objects. So individual molecules for example and thermodynamic properties is through this connection. Quantum mechanics gives us the energies. Statistical mechanics tells us how to calculate the partition function and then turn that into macroscopic properties, okay? So you'll see how that works later. But for us right now it's just going to be a sum that we're going to evaluate using Mathematica, okay? And we're going to do this for two systems. The first one is going to be the harmonic oscillator. Does anybody remember what the energy levels for the harmonic oscillator are? Okay, I'm going to use a slightly different notation. I'm going to call the quantum number for the harmonic oscillator N, okay? So I would be replaced by N. And then we have N plus 1 half and then we have a factor out in front that includes the characteristic frequency of the oscillator and I'm going to use the notation H nu zero. Okay, so it could be H bar omega, it could be H nu. All right, nu zero now is the characteristic frequency of the oscillator, okay? And for the harmonic oscillator the quantum number goes from zero to infinity, okay? And another thing about the harmonic oscillator, does it have any degeneracies in its energy levels? No, so all the G N are equal to 1. Okay, now the next example that we'll do, so I'll go ahead and write it down now. Okay, so in this case then Q would be equal to sum N equals zero to infinity E to the minus beta H nu zero N plus 1 half, okay? So that's the sum that we need to evaluate if we want to calculate the partition function for the harmonic oscillator. Okay, so then the next one that we're going to do is going to be the rigid rotor. So this is a quantum mechanical model for describing the rotational motion of diatomic molecule. Does anybody remember the energy levels for that one? Mm-hmm. And it's usually expressed in terms of a quantum number called J. J times J plus 1, where do I put that? And then, okay, so then there's some numbers that go in front to give it energy units. And I'm going to use the notation H C B where B is something called the rotational constant. I don't know if you saw that in your formula. But in any case, the book that I used has that notation. Okay. And what is the, what are the allowed values of the quantum number? It starts at zero. And what about the degeneracy? 2 J plus 1. Great. Thank you. Okay. All right. And we're going to do this one for a particular case where this, I'm going to write this in a funny form just because it's the way that I looked up the constants, the way they were given to me. Okay. So I'm going to call, sorry, let me get rid of this thing here. What I'm going to need to evaluate the rigid rotor partition function is I'm going to need to know beta times H times C times B. Okay. So I'm just going to write down the value that I'm going to use for that. Beta times H C B is going to be equal to 10.591 divided by 207.224. Okay. And this happens to be for hydrogen 35 Cl. So we'll actually evaluate the part, the rotational contribution to the partition function for HCl. And it will involve using these numbers. Okay. So let's go ahead and work on these using the sum command. Okay. Now, what's nice about the harmonic oscillator, one of the many reasons why it makes such a nice model system, is because as we're about to see in just a minute, the sum that we need to evaluate, which is a sum over an infinite number of terms, it actually has a closed form. Okay. So let's try that out and see what we get. Okay. So what I'm going to do now is let's go ahead and make it fancy by using the palette. So I'm going to say sum N, whoops, not B, N, tab, zero, tab, infinity. All right. And now what do I need to do? I need to put in the degeneracy, which is one for all levels, so I don't have to put anything. And then I'll put in E and make that a superscript. And so now I need to put in minus beta, space H, space, and then I'm going to have new zero. So where's new here? And then tab zero. Okay. And then space times N times N plus one, half. Okay. Now, sometimes you get lucky and sometimes you don't. Hmm. That doesn't look good, does it? So something is wrong with my formula. Just make sure I do all this stuff, right? Anybody see what I did wrong? We should get a nice formula. Capital letter E. Okay. So let's, yeah. I thought that one should work, but maybe not. Oh, yeah. Thank you. Yeah, I used the superscript. That's right. Darn it. See, I don't like the palette. Here we go. All right. E minus beta times H times, yeah, there's something wrong there, but I don't want to waste your time debugging it. So let's just try it a little more straightforward way here. Times N times N plus a half. Oh, I know what the problem is. Dummy. I'm talking to myself here. Let's try that one. Ah, there we go. Okay. Gave up too early. There shouldn't have been an N in the, in front of the N plus one, half. I was thinking of something else. Okay. Now, so what, after all that to do, what's the significance of this? Well, this is one of the few lucky cases where the sum that you need to evaluate for the partition function actually has a closed form. Meaning, notice, there's no sum here. All right. So we could just plug some numbers in and we get a number for what's written originally as an infinite sum. So that's a very fortunate case. And this is another example of one of the very nice aspects of the harmonic oscillator, why the harmonic oscillator is such a useful starting point for talking about molecular vibrations. Okay. All right. Now, the next one is the rigid rotor. Okay. So what I'm going to do here is I'm going to define the sum end as a function of J. So I'm going to say F of J colon equals. And then I'm going to put in the degeneracy. So that's two times J plus one. And then times exp minus A. Okay. So that's what I wrote down over there. Beta HCB, I'm going to call A here. And then times J times J plus one. Okay. So this is the thing that goes in the sum to calculate the partition function for the rigid rotor. All right. Now, let's just try for fun. Let's go ahead and enter that. And let's see if we can actually get a closed form for this one. So let's say sum F of J, curly, J goes from zero to infinity. And we're not going to get lucky this time. Okay. So we got the thing spit back at us exactly as we put it in, which means no luck. Okay. So then here's an example of a case where we actually want to calculate a number for this but we have to actually do the sum explicitly. And then this brings up an issue that we have to confront when we do sums initially, which is how many terms do we have to include to get a good answer. Okay. And you can kind of see that this thing is going to, if you like, converge at some point. Because notice, as we add higher and higher values of J, the thing that we're putting in the negative exponent here is going to get bigger and bigger. So as we increase J, the contribution coming from the higher J terms diminishes in size. And at some point it becomes insignificant. Where significant depends a little bit on, you know, how accurate we want to be. Well, it depends a lot on how accurate we want to be. Okay. So one useful thing to do in such a situation where you need to approximate an infinite sum with the finite number of terms is to take a look at how the value of the sum depends on how many terms you put in. Okay. So that's all we'll do now. We'll look at it a couple of different ways. All right. So to do that, I'm going to put in an explicit value of A and that's the ratio over there that I wrote on the board. So that's going to be to the end point 591 divided by 207.224. That's for HCl, okay. And now what I'm going to do is make a table of the contributions to the sum as a function of J. So we can kind of see the behavior of the things that we're adding up to get the sum. All right. And I'm going to do make that table for values of J up to a number that I'm going to call J max and I'm going to set that equal to 15, all right. And I'm going to call the table data. So here's what I'm tabulating. Table, curly, J, and then now the individual term. So that's F of J. And then I'm going to do that for J goes from 0 to J max, okay. So what is this table going to give me? It's not giving me a sum. It's giving me all the values of this thing, including the degeneracy for each value of J going from 0 to J max, which in this case is 15, okay. And now what we'll do is we'll list plot those so we can see the behavior of the individual contributions to the sum. So let's go ahead and enter that and then we'll plot it. But here's what I wanted to show you, okay. So notice that as you go to higher and higher Js, the number gets smaller and smaller, right? See how it's behaving here? So let's have a look at the plot. So the plot is going to be a list plot because it's discrete data, all right. So we just list plot data and here you can see the behavior of the individual terms. Okay, so the first one is 1 because we put in zeros for J and then it quickly rises up to a pretty large contribution, rises up more and more and then at some point it starts going down, down, down, down and you can see that once we get out to around J max the contributions are very small. So we might safely conclude then that if we include only 15 terms in this particular sum that we may get a well-converged result. So let's check that. So now what we'll do is we'll actually create another table where instead of looking at the individual terms we'll look at the value of the sum itself as a function of the number of terms that we include, okay. So for that what I need to do is I'm going to do sum of F and now I'm going to put in a dummy variable K and then K is going to go, I have to put a curly bracket here. K is going to go from zero to J max, curly, square bracket and then J max is going to go from zero to 20. You see what I'm doing here? I'm making a table of this, well let's wait, I got something wrong here. This should be a table with respect to J max, okay. So what I'm doing now is I'm making a table where J max is being incremented from zero to 20, okay. So the first entry in the table is going to be J max equals zero, okay. It's only including one term, the first term that's going to give me one in the sum. And then as I increment J max I'll be actually evaluating the sum here up to J max in each case until finally J max equals 20, okay. So we're basically going to see how does the sum itself depend on the maximum value of J that we include in it, all right. So let's go ahead and enter that, okay. So here's only one term, J max equals zero, we get one as expected. And then we add more and more terms and what you see is that after 15 here to the precision, the default precision in Mathematica the number doesn't change, okay. So we would say then that to this number of decimal places, this sum converges after 15 terms. So let's have a look at the convergence if you like. So what we can do is just do list plot data and now you can see if you only include one term you're way off and then you get closer and closer as you include more and more terms and then after, you know, around 15 it's converged. Okay, so if we wanted to quote a value then for the partition function of HCL and this is, I forgot to tell you that this corresponds to room temperature 298 Kelvin the value that we would say it's equal to is 19.9028, okay. So the main point of this exercise here though is to show you how when you are not able to generate a closed form for some, how it is that you can look at the behavior of the individual terms and then figure out how far out you have to go to get a given level of accuracy and how you can do this analysis and plot the results yourself quite easily using Mathematica. This would be a real pain to do with the calculator. Okay, now there's one other thing that I wanted to show you now that we actually have a converged partition function for HCL, there's another quantity that we can calculate and this will be familiar to those, well maybe not familiar to those of you yet in Chem 131. Did you guys talk about the populations of the levels? Okay, all right, well this is an interesting thing that you'll see later on in when you do the statistical mechanics. All right, so the next thing we're going to do is we're going to calculate the population of the levels, okay. And those come from what's called the Boltzmann distribution, I'll just write down the formula here, I need my pen. Okay, so the Boltzmann distribution tells us that the probability of being in the ith level is equal to the degeneracy of that level times e to the minus beta epsilon of i divided by the partition function, okay. So now what we'll do is we'll look for the first so many levels, I don't recall exactly how many, I guess we'll do the first 12 levels, 12 rotational levels, what's the probability of being in that level? We've already seen how to calculate q, we know how many terms we need to get a good value of q, so we'll just now evaluate this guy for j goes from 0 to 12 and see how that looks, okay. So now what I'm going to do is I'll just go ahead and grab this thing, put it down here, all right, so I'll say I'm going to set this equal to q, so this is going to give me a number for q and I've just seen that I only need to go out to how many terms? Fifteen, so I'll evaluate this out to 15 terms and that'll be my single number, converged number for my partition function, all right. And now I'll make a table that's going to hold the populations of the first 12 levels, rotational levels, okay, so that's going to be, I'll call it data again. So now what I'm going to do is table j and then I need e, well actually we already have the function defined, right, we've defined it here, it's fj is this exponential factor that we need, so we can go ahead and put that in, f of j and then we have to divide by q, all right, and then we'll go, j goes from 0 to 12, all right, so let's go ahead and we can enter that and then lastly what I'll do is plot the populations as a function of j, so list plot, plot data. So now what this is, this is the probability of finding hcl in the jth level, okay, so you can see for j equals 0 at room temperature, you expect to have 0.05 population and notice that it increases and the most probable rotational state of finding hcl at room temperature is, what is it, is this 3, looks like it's 3. 0, 1, 2, 3, okay, so if there was, you know, hcl vapor at room temperature, the majority, well the most probable rotational level would be j equals 3 and a consequence of this, these populations is, is that when you do vibrational spectra of hcl, you find that the shape, that the heights of the peaks are actually proportional to the populations of the levels when there's rotational find structure in the spectrum and the function, the envelope of those peaks actually has this shape, so you can actually see that in a spectrum. Okay, so there's your little introduction to using some, to do some statistical mechanical calculations, partition functions and what we're going to do next time, which is going to be next week is we will look at some examples of Fourier transforms in chemistry. All right, so if you haven't already done so, please register to use sci finder scholar following the instructions that I sent you yesterday because you're going to need to be registered if you want to follow along during the library resources presentation by Dr. Mitchell Brown on Thursday and as I think I already mentioned a couple of times, next week's homework assignment is going to be to use what you learn on Thursday to find data in the chemistry literature and you will be able to do that from any computer from which you have access to UCI library resources. Okay, so you don't need to come to the lab, so we're not going to have lab sessions next week. And in addition, you can do the homework at home if you want. The proviso is if you don't know how to establish a VPN connection, you're going to need to learn how to do that because to get access to the library resources you need to be able to use the VPN. All right, so we'll see you on Thursday.