 All right, it's 2 o'clock, time to start. So just to recap from last time what we did was we looked at the Solve command and at the end of the last time we saw how we can use the Solve command to tackle complex equilibria. So for example, the case we considered at the end of class last time was we have a weak acid in equilibrium with its conjugate base and under certain circumstances we have to also worry about the fact that that equilibrium is coupled to the water auto dissociation reaction. And so we saw that we could set that up in terms of a system of equations in a certain number of unknowns and then we could eliminate all but one of the unknowns and solve the problem using Mathematica. I want to do one more example in the same vein today. It's just a wee bit more complicated and it's just another illustration of how we can do these seemingly complicated problems pretty easily if we have an ability to solve the equations as we do in Mathematica. So what we're going to do today is I want to consider all the equilibria associated with a solution of sodium bicarbonate. Now, if you make a solution of sodium bicarbonate you know that that can dissociate into sodium plus plus the bicarbonate anion, okay? Now, this species here is what we call an amphoteric species. Does anybody remember what that means? Is this an acid or a base? Or both? It's both, right? And that's what we mean when we say amphoteric. It's a species that can act as acid or a base, all right? So the acid-base equilibria involving bicarbonate, there's a couple of reactions. One is that it can dissociate by reacting with water. So that produces the carbonate di anion plus H3O plus, all right? What else can it do? Gesundheit. Well, it can steal a proton from water and make carbonic acid plus OH minus. Look familiar? Does anybody know an example of where these reactions are important in the environment, say? Well, has anybody heard of ocean acidification? No? You guys need to pay a little more attention to the news. All right, so you know there's some discussion about climate change and the responsibility of humans in causing that primarily through burning of fossil fuels which produce CO2. And CO2 is a greenhouse gas so it traps the outgoing black body radiation from the earth and makes the planet warmer. Well, another consequence of all the CO2 in the atmosphere is that when you put CO2 in water, it turns into carbonic acid and carbonic acid can dissociate and make the ocean more acidic. Okay, so that's one place. And the equilibrium with carbonate is very important because a lot of the critters that live in the ocean have shells that are made up of a lot of calcium carbonate. So as you tweak the equilibrium by putting CO2 into the oceans, you actually also tweak the equilibria involving the shells of the animals and it's not good news for the animals. They can't make their shells if the ocean gets too acidic. Okay, so there's some relevance for you. Now let me get the eraser here. All right, but let's just go back to the chemistry problem which is what we're going to seek to do now is we're going to take a certain amount of sodium bicarbonate and then we're going to ask simple question, what's the pH of the solution? And we'll do it in the most accurate way we can by also including here the water dissociation equilibrium. It may not be necessary depending on, you know, what the parameters of the solution are, but we'll go ahead and do it and set it up in the most general way. Okay, so this is a little more complicated than what we did last time because in addition to having two chemical equations, we have a third one. Okay, so one more equation. Now how many unknowns do we have here if we want to characterize the situation at equilibrium? Unknown concentration of H2CO3 minus at equilibrium, carbonate, H3O plus, H2CO3, NOH minus, how many is that? Okay, we have five unknowns. So how many equations do we need to solve? Five. Okay, so let's start writing down what we know. All right, so let's see what we're going to call this one. So we have here the acid dissociation equilibrium for bicarbonate and if we like we can call that the second acid dissociation step for carbonic acid. All right, so I can write that down and look at the value, all right, so there's one equation. And then we have the KB for bicarbonate, we'll call that KB2. So that's equal to concentration of carbonic acid OH minus divided by HCO3 minus. And that equals 2.3 times 10 to the minus 8. Okay, and then we know K water is equal to the product of hydronium concentration times OH minus and that's 1.0 times 10 to the minus 14 at room temperature. Okay, so that was the three easy ones. And now let's remember what did we do last time in order to come up with the other ones that we needed in order to solve the problem. So what is conserved here? Charge, okay, so let's write down the conservation of charge. All right, so conservation of charge, what are all the positive species? We have Na plus because that's what we're putting in the solution and then we have H3O plus. All right, that's all the positive species and then for negative, pardon, and OH minus. Now there's something wrong with this. Does anybody know what's wrong with this one? As written, each mole of carbonate brings two moles of negative charge, so I have to multiply this by two. Okay, all right, what else is conserved? Carbon atoms, so what that means then is that the initial concentration of carbon, which is what I dump into the solution, is equal to HCO3 minus concentration at equilibrium plus CO3 two minus concentration at equilibrium plus H2CO3 at equilibrium. Okay, and for this guy here, I can put in the initial because sodium just sits around as a spectator and doesn't do anything, okay? So we have five unknowns and now we have five equations plus these two, so we just type them in. We'll do the, we'll use simplify or eliminate to get rid of all the unknowns except for the H3O plus. We'll solve the corresponding polynomial equation for the concentration of H3O plus and then we can calculate the pH for any concentration of sodium bicarbonate, okay? Then let's do it, okay. So we'll do like last time and set up a list of equations. So equations equals and we'll make it look nice, easy to read. Okay, so I'll go ahead and put in K2 equals concentration of H3O times concentration of, I'll call it carbonate and then divided by concentration of bicarb, oops, barb, alright, and that should be a comma and then we have KB2 equals, actually this needs to be a double equals, all right? So here we have the concentration of hydroxide times concentration of carbonic acid which I'll call carbonic and then divided by concentration of bicarbonate, all right? And then we have K water equals equals, concentration of hydronium times concentration of OH minus and then we have the concentration of the carbon species so that'll be C bicarb zero, that'll be the initial concentration equals equals C bicarb plus C carbonic and plus C carbonate, comma. And then finally the conservation of charge so C bicarb zero which is the concentration of sodium plus concentration of hydronium equals equals C bicarb plus two times C carbonic and then plus concentration of hydroxide, okay? And then I'll put a curly and a semicolon, all right? Oh, yeah, okay, thank you, that would have messed things up pretty good, yeah, you have to be careful typing or else you'll get nonsense, okay? So the next thing we need to do is simplify things so we're going to eliminate all the unknowns except for H3O since we're going to try to calculate the pH. So I'm going to say simplified equals, eliminate from equations a bunch of stuff, all right? So we want to get rid of carbonate, C carbonate. We want to get rid of C bicarb. We want to get rid of COH and we want to get rid of C carbonic, okay? All right, let's see if that works. All right, well let's have a look. It's always good to have a look at these things and make sure that the only variable you have in there is the one you didn't eliminate. So in our case that's CH3O so there it is. Everything else is a number that we know so the initial concentration of bicarbonate, the acid dissociation constant, the base constant, k water. So it looks good. And what order polynomial in the concentration of hydronium is this? That's another thing to check to see if it makes sense. What's the highest power of CH3O in this equation? It's fourth, the right hand side's got a cubed times H3O. Does that make sense? Does it make sense? Well, I'll let you ponder that. All right, so how do we solve then? So the next thing we do is we say we want to solve simplified. Actually I'll say let's assign this solution, the roots to a variable, roots equals solve, simplified for the concentration of hydronium. And we get a really lovely mess. Okay, so there you have it. How'd you like to do that by hand? So let's go ahead and hide that, okay? And now let's go ahead and calculate the pH corresponding to each of the roots and then we should be able to identify the value that we want. All right, so what we need to do is say pH equals minus log 10 CH3O and now we want to put in some values. So slash dot roots, slash dot and we'll put in some values. So the first thing I'll do is I'll say we're starting out with a concentration of sodium bicarbonate equal to 0.1 molar, so that's C, C bicarb, 0, arrow, 0.1 and then we have to put in KA2 arrow, 4.8 times 10 to the minus 11 and then KB2 arrow, that's 2.3 times 10 to the minus 8 and K water arrow, 1.0 times 10 to the minus 14, okay? Right, so remember that this is the construction that we use to get access to the roots and then this is the replacement rules to put in particular values, okay? And we've solved it in the most general way where in principle, you know, if we had KAs at, say, a temperature other than room temperature, we could use the same formulas, right? So this is general. We happen to put in the values for the equilibrium constants to correspond to room temperature but we could have put in other ones if we needed to, all right? And we could certainly change this C bicarb, 0 to whatever we want to see how it depends on the initial concentration. All right, so notice when we do that, we get all imaginary values but you can see that some of them are pretty small, the imaginary parts and so what we can do to trim those up to get rid of the numbers that are less than machine precision so we can put the CHOP command around there and now you see we have two real values and the question is which one of those is correct? It's interesting because we got two actual real roots which was, it's different from what's in the notes so that's why I'm actually looking here. Let's have a, let's do something here to have a look what they were before we CHOP them. Okay, so notice that these are definitely complex, right? They have substantial imaginary parts and this is the root with the smallest imaginary part so that's the one that you ought to consider to be the most likely answer. All right, so then the conclusion would be that the pH of this solution is 8.3, okay? Now, the question is, or one question to consider is is that a sensible number? Is that acidic or basic? It's basic, not very basic but we have a species that's both an acid and a base, right, bicarbonate so how could we tell whether or not it should be basic or acidic? Well, you can look at the equilibrium constants, right? The KB is bigger than the KA so you expect that equilibrium to dominate, no? So in other words, you would expect the base reaction to be more to the right than the acid reaction and so you should in fact be producing OH minus and the solution should in fact be basic and 8.3 seems pretty sensible, right? Yes? Well, this value here has the smallest imaginary part and so I'm calling that the most sensible value, all right? Okay, any other questions on that one? All right, so if you want, I'm not going to go through the pain of doing another one of these. There's another example in the notes that's very similar to this except it involves a basic species that can pick up two protons, okay? So there's two base equilibria involved and then you could add that to the water dissociation equilibria. The setup is very similar to this one and so if you want to see another example of solving a complex equilibrium problem, you can look in the notes. That's very similar to this one so I don't think we need to do it, all right? Like I say, once you have this whole setup, you could play around with the concentrations if you want. Say, okay, what if I changed it to 0.5 molar? So or 0.05 molar, all right? So you could play around with that. All right, so if there aren't any questions then we're going to switch subjects and the next subject that we're going to cover is differential equations. So I'm going to do a little introduction on the board. Has anybody in here taken, I think it's math 3D or taking, had a course in differential equations? No, okay, well you should. So what is a differential equation? What does it sound like? It's an equation that has derivatives in it, yeah, all right? So it's an equation that involves derivatives of a function and if you want to solve a differential equation, what you're doing when you solve the differential equation is you're finding the function for which that equation is true. Okay? And those of you who are in Chem 131A now have seen differential equations. What's an example of a differential equation that you've seen? Pretty quiet today. Come on, somebody, isn't the Schrodinger equation a differential equation? So for example, for the particle in a box, does that look familiar? All right, so it's an equation that involves the second derivative of psi, the wave function, it also involves the function itself. And what you seek to do when you solve the Schrodinger equation is find the function psi that satisfy that equation. You've seen another one in physics, classical mechanics. Hm? Newton's equations, right? What's Newton's equations? Mass times acceleration equals force. So for a classical particle moving in one dimension, that would be d squared x by dt squared is equal to the force. Look familiar? That's another differential equation where you seek to find the trajectory of the particle that satisfies that equation given force. Okay? All right. Well, the differential equations, as you can see already from these two examples, they appear all over the place in science, in chemistry, physics, biology. So equations describing population dynamics, for example. Economics, all right, so they're everywhere. And if you take math 3D, I think it is the differential equations course, then you'll spend a whole quarter just barely scratching the surface of all the properties and techniques for solving differential equations. And so it's going to be a horrible injustice, what we're going to do in here in just a matter of approximately, you know, an hour or two. But I thought I would just give you an entree into seeing how it is that you can use Mathematica to solve differential equations if you ever need to do so. And just to show you that there are practical applications in chemistry, we'll treat some kinetics problems that are quite complicated to do by hand. So remember kinetics equations, remember, for example, if we have a first order process and we call the concentration of a reactant A, the rate of disappearance of A is proportional to its concentration. That's the first order rate equation. And it is a simple differential equation. All right, so I want to just mention to you a little bit of lingo concerning differential equations. So first of all, there's a couple of different classes. One is called ordinary. And that's when there's only regular total derivatives. So that's when you have, for example, a function of one variable. Okay, so there's only one derivative, one variable with respect to which you can differentiate. And you could also have more than one variable in which case you have partial derivatives and the differential equation that it contains partial derivatives is called a partial differential equation. Okay? All right, what else do we have? Well, I can show you an example. So one example is the diffusion equation. So the diffusion equation tells us how the concentration of some species, which is a function of its position and also the time, is related to the spatial variation of the species concentration. And the portionality here is the diffusion constant. And later on in Chem 131, you'll probably talk a little bit about that when you talk about transport and diffusion. Okay, now there's another classification that you'll hear from time to time and that is linear versus nonlinear differential equations. All right, so linear has the general form that I'll write here and then I'll just tell you how to interpret it. So there's some function of x, the independent variable, plus some other function of x times y, plus some other function of x times dy by dx, et cetera. Sorry for the squeaks. So linear refers to the fact that this equation is linear in y and its derivatives, okay? G, A0, A1, A2, et cetera, they can be any functions of x. But since y and its derivatives only show up in linear form, then that's what's called linear. And then nonlinear is anything else. So I'll just show you a couple of examples. And in general, nonlinear considerably more complicated to solve than linear. For linear there's lots of nice properties that allow the solutions to be obtained relatively easily. So this simple differential equation would be nonlinear. What's the source of the nonlinearity there? It's the y squared. All right, another one that's nonlinear because of the sign, all right? And then I'll write down one more. One plus y squared d squared y by dx squared plus x times dy by dx equals e to the x. So where's the nonlinear part of that one? Yeah, it's the y squared again, okay? We don't care about the e to the x or the x times the derivative, all right? Now there's one last piece of lingo that I'll just introduce you to and that's what's called the order of the equation. And the order is just given, it's defined as the highest order derivative, the order of the highest order derivative that you have in the equation, okay? So what's the order of this one? Two. What about this one? It's called first order, yeah, this one, second order. And this one's also second order. All right? So there's a little crash course on the classification of differential equations. Now what we're going to do here is I'm going to show you some examples of how you can solve differential equations using Mathematica. We won't do partial differential equations. We'll just do ordinary. And so this is just, like I say, I just want to give you an entree into it because if you ever decide you want to use Mathematica someday to solve differential equations, you'll know that you have this powerful tool and you can presumably figure out how to do it for whatever your particular problem is, all right? And we're going to see two different ways of doing it. One is there will be cases where we can actually get exact solutions. Those are, you know, a small fraction of all the possible cases that you might want to examine. And then there's a very powerful numerical solver in Mathematica. So even if you can't get the exact solution, which is quite frequent, you can get numerical solutions, all right? So we'll have an introduction to that, too. And then we'll do some examples from chemical kinetics. All right, so as usual, we'll start simple. And the first thing we'll do is we'll do a very simple, linear first-order ordinary differential equation. And what I'm going to do is call the solution, and then the command is desolve, all right? And then you type in the equation or equate it to a variable if you want. And this one's going to be y prime of x equals equals 3 times x squared times y of x, okay? So you can see first-order because we have only the first derivative. And then it's ordinary, only one variable. And it's linear because y and its derivatives appear in linear form, okay? So then the next thing we need to do is say what we're solving for, so here we're solving for y of x. And to say what's the independent variable, x, all right? And now we should be able just to crank it out. And notice you get the solution in the form, same kind of form as what you get when you use the solve command. And so the way you unpack that is the same way that we unpacked roots of equations that we solved using the replacement rule syntax, okay? Now there's something interesting about this. So this basically says that the solution to this differential equation is e to the power x cubed. And then time c bracket 1. What is the c bracket 1? Well it's an arbitrary constant. You can sort of think of it like a constant of integration, all right? Now this is what you might call the general solution, okay? Now usually when you're solving differential equations, especially if they're describing some sort of physical phenomenon, what you'd rather have is a solution called a particular solution. And the way you get a particular solution is by specifying what are called boundary conditions or a boundary condition, okay? Now those of you who are in Chem 131A now know that the boundary conditions that you impose on the Schrodinger equation are what give you actually the quantization and the allowed values of quantum numbers and energies, right? They're dictated by certain restrictions on the problem that come from the physics. So for example in the particle in a box you say that because the potential energy at the walls of the box is infinite, the particle can't be outside the box, all right? So that means the wave function has to go to zero at the two ends of the box and those are what are called boundary conditions. So they're particular restrictions on the general family of solutions that correspond to the actual physical problem that you're trying to solve, all right? So if we want a specific solution here, we can plug in boundary conditions. We'll see how to do that in a minute. But first I just want to show you that we can actually verify that the solution is in fact a solution of the problem. So I'll show you how to do that, all right? So what we want to do is take this solution, take its derivative and ask whether or not that's equal to 3x squared times the solution, all right? So here's how I do that. I say d for the derivative and then I say y of x slash dot solution, okay? So that's going to unpack this thing for me. So I'm, this is differentiating that function with respect to x and then I put in bracket, bracket one so that it pulls out the element of the list, doesn't have it in list format and then in order to ask if it's equal to something, I do the double equals and then 3 times x squared times, oops, 2 times y of x slash dot solution, all right? And if I do that, I get the answer true, all right? So this line here just asks if the derivative of the solution is equal to 3dx squared times the solution. In other words, does that solution satisfy that differential equation and the answer is yes, okay? All right, now let's go ahead and see how to put in a particular or a boundary condition, all right? Now if I want to put in a boundary condition, it's sort of like when we do the solve command, it's like adding an extra equation, okay? So what I do is I now make a list here where one element of the list is my differential equation and the second element in this case will be my boundary condition, so I'm going to say give me the particular solution that makes y of 0 equal to 0. Actually, I'm going to say 1, say 1, okay? So when I evaluate y at the point x equals 0, I want to make sure my solution gives me the value 1, okay? And what you see is that you get the particular solution where the constant is equal to 1 and you can verify that this does in fact give you 1 when you plug in 0, right? e to the 0 is equal to 1. So that means that constant had to be 1 and that's what we can see in the solution. All right, so that's basically how D solve works. You put your differential equation in there, add on any boundary conditions and as we'll see in a few minutes, you can put in lists of differential equations so you can solve problems that involve couple differential equations like complex chemical kinetics problems and get solutions. All right, so let's do a couple more examples. All right, so now I'm going to solve a first-order, ordinary nonlinear differential equation, all right? So D solve and this one's going to be y times y prime. Actually, let's make it a little fancier. So I'm going to say y times and then I'm going to go over here to the pallet and use this little del thingy, the derivative with respect to x of y of x and then that's going to be equal to minus x, okay? And if I don't put in a boundary condition, I'll get the general solution. All right, oops, what happened here? Y of x times this one, what's wrong with it? Oh, I have to say y of x, yeah, thank you. Yes, indeed, all right, so there you have it. You get two solutions and each one has, it turns out the same arbitrary constant. Do another one, all right? So this will be a second-order linear. Differential equation. So y double prime of x plus y of x equals zero. Solve for y of x, x. All right, so there you have it. You get a general solution which involves an arbitrary constant times cosine plus a different arbitrary constant times sine, okay? So these are, this is going to be some periodic functions and I thought I'd just show you another way that you can kind of use the output in various ways. So what I'm going to do is set this equal to solution, all right, just re-enter it and now what I'm going to do is make a whole family of these solutions for different values of these constants and then we'll plot them all at once so you can kind of see how this solution depends on which, what's the values of the constants, okay? So I'm going to say particular solutions equals and so I'm going to use the table command y of x slash dot solution so that unpacks the solution and then I'm going to use replacement rules to specify the constants. So slash dot curly bracket, c bracket 1, well it should be capital C bracket 1, arrow i and then c bracket 2, arrow j, okay, and then I'm going to evaluate this for i goes from minus 2 to 2 and j, oops, curly bracket, goes from minus 2 to 2. So how many solutions am I generating here? Well, this is making a table for 5 values of i, so minus 2, minus 1, 0, 1, 2 and 5 values of j so there will be a total of 25 functions created here for all these different combinations of c1 and c2, okay? So it's going to be changing the amount of sine or cosine character as we make our way through the table. All right, so let's go ahead and plot that. Now I can say plot particular solutions, particular solutions, I'm going to spell this right and we'll plot it over one cycle so x goes from 0 to 2 times pi, okay, see if that works. And then you get this nice little spirograph thingy which contains all 25 of those curves with different coefficients. All right, so you can kind of see how the solutions vary depending on which particular solution you've chosen, okay? So for example, which one is this? This one looks like the cosine, pure cosine function so that's probably got to be c of 1 equal 1, c of 2 equals 0. There's also one where they're both 0 but that's just along the line here, okay? Anyway, so that's just an example of one of the things that, one of the ways in which you can use the output in a creative way. Okay, so let's do another one. And the point of this example is to show you that sometimes you get interesting results, all right? So now what we're going to do, this is going to be a second order differential equation that is actually the quantum mechanical harmonic oscillator. So those of you in PCEM have seen this in some form or another. So we'll say solution equals d solve y double prime of x minus 2 times x times y of x equals equals minus 2 times a times y of x where a is some combination of constants, all right? And we'll solve that for y of x, x, all right? 2x y prime of x, correct. Thank you, sorry about that. So this is one way of writing down the general, well, the Schrodinger equation for the harmonic oscillator. And the point of this is to show you that you get out something that looks intriguing, okay? We didn't put in any boundary conditions here. In principle, you could do that. But what is this? Well, it says that the solution is equal to an arbitrary constant times something. Which we don't necessarily know what that is just yet called hermeet h, which has a and x as arguments. And then plus another constant times this hypergeometric 1f1, okay? Now those of you who've taken or in 131a right now, you probably recognized hermeet h. And what that is is the so-called hermeet polynomial, which is part of the wave function for the harmonic oscillator. And then you can also find out what's this hypergeometric 1f1, all right? So there you have it. Many famous differential equations of chemistry or chemical physics, whatever you want to call it, physics, solutions of the Schrodinger equation and the hydrogen atom happens to be another where the solutions that come out are given in terms of so-called special functions, which include polynomials. And so here's a case where the harmonic oscillator, the Schrodinger equation for that can be written down in the form of hermeet's equation. And then the solutions to that are the so-called hermeet polynomials, okay? But the main point here being that, you know, sometimes you get out apparently complicated-looking solutions, but it actually makes sense if you know what you're doing. Okay. So let's now move on to an example where we won't get the exact answer, all right? So this is going to be a first-order differential equation that can't be solved analytically, all right? So D solve Y prime of X equals equals cosine of X times Y of X. Doesn't look that complicated, but if you enter, you see that you get the brown stuff, it crunches away for a while and then finally just spits your equation, your command right back at you, which means it couldn't do it, okay? So what do you do? Do you give up? Call your mom? Cry? Or you try N D solve for numerical, all right? So let's go ahead and do that. Now the thing about numerical solution is that it requires a boundary condition, okay? So you have to have a particular problem in mind to use N D solve. All right. So the boundary condition we're going to use for this one is that Y of zero is equal to zero. Now another thing that it requires because it's generating a numerical solution, it needs to know over what interval of the independent variable do you want the solution, okay? So in this case, we will say we want X going from zero to one, all right? And that's how we say that in the usual way. Okay, so let's try that. Oops. I'm sorry, what? There's a what? Oh, yeah, it's supposed to be N D solve. Thank you. All right. Now the thing you get out, does that look useful? Y of X is an interpolating function. It turns out that that is a good thing. You can use that, all right? So what that means is you are successful and you got something that you can use. And so the next thing to do is to tell you how to use. Basically, this interpolating function is a formula that tells Mathematica how to generate that solution, the numerical version of it, given some instructions, okay? So let's go ahead and give it some instructions. All right, so to do that, I'm going to pack that thing into a variable called solution, all right? And then go ahead and just do it again. All right, and now I'm going to tabulate that and then plot it. Okay, so I'm going to say table Y of X slash dot solution and then I'm going to make the table for X goes from zero to 10 in increments of 0.5. And sorry, I should have put 10 up here. Let's go ahead and re-enter this with a 10, all right? All right, so what this means is I'm going to get values at X equals 0 for the solution generated numerically for X equals 0, 0.5, 1, 1.5, 2, et cetera, okay? Now, if I enter that, then I just get a list of numbers. So that's one thing I can do if I want the numbers themselves. Another thing I can do is I can make a plot of the solution directly. So that interpolating function is a function that can be plotted, all right? So plot Y of X slash dot solution and now I can specify the range so it'll be X goes from zero to 10, okay? And so then there you have it. That's the function that's the solution to this differential equation. DY DX is equal to cosine of X times Y, all right? And this is just two different ways of using the output either as you may want some values tabulated or you may want to plot it or you may want to do both, all right? So that's the basic scheme for generating the numerical solution and then making use of this interpolating function that comes out, all right? So far we've had some success solving single differential equations so let's go ahead and do couple differential equations. All right, so I'm going to define a list of equations. It's going to just contain two. So equations equals and the first one is going to be X prime of T equals equals X of T minus Y of T and then the second one will be Y prime of T equals equals Y of T, all right? Now, I said that these are coupled equations. What do you suppose that means? It means that one of the functions appears in both, one or more of the functions appears in both equations, all right? So the equation for X depends on the solution to the differential equation for Y, all right? So they have to be solved together and that's something that you can do. So we can say now D solve equations and you can ask for solutions for both X and Y and put in the independent variable and notice you get two general solutions, okay? So that tells us now we've got a list of two solutions. X equals a constant times E to the T minus another constant times T E to the T and then Y is equal to the second constant times E to the T, okay? Let's try another one. So equations equals, so this one will be X prime of T equals equals minus 2 times X of T squared and then minus Y of T and the second one will be Y prime of T equals X of T minus Y of T, all right? So a little more complicated coupled equations. In this case, the equation for Y prime involves X and the equation for X prime involves Y, so coupled and now we can say D solve equations solved for X of T and Y of T and you see it doesn't look very encouraging so we go up here to evaluation and we say stop, okay? And then what do you do? You try and D solve, oops, aha. So when you use N D solve, you need to supply more information, don't you? So what do I need to supply? I need to put in some boundary conditions. I'm going to go ahead and put this here, okay? And so my boundary conditions for this problem are going to be X of 0 equals equals 0.2 and Y of 0 equals equals 0.1 and then I also need to say what's the range. So T here is going to go between 0 and 10, okay? I'm missing X here. All right, let's see what we get. Good news, we got interpolating functions. That means you succeeded. Now let's go ahead and plot them. So we want to plot them both on the same plot, unpack and put in the range. X goes from 0 to 10. What did I do wrong? Pardon? Oh, right, yes, I forgot to name that solutions. That's right. Thank you and we'll try again and we don't get anything and the reason for that is we need to unpack the list. Oh, oh, this is T, right. Boy, we're making, ah, there we go. Righto, so now let's just say plot range. Error all and there you have your solutions. Now, I'll show you another type of plotting. So let's think about what we've got here. So here we've got two functions X and Y that depend on a parameter T, so it might be like time, okay? X and Y might be coordinates. Or some other function is up time. And what we've plotted here now is we've plotted X of T and Y of T. But there's another way of displaying the solutions, this kind of interesting which is called a parametric plot. And what that would show is how the pair of points X and Y together evolve in time. Make sense? So we could say X and Y are a point in the XY plane. And I want to see how does that point move around, those pair of values move around as time goes on. So let's have a look at what that looks like. There's actually a special plot command for that. Okay, so you could say parametric plot. And then we have to put in our functions. So that's going to be these two guys, all right? Slash dot solutions, okay? And then we put in the range of T. So T goes from 0 to 10. And let's go ahead and put in some axes labels. So we can see what we're doing here more clearly. So label the axes X and Y. And we get this spirally looking thing. Does that make sense? So first of all, I just want to make sure you understand the difference between these two plots, okay? So here we're plotting each function separately and seeing their time dependence. And down here we're seeing how, you know, the point X and Y at a given instant of T varies. And what I want to ask you to see if you can figure out is where is time equals 0 on this plot? Well, that's at the point where X is equal to point 2 and Y is roughly equal to point 1, right? This is time axis. Time equals 0 is here. And there X is point 2 and Y is around point 1. So where is that on this? Actually it's off the plot. It's the plot range arrow all. Okay. Now you can see X is equal to point 2 and Y roughly equal to point 1 and that's here. So what this pair of functions is doing, if this were some coordinate or something, as time goes on it spirals into the origin. And you can see that up here because these guys are decaying functions and they end up both near 0 as time goes on. Right? So here's time equals 0 and then time equals 10. So this is a common way of plotting solutions to differential equations that describe dynamical systems. It's kind of interesting to see these so-called parametric plots or another name for them in physics is called a phase plot. All right. So let's see what else do we have. Well, I think we're actually at a very good place to stop for today because the next thing that I want to do with you is to show you how to use these differential equation solving techniques in Mathematica to tackle problems of increasing complexity in chemical kinetics. All right? So we'll start out real simple with the first order one that we know how to do by hand and we'll kind of convince ourselves that we know what we're doing. And then we'll move up to more and more complicated cases that you normally don't consider in general chemistry for sure but are nonetheless very important if you want to talk about the role of say catalysts or enzymes in chemical reactions or if you just have a series of reactions that are somehow coupled or connected by equilibria. Okay? So the kinetics equations can become quite complicated and we'll see that it's very easy to handle those in Mathematica. All right? So that's what we'll do on Monday. Have a nice weekend.